Пример #1
0
def _t(subject, label, *rests, def_=None, synonyms=tuple(), comment=None,
       equivalentClass=oec):
    members = tuple()
    _rests = tuple()
    for rest in rests:
        if isinstance(rest, tuple):
            if len(rest) == 2:
                _rests += rest,
            else:
                raise ValueError(f'length of {rest} is not 2!')
        elif isinstance(rest, Combinator):
            members += rest,
        else:
            members += rest,

    rests = _rests
    if not members:
        members = ilxtr.technique,

    yield from oc(subject)
    yield from equivalentClass.serialize(subject, *members, *restrictions(*rests))
    yield from olit(subject, rdfs.label, label)
    if def_:
        yield from olit(subject, definition, def_)

    if synonyms:
        if not isinstance(synonyms, tuple):
            # this is why python sucks and racket is awesome if this was racket
            # the error would show up on the line where the problem was :/
            raise TypeError(f'Type of {synonyms!r} should not be {type(synonyms)}!')
        yield from olit(subject, NIFRID.synonym, *synonyms)

    if comment:
        yield from olit(subject, rdfs.comment, comment)
Пример #2
0
     ilxtr.aspect),  # these are preferably units?
    odp(ilxtr.resultValue),
    oop(ilxtr.hasResult),  # or hadResult ...
    (ilxtr.hasResult, rdfs.subClassOf, prov.generated),
    (ilxtr.hasResult, rdfs.domain, ilxtr.protocolExecution),
    # FIXME this domain restriction may not work quite like we want it to
    # ideally we would like to take an instance of a material entity + an aspect
    # and bind the result to that pair, with some additional sematics outside owl
    # you could use [ a protc:Result; protc:onAspect asp:myAspect; protc:resultValue 100; protc:impl <some impl id>; protc:prov <id>]
    # we could then and lift that to [ a owl:Restriction; owl:onProperty asp:myAspect; owl:hasValue 100]
    # or we could create a new iri from the intersection of the aspect and the implementation or better yet the execution prov id ...
    (ilxtr.hasResult, rdfs.range, ilxtr.result),
    oc_(
        ilxtr.protocolExecution,
        oec(ilxtr.technique,
            *restrictions((ilxtr.isConstrainedBy, ilxtr.protocol), )),
    ),
    (ilxtr.protocolExecution, rdfs.subClassOf, prov.Activity),
    olit(ilxtr.protocolExecution, rdfs.label, 'protocol execution'),
)

triples += (  # material entities

    ## material entity
    (ilxtr.materialEntity, owl.equivalentClass, BFO['0000040']),
    oc_(ilxtr.materialEntity, restriction(ilxtr.hasAspect, asp.livingness),
        restriction(ilxtr.hasAspect, asp['is'])),
    oc(ilxtr.compositeMaterialEntity, ilxtr.materialEntity),

    # more real than real
    oc(ilxtr.theObservableUniverse,