From: Heikki Levanto Date: Wed, 18 Feb 2015 13:04:51 +0000 (+0100) Subject: MPSPARQL-7: Use sql:GROUP_DIGEST instead of GROUP_BY X-Git-Tag: v0.4~5 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=8ae9650f354ef45a98deba37f572f48b59d81e8b;p=mp-sparql-moved-to-github.git MPSPARQL-7: Use sql:GROUP_DIGEST instead of GROUP_BY An easier way to return one row for each $work, with multiple subjects (etc) concatenated into one field. --- diff --git a/bibframe/triplestore.xml b/bibframe/triplestore.xml index f5fd644..aae5725 100644 --- a/bibframe/triplestore.xml +++ b/bibframe/triplestore.xml @@ -1,14 +1,14 @@ - + rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns bf: http://bibframe.org/vocab/
SELECT ?work - MAX(?wtitle) AS ?title - MAX(?creatorlabel) AS ?creator - MAX(?subjectlabel) AS ?subject + (sql:GROUP_DIGEST (?wtitle, ' ; ', 1000, 1)) AS ?title + (sql:GROUP_DIGEST (?creatorlabel, ' ; ', 1000, 1))AS ?creator + (sql:GROUP_DIGEST (?subjectlabel, ' ; ', 1000, 1))AS ?subject
?work a bf:Work @@ -29,10 +29,9 @@ ?subject bf:label %v FILTER(contains(%v, %s)) { ?work ?op1 ?child . - ?child ?op2 ?val FILTER(contains(STR(?val), %s)) + ?child ?op2 %v FILTER(contains(STR(%v), %s)) } - GROUP BY $work
rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns