From beb8e4a624cc1e66113c934b1ec3bd2e67288df5 Mon Sep 17 00:00:00 2001
From: esikkala <esko.ikkala@aalto.fi>
Date: Wed, 22 May 2019 14:27:57 +0300
Subject: [PATCH] Events: ignore pref labels for now

---
 src/client/reducers/events.js            | 11 ++++++-----
 src/server/sparql/FacetConfigs.js        |  8 ++++----
 src/server/sparql/SparqlQueriesEvents.js | 12 +++++++-----
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/src/client/reducers/events.js b/src/client/reducers/events.js
index 88b8f541..af3ed1a6 100644
--- a/src/client/reducers/events.js
+++ b/src/client/reducers/events.js
@@ -32,19 +32,20 @@ export const INITIAL_STATE = {
   instance: {},
   page: -1,
   pagesize: 15,
-  sortBy: 'prefLabel',
+  sortBy: 'place',
   sortDirection: 'asc',
   fetching: false,
   fetchingResultCount: false,
   tableColumns: [
     {
-      id: 'prefLabel',
-      label: 'Label',
-      desc: 'Label description',
+      id: 'type',
+      label: 'Type',
+      desc: 'Type description',
       valueType: 'object',
       makeLink: true,
       sortValues: false,
-      numberedList: false
+      numberedList: false,
+      minWidth: 200,
     },
     {
       id: 'timespan',
diff --git a/src/server/sparql/FacetConfigs.js b/src/server/sparql/FacetConfigs.js
index c37de9a3..b90da1b5 100644
--- a/src/server/sparql/FacetConfigs.js
+++ b/src/server/sparql/FacetConfigs.js
@@ -107,6 +107,10 @@ export const facetConfigs = {
       type: 'text',
       textQueryProperty: 'skos:prefLabel'
     },
+    // for sorting
+    type: {
+      labelPath: 'a/(skos:prefLabel|rdfs:label)',
+    },
     place: {
       id: 'place',
       facetValueFilter: `
@@ -119,10 +123,6 @@ export const facetConfigs = {
       parentPredicate: 'crm:P7_took_place_at/gvp:broaderPreferred+',
       type: 'hierarchical',
     },
-    // for sorting facet results
-    prefLabel: {
-      labelPath: 'skos:prefLabel',
-    },
   },
   people: {
     rdfType: 'mmm-schema:Person',
diff --git a/src/server/sparql/SparqlQueriesEvents.js b/src/server/sparql/SparqlQueriesEvents.js
index 51566519..38eb558f 100644
--- a/src/server/sparql/SparqlQueriesEvents.js
+++ b/src/server/sparql/SparqlQueriesEvents.js
@@ -1,15 +1,17 @@
 export const eventProperties = `
     {
-      ?id skos:prefLabel ?prefLabel__id .
-      BIND(?prefLabel__id AS ?prefLabel__prefLabel)
-      BIND(?id AS ?prefLabel__dataProviderUrl)
+      ?id a ?type__id .
+      ?type__id skos:prefLabel|rdfs:label ?type__prefLabel .
+      BIND(?id AS ?type__dataProviderUrl)
     }
-    UNION {
+    UNION
+    {
       ?id crm:P7_took_place_at ?place__id .
       ?place__id skos:prefLabel ?place__prefLabel .
       ?place__id owl:sameAs ?place__dataProviderUrl .
     }
-    UNION {
+    UNION
+    {
       ?id crm:P4_has_time-span ?timespan__id .
       BIND(?timespan__id AS ?timespan__prefLabel)
     }
-- 
GitLab