Ejemplo n.º 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)
Ejemplo n.º 2
0
imports = NIFTTL['nif_backend.ttl'],
#imports = obo['bfo.owl'], obo['ro.owl']
#imports = tuple()
comment = 'The core components for modelling techniques and methods.'
branch = 'methods'
_repo = True
debug = True

triples = (
    # data properties
    odp(ilxtr.hasAspectValue),
    odp(ilxtr.hasConstrainingAspect_value,
        ilxtr.isConstrainedBy),  # data type properties spo object property
    (ilxtr.hasConstrainingAspect_value, rdfs.subPropertyOf,
     ilxtr.hasAspectValue),
    olit(ilxtr.hasConstrainingAspect_value, rdfs.label,
         'has constraining aspect value'),
    olit(ilxtr.hasConstrainingAspect_value, definition, (
        'In some cases a protocol is classified based on the value '
        'that a constraining aspect has, not just that it is constrained on that aspect. '
    )),
    olit(ilxtr.hasConstrainingAspect_value, rdfs.comment, (
        'For example, dead and alive are 0 and 1 on livingness respectively. '
        'we can also define dead and alive, as disjoint, but that does not effectively '
        'model that they are two sides of the same coin for any binary definition. '
        'Note that this implies that these are not just qualities, they must have an '
        'explicit value outcome defined.')),

    # object properties
    oop(ilxtr.hasOperationDefinition),
    oop(ilxtr.hasDefiningProtocol, ilxtr.hasOperationDefinition),
    oop(ilxtr.hasExecutor, hasParticipant),
Ejemplo n.º 3
0
triples += (  # protocols
    oc(prot.CLARITY, ilxtr.protocol),
    oc(prot.deepSequencing, ilxtr.protocol),
    oc(prot.sangerSequencing, ilxtr.protocol),
    oc(prot.shotgunSequencing, ilxtr.protocol),
    oc(prot.fMRI, ilxtr.protocol),
    oc(prot.dwMRI, ilxtr.protocol),
    oc(prot.DTI, ilxtr.protocol),
)

triples += (  # information entity

    # information entities
    oc(ilxtr.informationEntity),
    olit(ilxtr.informationEntity, rdfs.label, 'information entity'),
    olit(ilxtr.informationEntity, definition,
         'Any physically encoded information.'),
    oc(ilxtr.informationArtifact, ilxtr.informationEntity),
    oc(ilxtr.informationArtifact, BFO['0000031']),
    olit(ilxtr.informationArtifact, rdfs.label, 'information artifact'),
    olit(ilxtr.informationArtifact, definition,
         ('An information entity that has an explicit symbolic encoding '
          'which is distinct from the existence or being that it encodes.')),
    (ilxtr.informationArtifact, owl.equivalentClass,
     OntTerm('IAO:0000030', label='information content entity')),
    oc(ilxtr.protocol, ilxtr.informationEntity),
    olit(ilxtr.protocol, rdfs.label, 'protocol'),
    olit(ilxtr.protocol, NIFRID.synonym, 'technique specification'),
    oc(ilxtr.protocolArtifact, ilxtr.informationArtifact),
    (ilxtr.protocolArtifact, rdfs.subClassOf, ilxtr.protocol),