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
Wikipedia Extractive Text Summarizer + Keywords Identification (entropy-based)Wikipedia Extractive Text Summarizer + Keywords Identification (entropy-based)
This script is used to generate a username list using the most common first and last names in Quebec in different formats. It can generate some passwords using specific patterns such as Tremblay2020.
Automates much of the process of moving translations from the old Multilingual external module to the newer built-in Multi-Language Management (MLM) page.