PNNL Example Building 1 Model 2¶
Example Building 1 is a simplistic, reference tiny office building consisting of a single story with 5 rooms spanning 5 space types.
This reference building was developed for and first described in the journal article “Metadata Schemas and Ontologies for Building Energy Applications: A Critical Review and Use Case Analysis”.
Example Building 1 Model 2 is provided by Pacific Northwest National Laboratory. See NIST Example Building 1 Model 1 for a different modeling approach for the same building.
Schematic view¶

Contents¶
This model contains a representation of the building architecture and electrical/lighting system.
In addition to the s223 ontology, the model uses the Real Estate Core ontology to describe space types. The Real Estate Core ontology is extended by defining 2 subclasses for rec:Office.
recx:OpenOffice rdfs:subClassOf rec:Office;
rdfs:label "Open Office".
recx:PrivateOffice rdfs:subClassOf rec:Office;
rdfs:label "Private Office".Source¶
The model was created from source data consisting of a building information model (BIM) created using Autodesk Revit, and exported via a Speckle interface.
Speckle view of rooms and lighting fixtures¶

Model instance data have a prefix that is resolvable to a Speckle URL.
@prefix bdg1: <http://speckle.xyz/streams/59e5e3c6a8/objects/>For example, the following luminaire resolves to http://
bdg1:e2164e3d14db5fcb6915a4a2c8474579 a s223:LuminaireDownloads¶
What are these files?
Turtle file (original): This is the original source Turtle file that was provided to
models.open223.info, usually as the output of some model creation tool.Turtle file (compiled): This is the original Turtle file with all inferred relationships and values added through SHACL inference against the 223P ontology and other dependencies. You should use this file for any further processing. It does not contain any of the ontologies.
Turtle file (with all imports): This is the compiled Turtle file with all imports included in the file (223P ontology, QUDT ontology, and others). This is helpful when you do not want to deal with downloading and managing ontology dependencies. It is also much larger than the compiled file.
JSON-LD file (original): This is the original Turtle file converted to the JSON-LD format.
Turtle is a syntax for RDF (Resource Description Framework) that is easy to read and write. It is a popular format for representing linked data. Parsers and serializers are available in many programming languages. JSON-LD is a JSON-based format for linked data that is easy to use with JavaScript and other web technologies.
Queries¶
| Description | Query URL |
|---|---|
| Select all triples from model. | Query Link |
Model Components¶
Load and Validate Model¶
This code uses the BuildingMOTIF library to load the 223P ontology and the model file into a temporary in-memory instance. It then validates the model against the ontology. If the model is invalid, it will print the validation report.
To run this code, you need to have Java installed on your system. If you do not have Java installed, you can remove the shacl_engine='topquadrant' parameter from the BuildingMOTIF constructor.
Be warned that without the shacl_engine='topquadrant' parameter, the validation process will be slower.
BuildingMOTIF installation
To install the buildingmotif library, you can use the following command:
pip install 'buildingmotif[topquadrant] @ git+https://github.com/NREL/buildingmotif.git@develop'If you do not have Java installed, you can use the following command to install the library:
pip install 'buildingmotif @ git+https://github.com/NREL/buildingmotif.git@develop'from buildingmotif import BuildingMOTIF
from buildingmotif.dataclasses import Library, Model
import ontoenv
import logging
# Create a BuildingMOTIF object. If you do not have Java installed, remove the "shacl_engine" parameter
bm = BuildingMOTIF('sqlite://', shacl_engine='topquadrant', log_level=logging.ERROR)
# load 223P library. We will load a recent copy from the models.open223.info
# git repository; later, we will load this from the location of the actual standard
s223 = Library.load(ontology_graph="https://open223.info/223p.ttl", infer_templates=False, run_shacl_inference=False)
unit = Library.load(ontology_graph="http://qudt.org/3.1.1/vocab/unit", infer_templates=False, run_shacl_inference=False)
quantitykind = Library.load(ontology_graph="http://qudt.org/3.1.1/vocab/quantitykind", infer_templates=False, run_shacl_inference=False)
# load the model into the BuildingMOTIF instance
model = Model.create("urn:pnnl-bdg1-2")
model.graph.parse("https://models.open223.info/pnnl-bdg1-2.ttl")
# validate the model against 223P ontology
ctx = model.validate([s223.get_shape_collection(),
unit.get_shape_collection(),
quantitykind.get_shape_collection()],
error_on_missing_imports=False)
# print the validation result
print(f"Model is valid: {ctx.valid}")
# if the model is invalid, print the validation report
if not ctx.valid:
print(ctx.report_string[:1000]) # first 1000 characters of the report
# BuildingMOTIF can also interpret the report to provide recommendations on fixes
for focus_node, diffs in ctx.get_reasons_with_severity("Violation").items():
if len(diffs) == 0:
continue
print(focus_node)
for diff in diffs:
print(" - " + diff.reason())Error: LinkageError occurred while loading main class org.topbraid.shacl.tools.Infer
java.lang.UnsupportedClassVersionError: org/topbraid/shacl/tools/Infer has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call last)
Cell In[1], line 20
16 model = Model.create("urn:pnnl-bdg1-2")
17 model.graph.parse("https://models.open223.info/pnnl-bdg1-2.ttl")
18
19 # validate the model against 223P ontology
---> 20 ctx = model.validate([s223.get_shape_collection(),
21 unit.get_shape_collection(),
22 quantitykind.get_shape_collection()],
23 error_on_missing_imports=False)
File ~/work/models.open223.info/models.open223.info/.venv/lib/python3.12/site-packages/buildingmotif/dataclasses/model.py:217, in Model.validate(self, shape_collections, error_on_missing_imports, shacl_engine)
188 def validate(
189 self,
190 shape_collections: Optional[List[ShapeCollection]] = None,
191 error_on_missing_imports: bool = True,
192 shacl_engine: Optional[str] = None,
193 ) -> "ValidationContext":
194 """Validates this model against the given list of ShapeCollections.
195 If no list is provided, the model will be validated against the model's "manifest".
196 If a list of shape collections is provided, the manifest will *not* be automatically
(...) 215 :rtype: ValidationContext
216 """
--> 217 compiled_model = self.compile(
218 shape_collections or [self.get_manifest()], shacl_engine=shacl_engine
219 )
220 return compiled_model.validate(error_on_missing_imports)
File ~/work/models.open223.info/models.open223.info/.venv/lib/python3.12/site-packages/buildingmotif/dataclasses/model.py:257, in Model.compile(self, shape_collections, min_iterations, max_iterations, shacl_engine)
253 ontology_graph = skolemize_shapes(ontology_graph)
255 model_graph = copy_graph(self.graph).skolemize()
--> 257 compiled_graph = shacl_inference(
258 model_graph,
259 ontology_graph,
260 engine=shacl_engine or self._bm.shacl_engine,
261 min_iterations=min_iterations,
262 max_iterations=max_iterations,
263 )
264 return CompiledModel(self, shape_collections, compiled_graph)
File ~/work/models.open223.info/models.open223.info/.venv/lib/python3.12/site-packages/buildingmotif/utils.py:702, in shacl_inference(data_graph, shape_graph, engine, min_iterations, max_iterations)
699 try:
700 from brick_tq_shacl import infer as tq_infer
--> 702 return tq_infer(data_graph, shape_graph or Graph(), min_iterations=min_iterations, max_iterations=max_iterations) # type: ignore
703 except ImportError:
704 logging.info(
705 "TopQuadrant SHACL engine not available. Using PySHACL instead."
706 )
File ~/work/models.open223.info/models.open223.info/.venv/lib/python3.12/site-packages/brick_tq_shacl/__init__.py:80, in infer(data_graph, ontologies, min_iterations, max_iterations)
77 (data_graph + ontologies).serialize(target_file_path, format="turtle")
79 # Run TopQuadrant SHACL inference
---> 80 inferred_graph_result = tqinfer(target_file_path)
81 inferred_graph_result.stdout = clean_stdout(inferred_graph_result.stdout)
82 # read the inferred graph from the stdout of the completed process
File ~/work/models.open223.info/models.open223.info/.venv/lib/python3.12/site-packages/pytqshacl/run.py:94, in infer(data, shapes)
93 def infer(data: Path, *, shapes:Path|None=None):
---> 94 _ = common('infer', data, shapes)
95 return _
File ~/work/models.open223.info/models.open223.info/.venv/lib/python3.12/site-packages/pytqshacl/run.py:87, in common(cmdnm, data, shapes)
83 from subprocess import run
84 _ = run(
85 c, check=False, env=env(), shell=True,
86 capture_output=True, text=True )
---> 87 _ = check_proc_manually(c, _)
88 return _
File ~/work/models.open223.info/models.open223.info/.venv/lib/python3.12/site-packages/pytqshacl/run.py:57, in check_proc_manually(cmd, proc)
55 from sys import stderr
56 print(proc.stderr, file=stderr)
---> 57 raise CalledProcessError(proc.returncode, cmd, stderr=proc.stderr)
59 # filter out warnings to *hop* valid ttl of stdout
60 _ = []
CalledProcessError: Command '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.19-10/x64/bin/java -Dlog4j.configurationFile="/home/runner/work/models.open223.info/models.open223.info/.venv/lib/python3.12/site-packages/pytqshacl/topquadrant/bin/shacl-1.5.0/shacl-1.5.0/log4j2.properties" -cp "/home/runner/work/models.open223.info/models.open223.info/.venv/lib/python3.12/site-packages/pytqshacl/topquadrant/bin/shacl-1.5.0/shacl-1.5.0/lib/*" org.topbraid.shacl.tools.Infer -datafile /tmp/tmp22jlxmeq/data.ttl ' returned non-zero exit status 1.- Pritoni, M., Paine, D., Fierro, G., Mosiman, C., Poplawski, M., Saha, A., Bender, J., & Granderson, J. (2021). Metadata Schemas and Ontologies for Building Energy Applications: A Critical Review and Use Case Analysis. Energies, 14(7), 2024. 10.3390/en14072024