Skip to content

Commit 678c522

Browse files
committed
Use add2 schema
1 parent 03c6f48 commit 678c522

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎sparql.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ def withschema(fn):
5959

6060
def _(*args, **kwargs):
6161
schema_name = STANDARD_PREFIXES["ifcowl"].split("/")[-1][:-2]
62-
if "_" in schema_name:
63-
schema_name = schema_name.split("_")[0]
64-
S = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema_name)
62+
try:
63+
S = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema_name)
64+
except RuntimeError:
65+
if "_" not in schema_name:
66+
raise
67+
S = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema_name.split("_")[0])
6568
return fn(S, *args, **kwargs)
6669

6770
return _

‎tests/test_specialized_references.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def test_references_chained_entities_and_direct_attribute_entities_are_equivalen
247247
comparing actual extracted bindings and SPARQL rows, not only match flags.
248248
"""
249249
monkeypatch.setitem(
250-
sparql.STANDARD_PREFIXES, "ifcowl", "<http://example.org/IFC4X3#>"
250+
sparql.STANDARD_PREFIXES, "ifcowl", "<http://example.org/IFC4X3_ADD2#>"
251251
)
252252
extraction = {}
253253
query_results = {}
@@ -363,7 +363,7 @@ def test_graphviz_reference_matches_xml_specialization(
363363

364364
def owl_graph(model):
365365
graph = Graph()
366-
owl = Namespace("http://example.org/IFC4X3#")
366+
owl = Namespace("http://example.org/IFC4X3_ADD2#")
367367
inst = Namespace("http://example.org/instances/")
368368
express = Namespace("https://w3id.org/express#")
369369
schema = ifcopenshell.schema_by_name("IFC4X3_ADD2")
@@ -399,7 +399,7 @@ def test_sparql_executes_specialized_type_filter(
399399
tmp_path, geometry_models, monkeypatch, revolved, leaf
400400
):
401401
monkeypatch.setitem(
402-
sparql.STANDARD_PREFIXES, "ifcowl", "<http://example.org/IFC4X3#>"
402+
sparql.STANDARD_PREFIXES, "ifcowl", "<http://example.org/IFC4X3_ADD2#>"
403403
)
404404
parsed = body_template(tmp_path, revolved=revolved, leaf=leaf)
405405
query = sparql.convertor.template(parsed)

0 commit comments

Comments
 (0)