NREL / BuildingMOTIF

Building Metadata OnTology Interoperability Framework (BuildingMOTIF)
https://buildingmotif.readthedocs.io/
Other
48 stars 6 forks source link

Shape Load Error when loading a library directory twice #208

Closed wehuang16 closed 1 year ago

wehuang16 commented 1 year ago

Body: This issue may be related to previous issues #168 and #109 . Basically what I did was, I copied the “model validation” tutorial (https://nrel.github.io/BuildingMOTIF/tutorials/model_validation.html) to a Jupyter notebook. The Jupyter notebook is attached here and is named “model_validation_tutorial.ipynb”. I stored this Juypyter notebook in the BuildingMOTIF/docs/tutorials path. I ran the Jupyter notebook without problems for the first time. However, when I ran it the second time, it returned a Shape Load error shown at the below screenshot. I did some preliminary troubleshooting and found that when I ran the “libarary-load-directory” coding line “g36 = Library.load(directory="../../libraries/ashrae/guideline36")” twice, the shape load error was returned. However, when I ran any other “library-load-ontology_graph” coding line twice, such as the line “brick = Library.load(ontology_graph="../../libraries/brick/Brick-subset.ttl")”, it did NOT have the shape load error. Thus, I would like to bring this issue up, and seek solutions to make BuildingMOTIF easier to use in Jupyter notebook. Screen Shot 2023-01-23 at 4 37 59 PM

TShapinsky commented 1 year ago

Thanks for reporting this issue. It looks like we're not clearing the shapes graph when a library is over written.

If you don't actually want to overwrite the library you can pass overwrite=False when calling the load function. This will return the existing library in the database if one exists.

wehuang16 commented 1 year ago

Thank you for your information, Tobias! My small suggestion is that we include the "overwrite=False" to BuildingMOTIF's tutorial page (https://nrel.github.io/BuildingMOTIF/tutorials/model_validation.html), so that others who use BuildingMOTIF will not run into the same error and wonder what to do.

gtfierro commented 1 year ago

I believe this is fixed in https://github.com/NREL/BuildingMOTIF/pull/168