From b68f0643467e25d3021e3b87b4a9db1ec3fa9dec Mon Sep 17 00:00:00 2001 From: Trashman247 Date: Tue, 18 Jul 2023 16:36:29 -0700 Subject: [PATCH] Change brick attributes query "name" and "value" to "predicate" and "object" --- .../blenderbim/bim/module/brick/data.py | 35 +++++++++---------- .../blenderbim/bim/module/brick/ui.py | 8 ++--- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/brick/data.py b/src/blenderbim/blenderbim/bim/module/brick/data.py index 1af38b6880..af50237178 100644 --- a/src/blenderbim/blenderbim/bim/module/brick/data.py +++ b/src/blenderbim/blenderbim/bim/module/brick/data.py @@ -64,39 +64,38 @@ class BrickschemaData: PREFIX brick: PREFIX rdfs: PREFIX rdf: - SELECT DISTINCT ?name ?value ?sp ?sv WHERE { - <{uri}> ?name ?value . + SELECT DISTINCT ?predicate ?object ?sp ?sv WHERE { + <{uri}> ?predicate ?object . OPTIONAL { - { ?name rdfs:range brick:TimeseriesReference . } + { ?predicate rdfs:range brick:TimeseriesReference . } UNION - { ?name a brick:EntityProperty . } - ?value ?sp ?sv } + { ?predicate a brick:EntityProperty . } + ?object ?sp ?sv } } """.replace( "{uri}", uri ) ) - for row in query: - name = row.get("name").toPython().split("#")[-1] - value = row.get("value") + predicate = row.get("predicate").toPython().split("#")[-1] + object = row.get("object") results.append( { - "name": name, - "value": value.toPython().split("#")[-1], - "is_uri": isinstance(value, URIRef), - "value_uri": value.toPython(), - "is_globalid": name == "globalID", + "predicate": predicate, + "object": object.toPython().split("#")[-1], + "is_uri": isinstance(object, URIRef), + "object_uri": object.toPython(), + "is_globalid": predicate == "globalID", } ) - if isinstance(row.get("value"), BNode): - for s, p, o in BrickStore.graph.triples((value, None, None)): + if isinstance(row.get("object"), BNode): + for s, p, o in BrickStore.graph.triples((object, None, None)): results.append( { - "name": name + ":" + p.toPython().split("#")[-1], - "value": o.toPython().split("#")[-1], + "predicate": predicate + ":" + p.toPython().split("#")[-1], + "object": o.toPython().split("#")[-1], "is_uri": isinstance(o, URIRef), - "value_uri": o.toPython(), + "object_uri": o.toPython(), "is_globalid": p.toPython().split("#")[-1] == "globalID", } ) diff --git a/src/blenderbim/blenderbim/bim/module/brick/ui.py b/src/blenderbim/blenderbim/bim/module/brick/ui.py index 5dfd49e548..56d4f830d3 100644 --- a/src/blenderbim/blenderbim/bim/module/brick/ui.py +++ b/src/blenderbim/blenderbim/bim/module/brick/ui.py @@ -109,14 +109,14 @@ class BIM_PT_brickschema(Panel): for attribute in BrickschemaData.data["attributes"]: row = self.layout.row(align=True) - row.label(text=attribute["name"]) - row.label(text=attribute["value"]) + row.label(text=attribute["predicate"]) + row.label(text=attribute["object"]) if attribute["is_uri"]: op = row.operator("bim.view_brick_item", text="", icon="DISCLOSURE_TRI_RIGHT") - op.item = attribute["value_uri"] + op.item = attribute["object_uri"] if attribute["is_globalid"]: op = row.operator("bim.select_global_id", icon="RESTRICT_SELECT_OFF", text="") - op.global_id = attribute["value"] + op.global_id = attribute["object"] class BIM_PT_ifc_brickschema_references(Panel):