@@ -252,26 +252,24 @@ def load_brick_file(cls, filepath):
252252 if not BrickStore .schema : # important check for running under test cases
253253 cwd = os .path .dirname (os .path .realpath (__file__ ))
254254 BrickStore .schema = os .path .join (cwd , ".." , "bim" , "schema" , "Brick.ttl" )
255- BrickStore .VersionedGraphCollection = brickschema .persistent .VersionedGraphCollection ("sqlite://" )
256- with BrickStore .VersionedGraphCollection .new_changeset ("SCHEMA" ) as cs :
255+ BrickStore .graph = brickschema .persistent .VersionedGraphCollection ("sqlite://" )
256+ with BrickStore .graph .new_changeset ("SCHEMA" ) as cs :
257257 cs .load_file (BrickStore .schema )
258- with BrickStore .VersionedGraphCollection .new_changeset ("PROJECT" ) as cs :
258+ with BrickStore .graph .new_changeset ("PROJECT" ) as cs :
259259 cs .load_file (filepath )
260- BrickStore .reload_brick_graph ()
261260 BrickStore .path = filepath
262261
263262 @classmethod
264263 def new_brick_file (cls ):
265264 if not BrickStore .schema : # important check for running under test cases
266265 cwd = os .path .dirname (os .path .realpath (__file__ ))
267266 BrickStore .schema = os .path .join (cwd , ".." , "bim" , "schema" , "Brick.ttl" )
268- BrickStore .VersionedGraphCollection = brickschema .persistent .VersionedGraphCollection ("sqlite://" )
269- with BrickStore .VersionedGraphCollection .new_changeset ("SCHEMA" ) as cs :
267+ BrickStore .graph = brickschema .persistent .VersionedGraphCollection ("sqlite://" )
268+ with BrickStore .graph .new_changeset ("SCHEMA" ) as cs :
270269 cs .load_file (BrickStore .schema )
271- BrickStore .VersionedGraphCollection .bind ("digitaltwin" , Namespace ("https://example.org/digitaltwin#" ))
272- BrickStore .VersionedGraphCollection .bind ("brick" , Namespace ("https://brickschema.org/schema/Brick#" ))
273- BrickStore .VersionedGraphCollection .bind ("rdfs" , Namespace ("http://www.w3.org/2000/01/rdf-schema#" ))
274- BrickStore .reload_brick_graph ()
270+ BrickStore .graph .bind ("digitaltwin" , Namespace ("https://example.org/digitaltwin#" ))
271+ BrickStore .graph .bind ("brick" , Namespace ("https://brickschema.org/schema/Brick#" ))
272+ BrickStore .graph .bind ("rdfs" , Namespace ("http://www.w3.org/2000/01/rdf-schema#" ))
275273
276274 @classmethod
277275 def pop_brick_breadcrumb (cls ):
@@ -312,36 +310,35 @@ def set_active_brick_class(cls, brick_class):
312310
313311 @classmethod
314312 def undo_brick (cls ):
315- BrickStore .VersionedGraphCollection .undo ()
316- BrickStore .reload_brick_graph ()
313+ BrickStore .graph .undo ()
317314
318315 @classmethod
319316 def redo_brick (cls ):
320- BrickStore .VersionedGraphCollection .redo ()
321- BrickStore .reload_brick_graph ()
317+ BrickStore .graph .redo ()
322318
323319 @classmethod
324320 def serialize_brick (cls , file_name ):
325- BrickStore .reload_brick_graph ()
321+ #temporary file path, could either be user selected for "save as" or use the BrickStore.path for simply "save"
326322 print ("Serializing: \" " + file_name + "\" ... " )
327- BrickStore .graph .serialize (file_name )
323+ cwd = os .path .dirname (os .path .realpath (__file__ ))
324+ dest = os .path .join (cwd , ".." , "bim" , "schema" , file_name )
325+ BrickStore .get_project ().serialize (destination = dest , format = "turtle" )
328326 print ("finished!" )
329327
330328class BrickStore :
331- schema = None # this is now a path
332- # I've decided to arbitrarily split th VersionedGraphCollection into two graph names: "schema" and "project"
333- # "schema" holds the Brick.ttl metadata; "project" holds all the authored entities
334- VersionedGraphCollection = None
335- graph = None # this is the graph named "project" from the VersionedGraphCollection
329+ schema = None # this is now a os path
330+ graph = None # this is the VersionedGraphCollection with 2 arbitrarily named graphs: "schema" and "project"
331+ # "schema" holds the Brick.ttl metadata; "project" holds all the authored entities
332+ project = None # this is the graph named "project" from the VersionedGraphCollection
336333 path = None
337334
338335 @staticmethod
339336 def purge ():
340337 BrickStore .schema = None
341- BrickStore .VersionedGraphCollection = None
342338 BrickStore .graph = None
339+ BrickStore .project = None
343340 BrickStore .path = None
344341
345342 @classmethod
346- def reload_brick_graph (cls ):
347- BrickStore .graph = BrickStore . VersionedGraphCollection . graph_at ("PROJECT" )
343+ def get_project (cls ):
344+ return BrickStore .graph . graph_at (graph = "PROJECT" )
0 commit comments