Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nos Hs2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Språksamlingane
stadnamn
Nos Hs2023
Commits
b9dbcf41
Commit
b9dbcf41
authored
6 years ago
by
esikkala
Browse files
Options
Downloads
Patches
Plain Diff
Simplify facet query, remove tgn fixes from sparql api
parent
052aa554
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/server/sparql/Datasets.js
+31
-46
31 additions, 46 deletions
src/server/sparql/Datasets.js
src/server/sparql/SparqlApi.js
+2
-6
2 additions, 6 deletions
src/server/sparql/SparqlApi.js
with
33 additions
and
52 deletions
src/server/sparql/Datasets.js
+
31
−
46
View file @
b9dbcf41
...
@@ -176,7 +176,6 @@ module.exports = {
...
@@ -176,7 +176,6 @@ module.exports = {
WHERE {
WHERE {
# https://github.com/uber/deck.gl/blob/master/docs/layers/arc-layer.md
# https://github.com/uber/deck.gl/blob/master/docs/layers/arc-layer.md
?manuscript__id ^frbroo:R18_created/crm:P7_took_place_at ?from__id .
?manuscript__id ^frbroo:R18_created/crm:P7_took_place_at ?from__id .
?manuscript__id mmm-schema:data_provider_url ?manuscript__url .
?manuscript__id mmm-schema:data_provider_url ?manuscript__url .
?from__id skos:prefLabel ?from__name .
?from__id skos:prefLabel ?from__name .
?from__id wgs84:lat ?from__lat ;
?from__id wgs84:lat ?from__lat ;
...
@@ -228,52 +227,38 @@ module.exports = {
...
@@ -228,52 +227,38 @@ module.exports = {
}
}
`
,
`
,
'
facetQuery
'
:
`
'
facetQuery
'
:
`
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX text: <http://jena.apache.org/text#>
PREFIX text: <http://jena.apache.org/text#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX sch: <http://schema.org/>
PREFIX sch: <http://schema.org/>
PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
PREFIX geosparql: <http://www.opengis.net/ont/geosparql#>
PREFIX frbroo: <http://erlangen-crm.org/efrbroo/>
PREFIX frbroo: <http://erlangen-crm.org/efrbroo/>
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 ?cnt ?value ?facet_text ?parent {
{ SELECT DISTINCT (count(DISTINCT ?id) as ?cnt) ?value ?parent
{ SELECT DISTINCT (count(DISTINCT ?id) as ?cnt) ?value ?parent
{
{
?id a frbroo:F4_Manifestation_Singleton .
?id a frbroo:F4_Manifestation_Singleton .
<FILTER>
<FILTER>
?id <PREDICATE> ?value .
?id <PREDICATE> ?value .
OPTIONAL { ?value crm:P89_falls_within ?parent }
OPTIONAL { ?value crm:P89_falls_within ?parent }
#?value dct:source mmm-schema:Bodley .
#?value dct:source mmm-schema:Bodley .
}
}
GROUP BY ?value ?parent
GROUP BY ?value ?parent
ORDER BY DESC(?cnt)
ORDER BY DESC(?cnt)
}
FILTER(BOUND(?value)) BIND(COALESCE(?value, <http://ldf.fi/NONEXISTENT_URI>) AS ?labelValue)
OPTIONAL { ?labelValue skos:prefLabel ?lbl .
FILTER(langMatches(lang(?lbl), "fi")) . }
OPTIONAL { ?labelValue rdfs:label ?lbl .
FILTER(langMatches(lang(?lbl), "fi")) . }
OPTIONAL { ?labelValue skos:prefLabel ?lbl .
FILTER(langMatches(lang(?lbl), "en")) . }
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) }
}
}
FILTER(BOUND(?value))
?value skos:prefLabel ?facet_text_
BIND(STR(?facet_text_) AS ?facet_text)
}
}
`
,
`
,
'
tgn
'
:
{
'
tgn
'
:
{
// Getty LOD documentation:
// Getty LOD documentation:
...
...
This diff is collapsed.
Click to expand it.
src/server/sparql/SparqlApi.js
+
2
−
6
View file @
b9dbcf41
...
@@ -38,12 +38,8 @@ class SparqlApi {
...
@@ -38,12 +38,8 @@ class SparqlApi {
}
}
selectQuery
(
query
,
params
=
{
headers
:
defaultSelectHeaders
})
{
selectQuery
(
query
,
params
=
{
headers
:
defaultSelectHeaders
})
{
return
this
.
query
(
query
,
params
).
then
((
data
)
=>
{
return
this
.
query
(
query
,
params
).
then
(
data
=>
{
if
(
this
.
endpoint
===
'
http://vocab.getty.edu/sparql.json
'
)
{
return
JSON
.
parse
(
data
);
return
(
data
);
}
else
{
return
JSON
.
parse
(
data
);
}
});
});
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment