mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
Brick UI relations list uses "label" if there is one
This commit is contained in:
@@ -67,13 +67,17 @@ class BrickschemaData:
|
|||||||
PREFIX brick: <https://brickschema.org/schema/Brick#>
|
PREFIX brick: <https://brickschema.org/schema/Brick#>
|
||||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
||||||
SELECT DISTINCT ?predicate ?object ?sp ?sv WHERE {
|
SELECT DISTINCT ?predicate ?object ?label ?sp ?sv WHERE {
|
||||||
<{uri}> ?predicate ?object .
|
<{uri}> ?predicate ?object .
|
||||||
OPTIONAL {
|
OPTIONAL {
|
||||||
{ ?predicate rdfs:range brick:TimeseriesReference . }
|
?object rdfs:label ?label .
|
||||||
UNION
|
}
|
||||||
{ ?predicate a brick:EntityProperty . }
|
OPTIONAL {
|
||||||
?object ?sp ?sv }
|
{ ?predicate rdfs:range brick:TimeseriesReference . }
|
||||||
|
UNION
|
||||||
|
{ ?predicate a brick:EntityProperty . }
|
||||||
|
?object ?sp ?sv .
|
||||||
|
}
|
||||||
}
|
}
|
||||||
GROUP BY ?object
|
GROUP BY ?object
|
||||||
""".replace(
|
""".replace(
|
||||||
@@ -84,13 +88,15 @@ class BrickschemaData:
|
|||||||
predicate_uri = row.get("predicate")
|
predicate_uri = row.get("predicate")
|
||||||
predicate_name = predicate_uri.toPython().split("#")[-1]
|
predicate_name = predicate_uri.toPython().split("#")[-1]
|
||||||
object_uri = row.get("object")
|
object_uri = row.get("object")
|
||||||
if isinstance(object_uri, BNode):
|
object_name = row.get("label")
|
||||||
object_name = "[]"
|
if not object_name:
|
||||||
else:
|
if isinstance(object_uri, BNode):
|
||||||
try:
|
object_name = "[]"
|
||||||
object_name = object_uri.toPython().split("#")[-1]
|
else:
|
||||||
except:
|
try:
|
||||||
object_name = str(object_uri)
|
object_name = object_uri.toPython().split("#")[-1]
|
||||||
|
except:
|
||||||
|
object_name = str(object_uri)
|
||||||
results.append(
|
results.append(
|
||||||
{
|
{
|
||||||
"predicate_uri": predicate_uri,
|
"predicate_uri": predicate_uri,
|
||||||
|
|||||||
Reference in New Issue
Block a user