From 63e52daeef95624bf7398d024cb0344e0033e919 Mon Sep 17 00:00:00 2001
From: Esko Ikkala <esko.ikkala@aalto.fi>
Date: Tue, 2 Oct 2018 16:21:35 +0300
Subject: [PATCH] Test fetching manuscript owners

---
 src/server/sparql/Datasets.js | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/server/sparql/Datasets.js b/src/server/sparql/Datasets.js
index db339534..562df90e 100644
--- a/src/server/sparql/Datasets.js
+++ b/src/server/sparql/Datasets.js
@@ -1,11 +1,23 @@
-module.exports = {
+// # (GROUP_CONCAT(DISTINCT ?owner_; SEPARATOR=" | ") AS ?owner)
+// # OPTIONAL {
+// #   ?id crm:P51_has_former_or_current_owner ?ownerId .
+// #   ?ownerId skos:prefLabel ?ownerLabel .
+// #   ?ownerRei rdf:subject ?id ;
+// #             rdf:predicate crm:P51_has_former_or_current_owner ;
+// #             rdf:object ?ownerId ;
+// #             mmm-schema:order ?ownerOrder ;
+// #             mmm-schema:entry ?ownerEntry .
+// #   BIND(CONCAT(STR(?ownerLabel), ";", STR(?ownerId), ";", STR(?ownerOrder), ";", STR(?ownerEntry)) AS ?owner_)
+// # }
+
 
+module.exports = {
   'mmm': {
     'title': 'MMM',
     'shortTitle': 'MMM',
     'timePeriod': '',
-    'endpoint': 'http://ldf.fi/mmm-sdbm-cidoc/sparql',
-    //'endpoint': 'http://localhost:3034/ds/sparql',
+    //'endpoint': 'http://ldf.fi/mmm-sdbm-cidoc/sparql',
+    'endpoint': 'http://localhost:3034/ds/sparql',
     'allQuery': `
       PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
       PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
@@ -21,6 +33,7 @@ module.exports = {
       SELECT
       ?id ?manuscriptRecord
       (GROUP_CONCAT(DISTINCT ?prefLabel_; SEPARATOR=" | ") AS ?prefLabel)
+
       (GROUP_CONCAT(DISTINCT ?author_; SEPARATOR="|") AS ?author)
       (GROUP_CONCAT(DISTINCT ?timespan_; SEPARATOR="|") AS ?timespan)
       (GROUP_CONCAT(DISTINCT ?creationPlace_; SEPARATOR="|") AS ?creationPlace)
@@ -29,6 +42,7 @@ module.exports = {
       WHERE {
         ?id a frbroo:F4_Manifestation_Singleton .
         ?id skos:prefLabel ?prefLabel_ .
+
         OPTIONAL { ?id crm:P45_consists_of ?material_ . }
         ?expression_creation frbroo:R18_created ?id .
         OPTIONAL {
@@ -53,7 +67,7 @@ module.exports = {
       }
       GROUP BY ?id ?manuscriptRecord
       ORDER BY DESC(?creationPlace)
-      LIMIT 2000
+      LIMIT 100
       `,
     'placeQuery': `
       PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
-- 
GitLab