query-edbd96971dce5ca5839d4e669dd56e61
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 DISTINCT ?mdb ?mdbLabel ?faction ?abstract ?dateOfBirth ?dateOfDeath ?abgeordnetenwatchID ?thumbnailURI ?party ?gender ?websiteURI ?instagram ?facebook ?twitter WHERE {
?mdb wdt:P31 wd:Q5.
?mdb p:P39 ?humansWithPositionHeld.
?humansWithPositionHeld ps:P39 wd:Q1939555.
OPTIONAL { ?humansWithPositionHeld pq:P4100 ?faction. }
?mdb rdfs:label ?mdbString.
?mdb schema:description ?abstract.
FILTER(lang(?abstract) = "de").
OPTIONAL {?mdb wdt:P569 ?dateOfBirth. }
OPTIONAL {?mdb wdt:P570 ?dateOfDeath. }
OPTIONAL {?mdb wdt:P5355 ?abgeordnetenwatchID. }
OPTIONAL {
?mdb wdt:P18 ?image_.
BIND(REPLACE(wikibase:decodeUri(STR(?image_)), "http://commons.wikimedia.org/wiki/Special:FilePath/", "") AS ?imageFileName_)
BIND(REPLACE(?imageFileName_, " ", "_") AS ?imageFileNameSafe_)
BIND(MD5(?imageFileNameSafe_) AS ?imageFileNameHash_)
BIND(CONCAT("https://upload.wikimedia.org/wikipedia/commons/thumb/", SUBSTR(?imageFileNameHash_, 1 , 1 ), "/", SUBSTR(?imageFileNameHash_, 1 , 2 ), "/", ?imageFileNameSafe_, "/300px-", ?imageFileNameSafe_) AS ?thumbnailURI)
}
OPTIONAL {?mdb wdt:P102 ?party. }
OPTIONAL {
?mdb wdt:P21 ?gender_.
?gender_ rdfs:label ?genderLabel_.
FILTER(lang(?genderLabel_) = "en").
}
BIND(IF(BOUND(?genderLabel_ ), ?genderLabel_, "unknown") AS ?gender).
OPTIONAL {?mdb wdt:P856 ?websiteURI. }
OPTIONAL {?mdb wdt:P2003 ?instagram. }
OPTIONAL {?mdb wdt:P2013 ?facebook. }
OPTIONAL {?mdb wdt:P2002 ?twitter. }
FILTER('1950-01-01'^^xsd:dateTime <= ?dateOfBirth && ?dateOfBirth < '1960-01-01'^^xsd:dateTime).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?abgeordnetenwatchID"):::projected
v3("?abstract"):::projected
v1("?dateOfBirth"):::projected
v8("?dateOfDeath"):::projected
v20("?facebook"):::projected
v6("?faction"):::projected
v17("?gender"):::projected
v2("?genderLabel_")
v16("?gender_")
v5("?humansWithPositionHeld")
v13("?imageFileNameHash_")
v12("?imageFileNameSafe_")
v11("?imageFileName_")
v10("?image_")
v19("?instagram"):::projected
v4("?mdb"):::projected
v7("?mdbString")
v15("?party"):::projected
v14("?thumbnailURI"):::projected
v21("?twitter"):::projected
v18("?websiteURI"):::projected
c24(["bd:serviceParam"]):::iri
c6(["wd:Q5"]):::iri
c26(["#91;AUTO_LANGUAGE#93;,de"]):::literal
c9(["wd:Q1939555"]):::iri
f0[["'1950-01-01^^xsd:dateTime' <= ?dateOfBirth?dateOfBirth < '1960-01-01^^xsd:dateTime'"]]
f0 --> v1
f1[["?abstract = 'de'"]]
f1 --> v3
v4 --"p:direct/P31"--> c6
v4 --"p:P39"--> v5
v5 --"p:statement/P39"--> c9
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:qualifier/P4100".-> v6
end
v4 --"rdfs:label"--> v7
v4 --"schema:description"--> v3
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P569".-> v1
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P570".-> v8
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P5355".-> v9
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P18".-> v10
bind2[/"replace(http://wikiba.se/ontology#decodeUri(str(?image_)),'http://commons.wikimedia.org/wiki/Special:FilePath/','')"/]
v10 --o bind2
bind2 --as--o v11
bind3[/"replace(?imageFileName_,' ','_')"/]
v11 --o bind3
bind3 --as--o v12
bind4[/"MD5(?imageFileNameSafe_)"/]
v12 --o bind4
bind4 --as--o v13
bind5[/"concat('https://upload.wikimedia.org/wikipedia/commons/thumb/',substring(?imageFileNameHash_,'1^^xsd:integer','1^^xsd:integer'),'/',substring(?imageFileNameHash_,'1^^xsd:integer','2^^xsd:integer'),'/',?imageFileNameSafe_,'/300px-',?imageFileNameSafe_)"/]
v13 --o bind5
v12 --o bind5
bind5 --as--o v14
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P102".-> v15
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P21".-> v16
v16 --"rdfs:label"--> v2
end
bind6[/"if(bound(?genderLabel_),?genderLabel_,'unknown')"/]
v2 --o bind6
bind6 --as--o v17
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P856".-> v18
end
subgraph optional8["(optional)"]
style optional8 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P2003".-> v19
end
subgraph optional9["(optional)"]
style optional9 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P2013".-> v20
end
subgraph optional10["(optional)"]
style optional10 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P2002".-> v21
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c24 --"wikibase:language"--> c26
end