query-9dfc0bb699670199f1bf7e687631a832

rq turtle/ttl

TODO

Use at

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
{
   {
  SELECT ?mdb ?humansWithPositionHeld WHERE {
 ?mdb wdt:P31 wd:Q5.
 ?mdb p:P39 ?humansWithPositionHeld.
 ?humansWithPositionHeld ps:P39 wd:Q1939555.
} } OPTIONAL { ?humansWithPositionHeld pq:P4100 ?faction. }
 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 "de". 
                         ?mdb rdfs:label ?mdbLabel.
                         ?mdb schema:description ?abstract. }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?abgeordnetenwatchID"):::projected v21("?abstract"):::projected v5("?dateOfBirth"):::projected v6("?dateOfDeath"):::projected v18("?facebook"):::projected v4("?faction"):::projected v15("?gender"):::projected v1("?genderLabel_") v14("?gender_") v3("?humansWithPositionHeld") v11("?imageFileNameHash_") v10("?imageFileNameSafe_") v9("?imageFileName_") v8("?image_") v17("?instagram"):::projected v2("?mdb"):::projected v20("?mdbLabel"):::projected v13("?party"):::projected v12("?thumbnailURI"):::projected v19("?twitter"):::projected v16("?websiteURI"):::projected c22(["de"]):::literal c6(["wd:Q1939555"]):::iri c20(["bd:serviceParam"]):::iri c3(["wd:Q5"]):::iri v2 --"p:direct/P31"--> c3 v2 --"p:P39"--> v3 v3 --"p:statement/P39"--> c6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P4100".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P569".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P570".-> v6 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P5355".-> v7 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P18".-> v8 bind0[/"replace(http://wikiba.se/ontology#decodeUri(str(?image_)),'http://commons.wikimedia.org/wiki/Special:FilePath/','')"/] v8 --o bind0 bind0 --as--o v9 bind1[/"replace(?imageFileName_,' ','_')"/] v9 --o bind1 bind1 --as--o v10 bind2[/"MD5(?imageFileNameSafe_)"/] v10 --o bind2 bind2 --as--o v11 bind3[/"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_)"/] v11 --o bind3 v10 --o bind3 bind3 --as--o v12 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P102".-> v13 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P21".-> v14 v14 --"rdfs:label"--> v1 end bind4[/"if(bound(?genderLabel_),?genderLabel_,'unknown')"/] v1 --o bind4 bind4 --as--o v15 subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P856".-> v16 end subgraph optional8["(optional)"] style optional8 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P2003".-> v17 end subgraph optional9["(optional)"] style optional9 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P2013".-> v18 end subgraph optional10["(optional)"] style optional10 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P2002".-> v19 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c20 --"wikibase:language"--> c22 v2 --"rdfs:label"--> v20 v2 --"schema:description"--> v21 end