fromvrdfimportDB, BRICK, AfromrdflibimportNamespaceBLDG=Namespace("urn:bldg#")
db=DB("test.db")
# using logical timestamps here (0, 1, 2, 3, ...). If these are# ommitted it defaults to the current system time.withdb.new_changeset("my-building", 1) ascs:
cs.add((BLDG.vav1, A, BRICK.VAV))
cs.add((BLDG.vav1, BRICK.feeds, BLDG.zone1))
cs.add((BLDG.zone1, A, BRICK.HVAC_Zone))
cs.add((BLDG.zone1, BRICK.hasPart, BLDG.room1))
# WARNING: this is slow for nowwithdb.new_changeset("brick", 1) ascs:
# 'cs' is a rdflib.Graph that supports queries -- updates on it# are buffered in the transaction and cannot be queried until# the transaction is committed (at the end of the context block)cs.load_file(
"https://github.com/BrickSchema/Brick/releases/download/nightly/Brick.ttl"
)
withdb.new_changeset("my-building", 2) ascs:
cs.add((BLDG.vav2, A, BRICK.VAV))
cs.add((BLDG.vav2, BRICK.feeds, BLDG.zone1))
cs.add((BLDG.zone2, A, BRICK.HVAC_Zone))
cs.remove((BLDG.zone1, BRICK.hasPart, BLDG.room1))
withdb.new_changeset("my-building", 3) ascs:
cs.add((BLDG.vav2, A, BRICK.VAV))
cs.add((BLDG.vav2, BRICK.feeds, BLDG.zone1))
cs.add((BLDG.zone2, A, BRICK.HVAC_Zone))
cs.remove((BLDG.zone1, BRICK.hasPart, BLDG.room1))
withdb.new_changeset("my-building", 4) ascs:
cs.remove((BLDG.vav2, BRICK.feeds, BLDG.zone1))
cs.add((BLDG.vav2, BRICK.feeds, BLDG.zone2))
print("LATEST!")
fortindb.latest("my-building"):
print(t)
forlogical_tsinrange(1, 5):
print("LOGICAL TS:", logical_ts)
fortindb.graph_at("my-building", logical_ts):
print(t)
db.close()
Owner
Gabe Fierro
Asst Prof @ Colorado School of Mines // NREL // CS PhD @ UC Berkeley //
Databases, Systems, Semantic Interop, Cyber-Physical Systems
This is an AI that is supposed to say you if your text is formal or not. It's written in Python 3 and has some german examples (because I'm german yk) in the text.json file. This file contains the te
Markup is an online annotation tool that can be used to transform unstructured documents into structured formats for NLP and ML tasks, such as named-entity recognition. Markup learns as you annotate