Skip to content
Snippets Groups Projects
Commit cd220d70 authored by Esko Ikkala's avatar Esko Ikkala
Browse files

Update facet query

parent 9772bab9
No related branches found
No related tags found
No related merge requests found
...@@ -49,42 +49,33 @@ const facetQuery = ` ...@@ -49,42 +49,33 @@ const facetQuery = `
PREFIX mmm-schema: <http://ldf.fi/mmm/schema/> PREFIX mmm-schema: <http://ldf.fi/mmm/schema/>
SELECT DISTINCT ?cnt ?facet_text ?value ?parent SELECT DISTINCT ?cnt ?facet_text ?value ?parent
WHERE { WHERE {
{ SELECT DISTINCT ?cnt ?value ?facet_text ?parent {
{ SELECT DISTINCT (count(DISTINCT ?id) as ?cnt) { { SELECT DISTINCT (count(DISTINCT ?id) as ?cnt) ?value ?parent
{
?id a frbroo:F4_Manifestation_Singleton . ?id a frbroo:F4_Manifestation_Singleton .
?id skos:prefLabel ?name . ?id skos:prefLabel ?name .
?id ^frbroo:R18_created/crm:P7_took_place_at ?value .
OPTIONAL { ?value mmm-schema:parent ?parent }
} }
} BIND("-- Ei valintaa --" AS ?facet_text) } GROUP BY ?value ?parent
UNION }
{ FILTER(BOUND(?value)) BIND(COALESCE(?value, <http://ldf.fi/NONEXISTENT_URI>) AS ?labelValue)
SELECT DISTINCT ?cnt ?value ?facet_text ?parent { OPTIONAL { ?labelValue skos:prefLabel ?lbl .
{ SELECT DISTINCT (count(DISTINCT ?id) as ?cnt) ?value ?parent FILTER(langMatches(lang(?lbl), "fi")) . }
{ OPTIONAL { ?labelValue rdfs:label ?lbl .
?id a frbroo:F4_Manifestation_Singleton . FILTER(langMatches(lang(?lbl), "fi")) . }
?id skos:prefLabel ?name . OPTIONAL { ?labelValue skos:prefLabel ?lbl .
?id ^frbroo:R18_created/crm:P7_took_place_at ?value . FILTER(langMatches(lang(?lbl), "en")) . }
OPTIONAL { ?value mmm-schema:parent ?parent } OPTIONAL { ?labelValue rdfs:label ?lbl .
} FILTER(langMatches(lang(?lbl), "en")) . }
GROUP BY ?value ?parent OPTIONAL { ?labelValue skos:prefLabel ?lbl .
} FILTER(langMatches(lang(?lbl), "sv")) . }
FILTER(BOUND(?value)) BIND(COALESCE(?value, <http://ldf.fi/NONEXISTENT_URI>) AS ?labelValue) OPTIONAL { ?labelValue rdfs:label ?lbl .
OPTIONAL { ?labelValue skos:prefLabel ?lbl . FILTER(langMatches(lang(?lbl), "sv")) . }
FILTER(langMatches(lang(?lbl), "fi")) . } OPTIONAL { ?labelValue skos:prefLabel ?lbl .
OPTIONAL { ?labelValue rdfs:label ?lbl . FILTER(langMatches(lang(?lbl), "")) . }
FILTER(langMatches(lang(?lbl), "fi")) . } OPTIONAL { ?labelValue rdfs:label ?lbl .
OPTIONAL { ?labelValue skos:prefLabel ?lbl . FILTER(langMatches(lang(?lbl), "")) . }
FILTER(langMatches(lang(?lbl), "en")) . } BIND(COALESCE(?lbl, IF(!ISURI(?value), ?value, "")) AS ?facet_text) }
OPTIONAL { ?labelValue rdfs:label ?lbl .
FILTER(langMatches(lang(?lbl), "en")) . }
OPTIONAL { ?labelValue skos:prefLabel ?lbl .
FILTER(langMatches(lang(?lbl), "sv")) . }
OPTIONAL { ?labelValue rdfs:label ?lbl .
FILTER(langMatches(lang(?lbl), "sv")) . }
OPTIONAL { ?labelValue skos:prefLabel ?lbl .
FILTER(langMatches(lang(?lbl), "")) . }
OPTIONAL { ?labelValue rdfs:label ?lbl .
FILTER(langMatches(lang(?lbl), "")) . }
BIND(COALESCE(?lbl, IF(!ISURI(?value), ?value, "")) AS ?facet_text) }
}
} }
`; `;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment