query-7e681be3e86e2802ef57affdbe77c597
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?description (SAMPLE(?image_) as ?image) ?legend ?imageDate ?birthdate ?deathdate
(GROUP_CONCAT(DISTINCT ?nationalityLabel_;separator="; ") as ?nationalityLabel)
(GROUP_CONCAT(DISTINCT ?sexLabel_;separator="; ") as ?sexLabel)
(GROUP_CONCAT(DISTINCT ?occupationLabel_;separator="; ") as ?occupationLabel)
?article WHERE
{
{ SELECT ?item ?itemLabel ?description ?image ?legend ?imageDate ?birthdate ?deathdate ?nationality ?sex ?occupation ?article
WHERE {
{
SELECT ?item ?itemLabel ?birthdate WHERE {
?item wdt:P31 wd:Q5;
wdt:P569 ?birthdate.
FILTER(("1991-00-00"^^xsd:date <= ?birthdate) && (?birthdate < "1992-00-00"^^xsd:dat))
} } OPTIONAL { ?item wdt:P734 ?lastname. }
OPTIONAL { ?item wdt:P570 ?deathdate. }
OPTIONAL { ?item wdt:P27 ?nationality. }
OPTIONAL { ?item wdt:P21 ?sex. }
OPTIONAL { ?item wdt:P106 ?occupation. }
OPTIONAL {
?item p:P18 ?stat.
?stat ps:P18 ?image_.
OPTIONAL { ?stat pq:P2096 ?legend. FILTER (langmatches(lang(?legend), "en")) }
OPTIONAL { ?stat pq:P585 ?imageDate. }
}
?article schema:about ?item;
schema:isPartOf <https://en.wikipedia.org/>.
} } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?nationality rdfs:label ?nationalityLabel_ .
?item rdfs:label ?itemLabel_ .
?sex rdfs:label ?sexLabel_ .
?occupation rdfs:label ?occupationLabel_ .
?item schema:description ?itemDescription .}
} GROUP BY ?item ?itemLabel ?description ?legend ?imageDate ?birthdate ?deathdate ?article
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v12("?article"):::projected
v1("?birthdate"):::projected
v4("?deathdate"):::projected
v18("?image")
v11("?imageDate"):::projected
v10("?image_"):::projected
v2("?item"):::projected
v17("?itemDescription")
v14("?itemLabel_")
v3("?lastname")
v8("?legend"):::projected
v5("?nationality")
v19("?nationalityLabel")
v13("?nationalityLabel_"):::projected
v7("?occupation")
v21("?occupationLabel")
v16("?occupationLabel_"):::projected
v6("?sex")
v20("?sexLabel")
v15("?sexLabel_"):::projected
v9("?stat")
c18([https://en.wikipedia.org/]):::iri
c20(["bd:serviceParam"]):::iri
c4(["wd:Q5"]):::iri
c22(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["'1991-00-00^^xsd:date' <= ?birthdate?birthdate < s1992-00-00^^<http://www.w3.org/2001/XMLSchema#dat>'"]]
f0 --> v1
v2 --"p:direct/P31"--> c4
v2 --"p:direct/P569"--> v1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P734".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P570".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P27".-> v5
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P21".-> v6
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P106".-> v7
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:P18".-> v9
v9 --"p:statement/P18"--> v10
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v9 -."p:qualifier/P2096".-> v8
end
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v9 -."p:qualifier/P585".-> v11
end
end
v12 --"schema:about"--> v2
v12 --"schema:isPartOf"--> c18
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c20 --"wikibase:language"--> c22
v5 --"rdfs:label"--> v13
v2 --"rdfs:label"--> v14
v6 --"rdfs:label"--> v15
v7 --"rdfs:label"--> v16
v2 --"schema:description"--> v17
end
bind5[/"sample(?image_)"/]
v10 --o bind5
bind5 --as--o v18
bind6[/"?nationalityLabel_"/]
v13 --o bind6
bind6 --as--o v19
bind7[/"?sexLabel_"/]
v15 --o bind7
bind7 --as--o v20
bind8[/"?occupationLabel_"/]
v16 --o bind8
bind8 --as--o v21