From 8ae9650f354ef45a98deba37f572f48b59d81e8b Mon Sep 17 00:00:00 2001 From: Heikki Levanto Date: Wed, 18 Feb 2015 14:04:51 +0100 Subject: [PATCH] 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. --- bibframe/triplestore.xml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 -- 1.7.10.4