split out more code
This commit is contained in:
parent
cec535ee7e
commit
dc24e3f7e7
8 changed files with 194 additions and 215 deletions
19
templates/sparql/geosearch.sparql
Normal file
19
templates/sparql/geosearch.sparql
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
SELECT DISTINCT ?item ?distance ?itemLabel ?isa ?isaLabel ?commonsCat ?commonsSiteLink WHERE {
|
||||
{
|
||||
SELECT DISTINCT ?item ?location ?distance ?isa WHERE {
|
||||
?item wdt:P31/wdt:P279* wd:Q486972.
|
||||
?item wdt:P31 ?isa .
|
||||
SERVICE wikibase:around {
|
||||
?item wdt:P625 ?location.
|
||||
bd:serviceParam wikibase:center "Point({{ lon }} {{ lat }})"^^geo:wktLiteral;
|
||||
wikibase:radius 5;
|
||||
wikibase:distance ?distance.
|
||||
}
|
||||
}
|
||||
}
|
||||
MINUS { ?item wdt:P582 ?endTime . }
|
||||
OPTIONAL { ?item wdt:P373 ?commonsCat. }
|
||||
OPTIONAL { ?commonsSiteLink schema:about ?item;
|
||||
schema:isPartOf <https://commons.wikimedia.org/>. }
|
||||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
|
||||
} ORDER BY (?distance)"""
|
||||
14
templates/sparql/lookup_by_name.sparql
Normal file
14
templates/sparql/lookup_by_name.sparql
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
SELECT DISTINCT ?item ?itemLabel ?commonsSiteLink ?commonsCat WHERE {
|
||||
?item rdfs:label {{ name }}@en .
|
||||
FILTER NOT EXISTS { ?item wdt:P31 wd:Q17362920 } .# ignore Wikimedia duplicated page
|
||||
OPTIONAL { ?commonsSiteLink schema:about ?item ;
|
||||
schema:isPartOf <https://commons.wikimedia.org/> }
|
||||
OPTIONAL { ?item wdt:P373 ?commonsCat }
|
||||
?item wdt:P625 ?coords .
|
||||
|
||||
FILTER(geof:distance(?coords, "Point({{ lon }} {{ lat }})"^^geo:wktLiteral) < 10)
|
||||
FILTER(?commonsCat || ?commonsSiteLink)
|
||||
|
||||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
|
||||
}
|
||||
|
||||
8
templates/sparql/lookup_gss.sparql
Normal file
8
templates/sparql/lookup_gss.sparql
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
SELECT ?item ?itemLabel ?commonsSiteLink ?commonsCat WHERE {
|
||||
?item wdt:P836 {{ gss }} .
|
||||
OPTIONAL { ?commonsSiteLink schema:about ?item ;
|
||||
schema:isPartOf <https://commons.wikimedia.org/> }
|
||||
OPTIONAL { ?item wdt:P373 ?commonsCat }
|
||||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
|
||||
}
|
||||
|
||||
8
templates/sparql/scottish_parish.sparql
Normal file
8
templates/sparql/scottish_parish.sparql
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
SELECT ?item ?itemLabel ?commonsSiteLink ?commonsCat WHERE {
|
||||
?item wdt:P528 "{{ code }}" .
|
||||
?item wdt:P31 wd:Q5124673 .
|
||||
OPTIONAL { ?commonsSiteLink schema:about ?item ;
|
||||
schema:isPartOf <https://commons.wikimedia.org/> }
|
||||
OPTIONAL { ?item wdt:P373 ?commonsCat }
|
||||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue