Exemple #1
0
#
# This makes Substance metaclasses.
define_classes(substances, BRICK.Substance, pun_classes=True)

# this defines the SKOS-based concept hierarchy for BRICK Quantities
define_concept_hierarchy(quantity_definitions, [BRICK.Quantity, QUDT.QuantityKind])

# for all Quantities, copy part of the QUDT unit definitions over
res = G.query(
    """SELECT ?quantity ?qudtquant WHERE {
                ?quantity rdf:type brick:Quantity .
                ?quantity owl:sameAs ?qudtquant
                }"""
)
for r in res:
    for unit, symb in get_units(r[1]):
        G.add((r[0], QUDT.applicableUnit, unit))
        G.add((unit, QUDT.symbol, symb))

logging.info("Finishing Tag definitions")
# declares that all tags are pairwise different; i.e. no two tags refer
# to the same tag
different_tag_list = []
for tag, definition in tags.items():
    different_tag_list.append(TAG[tag])
    G.add((TAG[tag], A, BRICK.Tag))
different_tag = BNode("tags_are_different")
G.add((BRICK.Tag, A, OWL.AllDifferent))
G.add((BRICK.Tag, OWL.distinctMembers, different_tag))
Collection(G, different_tag, different_tag_list)
Exemple #2
0
#               brick:measures  brick:Air ,
#                               brick:Temperature .
#
# This makes Substance metaclasses.
define_classes(substances, BRICK.Substance, pun_classes=True)

# this defines the SKOS-based concept hierarchy for BRICK Quantities
define_concept_hierarchy(quantity_definitions, [BRICK.Quantity])

# for all Quantities, copy part of the QUDT unit definitions over
res = G.query("""SELECT ?quantity ?qudtquant WHERE {
                ?quantity rdf:type brick:Quantity .
                ?quantity brick:hasQUDTReference ?qudtquant
                }""")
for r in res:
    for unit, symb, label in get_units(r[1]):
        G.add((r[0], QUDT.applicableUnit, unit))
        G.add((unit, A, UNIT.Unit))
        if symb is not None:
            G.add((unit, QUDT.symbol, symb))
        if label is not None and not G.objects(unit, RDFS.label):
            G.add((unit, RDFS.label, label))

# entity property definitions (must happen after units are defined)
G.add((BRICK.value, A, OWL.DatatypeProperty))
G.add((BRICK.value, SKOS.definition,
       Literal("The basic value of an entity property")))
G.add((BRICK.EntityProperty, RDFS.subClassOf, OWL.ObjectProperty))
G.add((BRICK.EntityProperty, A, OWL.Class))
define_shape_properties(shape_properties)
define_entity_properties(entity_properties)