Skip to content

Commit

Permalink
Add example Namespace to code example
Browse files Browse the repository at this point in the history
I realize it would be more practiced to use an actual (albeit custom) namespace in the code example
  • Loading branch information
rileywong311 committed Jun 30, 2023
1 parent 85fa231 commit f284df0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/persistence.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,19 @@ Furthermore, the :class:`~brickschema.persistent.VersionedGraphCollection` also
from brickschema.persistent import VersionedGraphCollection
from brickschema.namespaces import BRICK, A
from rdflib import Namespace
vgc = VersionedGraphCollection(uri="sqlite://")
PROJECT = Namespace("https://example.org/my-project#")
# load Brick ontology
with vgc.new_changeset("Brick") as cs:
cs.load_file("https://sparql.gtf.fyi/ttl/Brick1.3rc1.ttl")
# load other changes
with vgc.new_changeset("My-Project") as cs:
cs.add((BRICK["my-sensor"], A, BRICK.Zone_Air_Temperature_Sensor))
cs.add((PROJECT["my-sensor"], A, BRICK.Zone_Air_Temperature_Sensor))
res = vgc.query("""SELECT * WHERE {
?sensor rdf:type/rdfs:subClassOf* brick:Temperature_Sensor
Expand Down

0 comments on commit f284df0

Please sign in to comment.