query-71250da2e7976ad5aaf5f89046219bce
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT
?item
(SAMPLE(?label) AS ?label)
(SAMPLE(?description) AS ?description)
(SAMPLE(?class) AS ?class)
(SAMPLE(?classLabel) AS ?classLabel)
(SAMPLE(?pic) AS ?pic)
(SAMPLE(?destroyed) AS ?destroyed)
(SAMPLE(?endTime) AS ?endTime)
(SAMPLE(?wikipediaArticle) AS ?wikipediaArticle)
(SAMPLE(?commonsArticle) AS ?commonsArticle)
(SAMPLE(?commonsCategory) AS ?commonsCategory)
(SAMPLE(?monument) AS ?monument)
WHERE {
# Around given location
SERVICE wikibase:around {
?item wdt:P625 ?location.
bd:serviceParam wikibase:center "Point(4.89 52.37)"^^geo:wktLiteral. # Longitude latitude
bd:serviceParam wikibase:radius "1". # Radius in kilometers.
}
# Get the label in the preferred language of the user, or any other language if no label is available in that language.
# Get the description in the preferred language of the user, or any other language if no description is available in that language.
# Get the class label in the preferred language of the user, or any other language if no label is available in that language.
OPTIONAL {
?item p:P31/ps:P31 ?class.
}
# Get picture
OPTIONAL {?item wdt:P18 ?pic}
# Get existence
OPTIONAL {?item wdt:P576 ?destroyed}
OPTIONAL {?item wdt:P582 ?endTime}
# Get Commons category
OPTIONAL {?item wdt:P373 ?commonsCategory}
# Get Wikipedia article
OPTIONAL {
?wikipediaArticle schema:about ?item.
?wikipediaArticle schema:isPartOf <https://en.wikipedia.org/>. # TODO internationalization
}
# Get Commons article
OPTIONAL {
?commonsArticle schema:about ?item.
?commonsArticle schema:isPartOf <https://commons.wikimedia.org/>.
}
# Wiki Loves Monuments
OPTIONAL {?item p:P1435 ?monument}
OPTIONAL {?item p:P2186 ?monument}
OPTIONAL {?item p:P1459 ?monument}
OPTIONAL {?item p:P1460 ?monument}
OPTIONAL {?item p:P1216 ?monument}
OPTIONAL {?item p:P709 ?monument}
OPTIONAL {?item p:P718 ?monument}
OPTIONAL {?item p:P5694 ?monument}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,[AUTO_LANGUAGE]".
?item rdfs:label ?label .
?item schema:description ?description.
?class rdfs:label ?classLabel . }
}
GROUP BY ?item
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v14("?class"):::projected
v14("?classLabel"):::projected
v14("?commonsArticle"):::projected
v14("?commonsCategory"):::projected
v14("?description"):::projected
v14("?destroyed"):::projected
v14("?endTime"):::projected
v1("?item"):::projected
v14("?label"):::projected
v2("?location")
v14("?monument"):::projected
v14("?pic"):::projected
v14("?wikipediaArticle"):::projected
a1((" "))
c5([sPoint(4.89 52.37)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal
c16([https://en.wikipedia.org/]):::iri
c3(["bd:serviceParam"]):::iri
c17([https://commons.wikimedia.org/]):::iri
c28(["en,#91;AUTO_LANGUAGE#93;"]):::literal
c7(["1"]):::literal
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v1 --"p:direct/P625"--> v2
c3 --"wikibase:center"--> c5
c3 --"wikibase:radius"--> c7
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P31".-> a1
a1 --"p:statement/P31"--> v14
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P18".-> v14
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P576".-> v14
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P582".-> v14
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P373".-> v14
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v14 -."schema:about".-> v1
v14 --"schema:isPartOf"--> c16
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v14 -."schema:about".-> v1
v14 --"schema:isPartOf"--> c17
end
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P1435".-> v14
end
subgraph optional8["(optional)"]
style optional8 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P2186".-> v14
end
subgraph optional9["(optional)"]
style optional9 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P1459".-> v14
end
subgraph optional10["(optional)"]
style optional10 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P1460".-> v14
end
subgraph optional11["(optional)"]
style optional11 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P1216".-> v14
end
subgraph optional12["(optional)"]
style optional12 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P709".-> v14
end
subgraph optional13["(optional)"]
style optional13 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P718".-> v14
end
subgraph optional14["(optional)"]
style optional14 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P5694".-> v14
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c3 --"wikibase:language"--> c28
v1 --"rdfs:label"--> v14
v1 --"schema:description"--> v14
v14 --"rdfs:label"--> v14
end
bind11[/"sample(?label)"/]
v14 --o bind11
bind11 --as--o v14
bind12[/"sample(?description)"/]
v14 --o bind12
bind12 --as--o v14
bind13[/"sample(?class)"/]
v14 --o bind13
bind13 --as--o v14
bind14[/"sample(?classLabel)"/]
v14 --o bind14
bind14 --as--o v14
bind15[/"sample(?pic)"/]
v14 --o bind15
bind15 --as--o v14
bind16[/"sample(?destroyed)"/]
v14 --o bind16
bind16 --as--o v14
bind17[/"sample(?endTime)"/]
v14 --o bind17
bind17 --as--o v14
bind18[/"sample(?wikipediaArticle)"/]
v14 --o bind18
bind18 --as--o v14
bind19[/"sample(?commonsArticle)"/]
v14 --o bind19
bind19 --as--o v14
bind20[/"sample(?commonsCategory)"/]
v14 --o bind20
bind20 --as--o v14
bind21[/"sample(?monument)"/]
v14 --o bind21
bind21 --as--o v14