Created
June 9, 2022 01:25
-
-
Save gtfierro/fa91a38103868fb456ded7ea18298c1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@prefix bacnet: <http://data.ashrae.org/bacnet/2020#> . | |
@prefix brick: <https://brickschema.org/schema/Brick#> . | |
@prefix bsh: <https://brickschema.org/schema/BrickShape#> . | |
@prefix dcterms1: <http://purl.org/dc/terms#> . | |
@prefix owl: <http://www.w3.org/2002/07/owl#> . | |
@prefix qudt: <http://qudt.org/schema/qudt/> . | |
@prefix qudtqk: <http://qudt.org/vocab/quantitykind/> . | |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | |
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
@prefix ref: <https://brickschema.org/schema/Brick/ref#> . | |
@prefix s223: <http://data.ashrae.org/standard223#> . | |
@prefix sdo: <http://schema.org/> . | |
@prefix sh: <http://www.w3.org/ns/shacl#> . | |
@prefix skos: <http://www.w3.org/2004/02/skos/core#> . | |
@prefix sosa: <http://www.w3.org/ns/sosa/> . | |
@prefix tag: <https://brickschema.org/schema/BrickTag#> . | |
@prefix unit: <http://qudt.org/vocab/unit/> . | |
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . | |
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | |
@prefix ext: <urn:my-extension#> . | |
@prefix bldg: <urn:my-building#> . | |
# extension class definitions | |
ext:InterfacePanel a owl:Class ; | |
skos:definition "A panel that provides an interface for user input" ; | |
# TODO: probably shoudl be subclass of brick:Device or IT_Device | |
rdfs:subClassOf brick:Entity ; | |
. | |
ext:User_Rating_Sensor a owl:Class ; | |
rdfs:subClassOf brick:Sensor ; | |
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@prefix bacnet: <http://data.ashrae.org/bacnet/2020#> . | |
@prefix brick: <https://brickschema.org/schema/Brick#> . | |
@prefix bsh: <https://brickschema.org/schema/BrickShape#> . | |
@prefix dcterms1: <http://purl.org/dc/terms#> . | |
@prefix owl: <http://www.w3.org/2002/07/owl#> . | |
@prefix qudt: <http://qudt.org/schema/qudt/> . | |
@prefix qudtqk: <http://qudt.org/vocab/quantitykind/> . | |
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | |
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
@prefix ref: <https://brickschema.org/schema/Brick/ref#> . | |
@prefix s223: <http://data.ashrae.org/standard223#> . | |
@prefix sdo: <http://schema.org/> . | |
@prefix sh: <http://www.w3.org/ns/shacl#> . | |
@prefix skos: <http://www.w3.org/2004/02/skos/core#> . | |
@prefix sosa: <http://www.w3.org/ns/sosa/> . | |
@prefix tag: <https://brickschema.org/schema/BrickTag#> . | |
@prefix unit: <http://qudt.org/vocab/unit/> . | |
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . | |
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | |
@prefix ext: <urn:my-extension#> . | |
@prefix bldg: <urn:my-building#> . | |
# model | |
bldg:room1 a brick:Bathroom ; | |
rdfs:label "Bathroom" ; | |
brick:hasPoint bldg:ammonia1 ; | |
brick:isLocationOf bldg:interface_panel1 ; | |
. | |
bldg:ammonia1 a brick:Ammonia_Sensor ; | |
ref:hasExternalRepresentation [ | |
ref:hasTimeseriesId "c3298e46-7546-4119-9418-799e14a249a7" ; | |
ref:storedAt "postgres://user:pass@host:port/db" ; | |
] ; | |
ref:hasExternalRepresentation [ # TODO: not defined yet | |
ref:hasMQTTTopic "room1/amonia1" ; | |
] ; | |
ref:hasExternalRepresentation [ # TODO: not defined yet | |
# rest endpoint | |
ref:hasRESTEndpoint "https://my.cloud.ammonia/" ; | |
# openapi spec | |
ref:hasSchema "path/to/schema.json" ; | |
] ; | |
. | |
bldg:interface_panel1 a ext:InterfacePanel ; | |
brick:hasPoint bldg:user_rating_sensor1, bldg:battery_status_1 ; | |
. | |
bldg:user_rating_sensor1 a ext:User_Rating_Sensor ; | |
ref:hasExternalRepresentation [ | |
ref:hasTimeseriesId "0612b973-c71e-4e8c-acd3-37c6556261ac" ; | |
ref:storedAt "postgres://user:pass@host:port/db" ; | |
] ; | |
. | |
bldg:battery_status_1 a brick:Battery_Voltage_Sensor ; | |
ref:hasExternalRepresentation [ | |
ref:hasTimeseriesId "20fcbc8b-93fb-4696-ba9d-f0d9df67d2a5" ; | |
ref:storedAt "postgres://user:pass@host:port/db" ; | |
] ; | |
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import brickschema | |
g = brickschema.Graph() | |
g.load_file("https://sparql.gtf.fyi/ttl/Brick1.3rc1.ttl") | |
g.load_file("model.ttl") | |
g.load_file("extension.ttl") | |
res = g.query("""SELECT ?bat ?interface ?room WHERE { | |
?room a brick:Bathroom . | |
?room brick:isLocationOf ?interface . | |
?interface brick:hasPoint ?bat . | |
?bat a brick:Battery_Voltage_Sensor . | |
}""") | |
for row in res: | |
print(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment