Skip to content

Commit fc6ca85

Browse files
committed
fix: unbound variables in movement cross instance
In commit 1ca2f9f "Add support for fallback label properties" some alternative label fallback queries were added with OPTIONAL blocks. However, for the move change type with subqueries for the `?newInstance` and `?oldInstance` the label instance variables were called `?instance`, effectively rendering it unbound and leading to a giant cartesian product and cardinality explosion, and therefore a non-finishing query in some (or most) cases.
1 parent 1ed3c13 commit fc6ca85

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

dqgen/resources/query_templates/movement_cross_instance.rq

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ WHERE {
6969
{% if preview_object_property == "" and preview_property == "" %}
7070
# fall back to known labels if no preview property
7171
optional {
72-
?instance rdfs:label ?rdfsLabel{{lang|title}} .
72+
?newInstance rdfs:label ?rdfsLabel{{lang|title}} .
7373
FILTER(LANG(?rdfsLabel{{lang|title}}) = "" || LANGMATCHES(LANG(?rdfsLabel{{lang|title}}), "{{ lang }}"))
7474
}
7575

7676
optional {
77-
?instance skos:prefLabel ?skosLabel{{lang|title}} .
77+
?newInstance skos:prefLabel ?skosLabel{{lang|title}} .
7878
FILTER(LANG(?skosLabel{{lang|title}}) = "" || LANGMATCHES(LANG(?skosLabel{{lang|title}}), "{{ lang }}"))
7979
}
8080

8181
optional {
82-
?instance shacl:name ?shaclName{{lang|title}} .
82+
?newInstance shacl:name ?shaclName{{lang|title}} .
8383
FILTER(LANG(?shaclName{{lang|title}}) = "" || LANGMATCHES(LANG(?shaclName{{lang|title}}), "{{ lang }}"))
8484
}
8585

@@ -101,11 +101,11 @@ WHERE {
101101
{% if preview_object_property == "" and preview_property == "" %}
102102
# fall back to alternative labels if no preview property
103103
{
104-
SELECT ?instance (SAMPLE (?prefLabel) as ?prefLabelRandom)
104+
SELECT ?newInstance (SAMPLE (?prefLabel) as ?prefLabelRandom)
105105
{
106-
?instance shacl:name|skos:prefLabel|rdfs:label ?prefLabel .
106+
?newInstance shacl:name|skos:prefLabel|rdfs:label ?prefLabel .
107107
}
108-
GROUP BY ?instance order by ?prefLabel
108+
GROUP BY ?newInstance order by ?prefLabel
109109
}
110110
{% elif preview_object_property == "" %}
111111
{
@@ -142,17 +142,17 @@ WHERE {
142142
{% if preview_object_property == "" and preview_property == "" %}
143143
# fall back to known labels if no preview property
144144
optional {
145-
?instance rdfs:label ?rdfsLabel{{lang|title}} .
145+
?oldInstance rdfs:label ?rdfsLabel{{lang|title}} .
146146
FILTER(LANG(?rdfsLabel{{lang|title}}) = "" || LANGMATCHES(LANG(?rdfsLabel{{lang|title}}), "{{ lang }}"))
147147
}
148148

149149
optional {
150-
?instance skos:prefLabel ?skosLabel{{lang|title}} .
150+
?oldInstance skos:prefLabel ?skosLabel{{lang|title}} .
151151
FILTER(LANG(?skosLabel{{lang|title}}) = "" || LANGMATCHES(LANG(?skosLabel{{lang|title}}), "{{ lang }}"))
152152
}
153153

154154
optional {
155-
?instance shacl:name ?shaclName{{lang|title}} .
155+
?oldInstance shacl:name ?shaclName{{lang|title}} .
156156
FILTER(LANG(?shaclName{{lang|title}}) = "" || LANGMATCHES(LANG(?shaclName{{lang|title}}), "{{ lang }}"))
157157
}
158158

dqgen/resources/query_templates/reified_movement_cross_instance.rq

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@ WHERE {
8080
{% if preview_object_property == "" and preview_property == "" %}
8181
# fall back to known labels if no preview property
8282
optional {
83-
?instance rdfs:label ?rdfsLabel{{lang|title}} .
83+
?newInstance rdfs:label ?rdfsLabel{{lang|title}} .
8484
FILTER(LANG(?rdfsLabel{{lang|title}}) = "" || LANGMATCHES(LANG(?rdfsLabel{{lang|title}}), "{{ lang }}"))
8585
}
8686

8787
optional {
88-
?instance skos:prefLabel ?skosLabel{{lang|title}} .
88+
?newInstance skos:prefLabel ?skosLabel{{lang|title}} .
8989
FILTER(LANG(?skosLabel{{lang|title}}) = "" || LANGMATCHES(LANG(?skosLabel{{lang|title}}), "{{ lang }}"))
9090
}
9191

9292
optional {
93-
?instance shacl:name ?shaclName{{lang|title}} .
93+
?newInstance shacl:name ?shaclName{{lang|title}} .
9494
FILTER(LANG(?shaclName{{lang|title}}) = "" || LANGMATCHES(LANG(?shaclName{{lang|title}}), "{{ lang }}"))
9595
}
9696

@@ -112,11 +112,11 @@ WHERE {
112112
{% if preview_object_property == "" and preview_property == "" %}
113113
# fall back to alternative labels if no preview property
114114
{
115-
SELECT ?instance (SAMPLE (?prefLabel) as ?prefLabelRandom)
115+
SELECT ?newInstance (SAMPLE (?prefLabel) as ?prefLabelRandom)
116116
{
117-
?instance shacl:name|skos:prefLabel|rdfs:label ?prefLabel .
117+
?newInstance shacl:name|skos:prefLabel|rdfs:label ?prefLabel .
118118
}
119-
GROUP BY ?instance order by ?prefLabel
119+
GROUP BY ?newInstance order by ?prefLabel
120120
}
121121
{% elif preview_object_property == "" %}
122122
{
@@ -154,17 +154,17 @@ WHERE {
154154
{% if preview_object_property == "" and preview_property == "" %}
155155
# fall back to known labels if no preview property
156156
optional {
157-
?instance rdfs:label ?rdfsLabel{{lang|title}} .
157+
?oldInstance rdfs:label ?rdfsLabel{{lang|title}} .
158158
FILTER(LANG(?rdfsLabel{{lang|title}}) = "" || LANGMATCHES(LANG(?rdfsLabel{{lang|title}}), "{{ lang }}"))
159159
}
160160

161161
optional {
162-
?instance skos:prefLabel ?skosLabel{{lang|title}} .
162+
?oldInstance skos:prefLabel ?skosLabel{{lang|title}} .
163163
FILTER(LANG(?skosLabel{{lang|title}}) = "" || LANGMATCHES(LANG(?skosLabel{{lang|title}}), "{{ lang }}"))
164164
}
165165

166166
optional {
167-
?instance shacl:name ?shaclName{{lang|title}} .
167+
?oldInstance shacl:name ?shaclName{{lang|title}} .
168168
FILTER(LANG(?shaclName{{lang|title}}) = "" || LANGMATCHES(LANG(?shaclName{{lang|title}}), "{{ lang }}"))
169169
}
170170

0 commit comments

Comments
 (0)