Commit 2cb1081e authored by Petter Goksøyr Åsen's avatar Petter Goksøyr Åsen
Browse files

services: update delete incoming relations query

Instead of matchin blank nodes, enumerate blank node classes.
This is much faster.
parent 2b8084b6
......@@ -834,7 +834,10 @@ public final class SPARQLQueryBuilder {
// query 1) blank node relating to node xuri
// query 2) remaining direct relations to node xuri (as subject to work for example)
String queryString = format(""
+ "WITH <%2$s> DELETE { ?bn ?p ?o . ?r ?rp ?bn } WHERE { ?bn ?any <%1$s> ; ?p ?o . ?r ?rp ?bn . FILTER(isBlank(?bn)) };"
+ "PREFIX : <http://data.deichman.no/ontology#> WITH <%2$s> "
+ "DELETE { ?bn ?p ?o . ?r ?rp ?bn } WHERE { "
+ "?bn ?any <%1$s> ; a ?bntype ; ?p ?o . ?r ?rp ?bn ."
+ " VALUES ?bntype { :ClassificationEntry :Contribution :MainEntry :WorkRelation :WorkSeriesPart :Instrumentation :SerialIssue :PublicationPart } };"
+ "WITH <%2$s> DELETE { ?s ?p <%1$s> } WHERE { ?s ?p <%1$s> };\n"
+ "\n", xuri.getUri(), DEFAULT_GRAPH);
return queryString;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment