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

Improve tgn suggestions, use only simple suggestions

parent 65b7e54c
No related branches found
No related tags found
No related merge requests found
...@@ -4,24 +4,24 @@ module.exports = { ...@@ -4,24 +4,24 @@ module.exports = {
'shortTitle': 'KMN', 'shortTitle': 'KMN',
'timePeriod': '1922-1944', 'timePeriod': '1922-1944',
'endpoint': 'http://ldf.fi/warsa/sparql', 'endpoint': 'http://ldf.fi/warsa/sparql',
'suggestionQuery': ` // 'suggestionQuery': `
PREFIX text: <http://jena.apache.org/text#> // PREFIX text: <http://jena.apache.org/text#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> // PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> // PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> // PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX gs: <http://www.opengis.net/ont/geosparql#> // PREFIX gs: <http://www.opengis.net/ont/geosparql#>
SELECT DISTINCT ?label (COUNT(?s) AS ?count) // SELECT DISTINCT ?label (COUNT(?s) AS ?count)
WHERE { // WHERE {
GRAPH <http://ldf.fi/warsa/places/karelian_places> { // GRAPH <http://ldf.fi/warsa/places/karelian_places> {
(?s ?score) text:query (skos:prefLabel '<QUERYTERM>*') . // (?s ?score) text:query (skos:prefLabel '<QUERYTERM>*') .
} // }
?s skos:prefLabel ?lbl . // ?s skos:prefLabel ?lbl .
BIND(STR(?lbl) AS ?label) // BIND(STR(?lbl) AS ?label)
} // }
GROUP BY ?label // GROUP BY ?label
ORDER BY DESC(MAX(?score)) ?label // ORDER BY DESC(MAX(?score)) ?label
LIMIT 50 // LIMIT 50
`, // `,
'simpleSuggestionQuery': ` 'simpleSuggestionQuery': `
PREFIX text: <http://jena.apache.org/text#> PREFIX text: <http://jena.apache.org/text#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
...@@ -73,23 +73,23 @@ module.exports = { ...@@ -73,23 +73,23 @@ module.exports = {
'timePeriod': '1939-1944', 'timePeriod': '1939-1944',
'lang': '', 'lang': '',
'endpoint': 'http://ldf.fi/warsa/sparql', 'endpoint': 'http://ldf.fi/warsa/sparql',
'suggestionQuery': ` // 'suggestionQuery': `
PREFIX text: <http://jena.apache.org/text#> // PREFIX text: <http://jena.apache.org/text#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> // PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> // PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> // PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX gs: <http://www.opengis.net/ont/geosparql#> // PREFIX gs: <http://www.opengis.net/ont/geosparql#>
SELECT DISTINCT ?label (COUNT(?s) AS ?count) // SELECT DISTINCT ?label (COUNT(?s) AS ?count)
WHERE { // WHERE {
GRAPH <http://ldf.fi/warsa/places/municipalities> { // GRAPH <http://ldf.fi/warsa/places/municipalities> {
(?s ?score) text:query (skos:prefLabel '<QUERYTERM>*') . // (?s ?score) text:query (skos:prefLabel '<QUERYTERM>*') .
} // }
?s skos:prefLabel ?lbl . // ?s skos:prefLabel ?lbl .
BIND(STR(?lbl) AS ?label) // BIND(STR(?lbl) AS ?label)
} // }
GROUP BY ?label // GROUP BY ?label
ORDER BY DESC(MAX(?score)) ?label // ORDER BY DESC(MAX(?score)) ?label
`, // `,
'simpleSuggestionQuery': ` 'simpleSuggestionQuery': `
PREFIX text: <http://jena.apache.org/text#> PREFIX text: <http://jena.apache.org/text#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
...@@ -184,48 +184,61 @@ module.exports = { ...@@ -184,48 +184,61 @@ module.exports = {
'tgn': { 'tgn': {
// Getty LOD documentation: // Getty LOD documentation:
// http://vocab.getty.edu/queries#Places_by_Type // http://vocab.getty.edu/queries#Places_by_Type
// http://vocab.getty.edu/doc/#TGN_Place_Types
// http://vocab.getty.edu/doc/queries/#Full_Text_Search_Query
// https://groups.google.com/forum/#!topic/gettyvocablod/r4wsSJyne84 // https://groups.google.com/forum/#!topic/gettyvocablod/r4wsSJyne84
// https://confluence.ontotext.com/display/OWLIMv54/OWLIM-SE+Full-text+Search // https://confluence.ontotext.com/display/OWLIMv54/OWLIM-SE+Full-text+Search
// http://vocab.getty.edu/queries#Combination_Full-Text_and_Exact_String_Match
// http://vocab.getty.edu/doc/#TGN_Place_Types
'title': 'The Getty Thesaurus of Geographic Names', 'title': 'The Getty Thesaurus of Geographic Names',
'shortTitle': 'TGN', 'shortTitle': 'TGN',
'timePeriod': 'contemporary', 'timePeriod': 'contemporary',
'endpoint': 'http://vocab.getty.edu/sparql.json', 'endpoint': 'http://vocab.getty.edu/sparql.json',
'simpleSuggestionQuery': 'SELECT+DISTINCT+?label{?s+a+skos:Concept;+luc:term+"<QUERYTERM>*";+skos:inScheme+tgn:;gvp:prefLabelGVP/xl:literalForm+?lbl+.+BIND(STR(?lbl)+AS+?label)}LIMIT+20', 'simpleSuggestionQuery':
'SELECT+DISTINCT+?label+' +
'WHERE+{' +
'?s+a+skos:Concept;+' +
'luc:term+"<QUERYTERM>*";+' +
'skos:inScheme+tgn:;' +
'gvp:prefLabelGVP/xl:literalForm+?lbl+.' +
'+BIND(STR(?lbl)+AS+?label)' +
'FILTER+(STRSTARTS(LCASE(?lbl),+"<QUERYTERM>"))' +
'}' +
'LIMIT+20',
'resultQuery': 'resultQuery':
'SELECT+?s+(COALESCE(?labelEn,?labelGVP)+AS+?label)+?typeLabel+?broaderAreaLabel+?source+?lat+?long' + 'SELECT+?s+(COALESCE(?labelEn,?labelGVP)+AS+?label)+?typeLabel+?broaderAreaLabel+?source+?lat+?long+' +
'{?s+luc:term+"<QUERYTERM>";+' + 'WHERE+{' +
'?s+luc:term+"<QUERYTERM>";+' +
'skos:inScheme+tgn:;+' + 'skos:inScheme+tgn:;+' +
'gvp:placeTypePreferred+[gvp:prefLabelGVP+[xl:literalForm+?typeLabel;dct:language+gvp_lang:en]];+' + 'gvp:placeTypePreferred+[gvp:prefLabelGVP+[xl:literalForm+?typeLabel;dct:language+gvp_lang:en]];+' +
'gvp:parentStringAbbrev+?broaderAreaLabel+.+' + 'gvp:parentStringAbbrev+?broaderAreaLabel+.+' +
'OPTIONAL+{?s+xl:prefLabel+[xl:literalForm+?labelEn;+dct:language+gvp_lang:en]}+' + 'OPTIONAL+{?s+xl:prefLabel+[xl:literalForm+?labelEn;+dct:language+gvp_lang:en]}+' +
'OPTIONAL{?s+gvp:prefLabelGVP+[xl:literalForm?labelGVP]}+' + 'OPTIONAL{?s+gvp:prefLabelGVP+[xl:literalForm?labelGVP]}+' +
'OPTIONAL{?s+foaf:focus+?place+.+?place+wgs:lat+?lat;+wgs:long+?long}+' + 'OPTIONAL{?s+foaf:focus+?place+.+?place+wgs:lat+?lat;+wgs:long+?long}+' +
'BIND("TGN"+AS+?source)+}', 'FILTER+EXISTS+{?s+xl:prefLabel/gvp:term+?term+.+FILTER+(LCASE(STR(?term))="<QUERYTERM>")}' +
'BIND("TGN"+AS+?source)+' +
'}',
}, },
'kotus': { 'kotus': {
'title': 'Institute for the Languages of Finland (Kotus) Digital Names archive', 'title': 'Institute for the Languages of Finland (Kotus) Digital Names archive',
'shortTitle': 'DNA', 'shortTitle': 'DNA',
'endpoint': 'http://ldf.fi/kotus-digital-names-archive/sparql', 'endpoint': 'http://ldf.fi/kotus-digital-names-archive/sparql',
//'endpoint': 'http://localhost:3037/ds/sparql', //'endpoint': 'http://localhost:3037/ds/sparql',
'suggestionQuery': ` // 'suggestionQuery': `
PREFIX text: <http://jena.apache.org/text#> // PREFIX text: <http://jena.apache.org/text#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> // PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> // PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> // PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX gs: <http://www.opengis.net/ont/geosparql#> // PREFIX gs: <http://www.opengis.net/ont/geosparql#>
PREFIX hipla: <http://ldf.fi/schema/hipla/> // PREFIX hipla: <http://ldf.fi/schema/hipla/>
SELECT DISTINCT ?label (COUNT(?s) AS ?count) // SELECT DISTINCT ?label (COUNT(?s) AS ?count)
WHERE { // WHERE {
(?s ?score) text:query (skos:prefLabel '<QUERYTERM>*') . // (?s ?score) text:query (skos:prefLabel '<QUERYTERM>*') .
?s hipla:type [] . // ?s hipla:type [] .
?s skos:prefLabel ?lbl . // ?s skos:prefLabel ?lbl .
BIND(STR(?lbl) AS ?label) // BIND(STR(?lbl) AS ?label)
} // }
ORDER BY DESC(MAX(?score)) ?label // ORDER BY DESC(MAX(?score)) ?label
LIMIT 50 // LIMIT 20
`, // `,
'simpleSuggestionQuery': ` 'simpleSuggestionQuery': `
PREFIX text: <http://jena.apache.org/text#> PREFIX text: <http://jena.apache.org/text#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
......
...@@ -20,7 +20,6 @@ class SparqlApi { ...@@ -20,7 +20,6 @@ class SparqlApi {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.endpoint === 'http://vocab.getty.edu/sparql.json') { if (this.endpoint === 'http://vocab.getty.edu/sparql.json') {
//const q = 'select*{?s+a+gvp:Facet;skos:inScheme+aat:;gvp:prefLabelGVP/xl:literalForm?label}';
const url = this.endpoint + '?query=' + query; const url = this.endpoint + '?query=' + query;
fetch(url) fetch(url)
.then(response => { .then(response => {
......
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