query-cca52308e3b31bc25d7fd2e14a465b93
rq turtle/ttl
Battles within a sitelink to the French Wikipedia without place and/or date
SELECT ?item ?itemLabel
(SAMPLE(?place) AS ?place)
(SAMPLE(?placeLabel) AS ?placeLabel)
(SAMPLE(?date) AS ?date)
(SAMPLE(?coord) AS ?coord)
(SAMPLE(?article) AS ?article) WHERE {
?item wdt:P31/wdt:P279* wd:Q178561 .
?article schema:about ?item ;
schema:isPartOf https://fr.wikipedia.org/ .
OPTIONAL {
?item wdt:P276 ?place .
OPTIONAL {
?place rdfs:label ?placeLabel .
FILTER(LANG(?placeLabel) IN ("fr","en")) .
}
}
OPTIONAL { ?item (wdt:P585|wdt:P580|wdt:P582) ?date . }
OPTIONAL { ?item wdt:P625 ?coord . }
FILTER(!BOUND(?place) || !BOUND(?date) ) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" }
} GROUP BY ?item ?itemLabel
Use at
https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Battles within a sitelink to the French Wikipedia without place and/or date
SELECT ?item ?itemLabel
(SAMPLE(?place) AS ?place)
(SAMPLE(?placeLabel) AS ?placeLabel)
(SAMPLE(?date) AS ?date)
(SAMPLE(?coord) AS ?coord)
(SAMPLE(?article) AS ?article) WHERE {
?item wdt:P31/wdt:P279* wd:Q178561 .
?article schema:about ?item ;
schema:isPartOf <https://fr.wikipedia.org/> .
OPTIONAL {
?item wdt:P276 ?place .
OPTIONAL {
?place rdfs:label ?placeLabel .
FILTER(LANG(?placeLabel) IN ("fr","en")) .
}
}
OPTIONAL { ?item (wdt:P585|wdt:P580|wdt:P582) ?date . }
OPTIONAL { ?item wdt:P625 ?coord . }
FILTER(!BOUND(?place) || !BOUND(?date) ) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" }
} GROUP BY ?item ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?article"):::projected
v7("?coord"):::projected
v7("?date"):::projected
v3("?item"):::projected
v7("?place"):::projected
v7("?placeLabel"):::projected
a1((" "))
c6([https://fr.wikipedia.org/]):::iri
c7(["fr"]):::literal
c16(["bd:serviceParam"]):::iri
c3(["wd:Q178561"]):::iri
f0[["(not bound(?place) || not bound(?date))"]]
f0 --> v7
f0 --> v7
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v7 --"schema:about"--> v3
v7 --"schema:isPartOf"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P276".-> v7
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v7 -."rdfs:label".-> v7
end
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v3 -."wdt:P582".-> v7
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P580"--> v7
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P585"--> v7
end
union0r <== or ==> union0l
end
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P625".-> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c16 --"wikibase:language"--> c7
end
bind6[/"sample(?place)"/]
v7 --o bind6
bind6 --as--o v7
bind7[/"sample(?placeLabel)"/]
v7 --o bind7
bind7 --as--o v7
bind8[/"sample(?date)"/]
v7 --o bind8
bind8 --as--o v7
bind9[/"sample(?coord)"/]
v7 --o bind9
bind9 --as--o v7
bind10[/"sample(?article)"/]
v7 --o bind10
bind10 --as--o v7
Documentation built with MkDocs using Windmill theme by Grist Labs.