query-ce0bc2ecb573c4aed98e42629ae6e85f

rq turtle/ttl

Persons who dont have a pictureI have written the following query that filter out Swedish PMs with the string "vilde" in the partyname and then find Wikicommons pictures for those people.... that has no pictures... WikidataitemsMy problem is how to find the same people BUT has no picture i.e. people in My "wikicommons" query:

Use at

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#>
#title: First/Sec chamber members pictures "vilde" how they are presented in "Porträttbooks"
#defaultView:ImageGrid
SELECT DISTINCT ?file ?wd ?name ?image (CONCAT(?party," ", ?timevilde) AS ?vilde) (concat("Book published ",str(year(?booktime))) AS ?bookPublished)

WHERE 
{  
{ SELECT distinct ?wd ?name ?itemDescription ?party ?timevilde ?startvilde ?endvilde WHERE
  { 
    SERVICE <https://query.wikidata.org/sparql> 
    {
      VALUES ?position { wd:Q81531912 wd:Q33071890 }
      ?wd wdt:P31 wd:Q5;
          wdt:P39 ?position.
      ?wd rdfs:label ?name. FILTER(lang(?name)="sv")
      {
       ?wd p:P102 ?PartyWD. 
       ?PartyWD ps:P102 ?p
       OPTIONAL {?PartyWD pq:P580 ?startvilde}
       OPTIONAL {?PartyWD pq:P582 ?endvilde}
       BIND (concat(str(year(?startvilde))," - ", str(year(?endvilde))) AS ?timevilde)
       ?p rdfs:label ?party.
       FILTER(LANG(?party) ="sv").
       FILTER(CONTAINS(?party, 'vilde'))
        SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,en". }
       #FILTER (?wd = wd:Q5555629)
      }
    }
  }
}.
  ?file wdt:P180 ?wd.
  VALUES ?booksP1433 { 
                       wd:Q116445396 # 1894
                       wd:Q110380539 # 1897 
                       wd:Q110380456 # 1900
                       wd:Q110375618 # 1903
                       wd:Q110376088 # 1906 
                       wd:Q116313186 # 1909
                     }

   SERVICE <https://query.wikidata.org/sparql> 
    {
      ?booksP1433 wdt:P585 ?booktime
    }
  FILTER (?startvilde <= ?booktime)
  FILTER (?endvilde >= ?booktime)
  ?file wdt:P1433 ?booksP1433.
  ?file schema:contentUrl ?url. 
  bind(iri(concat("http://commons.wikimedia.org/wiki/Special:FilePath/", wikibase:decodeUri(substr(str(?url),53)))) AS ?image)
} 
order by ?name ?startvilde

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?PartyWD") v16("?bookPublished") v12("?booksP1433") v4("?booktime"):::projected v3("?endvilde") v11("?file"):::projected v14("?image"):::projected v1("?name"):::projected v9("?p") v7("?party"):::projected v5("?position") v2("?startvilde") v10("?timevilde"):::projected v13("?url") v15("?vilde") v6("?wd"):::projected c13(["bd:serviceParam"]):::iri c4(["wd:Q5"]):::iri c15(["sv,en"]):::literal f0[["?endvilde >= ?booktime"]] f0 --> v3 f0 --> v4 f1[["?startvilde <= ?booktime"]] f1 --> v2 f1 --> v4 subgraph s1["https://query.wikidata.org/sparql"] style s1 stroke-width:4px; f2[["?name = 'sv'"]] f2 --> v1 bind3[/VALUES ?position/] bind3-->v5 bind30(["wd:Q81531912"]) bind30 --> bind3 bind31(["wd:Q33071890"]) bind31 --> bind3 v6 --"p:direct/P31"--> c4 v6 --"p:direct/P39"--> v5 v6 --"rdfs:label"--> v1 f4[["contains(?party,'vilde')"]] f4 --> v7 f5[["?party = 'sv'"]] f5 --> v7 v6 --"p:P102"--> v8 v8 --"p:statement/P102"--> v9 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v8 -."p:qualifier/P580".-> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v8 -."p:qualifier/P582".-> v3 end bind6[/"concat(str(year-from-dateTime(?startvilde)),' - ',str(year-from-dateTime(?endvilde)))"/] v2 --o bind6 v3 --o bind6 bind6 --as--o v10 v9 --"rdfs:label"--> v7 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c13 --"wikibase:language"--> c15 end end v11 --"p:direct/P180"--> v6 bind7[/VALUES ?booksP1433/] bind7-->v12 bind70(["wd:Q116445396"]) bind70 --> bind7 bind71(["wd:Q110380539"]) bind71 --> bind7 bind72(["wd:Q110380456"]) bind72 --> bind7 bind73(["wd:Q110375618"]) bind73 --> bind7 bind74(["wd:Q110376088"]) bind74 --> bind7 bind75(["wd:Q116313186"]) bind75 --> bind7 subgraph s1["https://query.wikidata.org/sparql"] style s1 stroke-width:4px; v12 --"p:direct/P585"--> v4 end v11 --"p:direct/P1433"--> v12 v11 --"schema:contentUrl"--> v13 bind8[/"concat('http://commons.wikimedia.org/wiki/Special:FilePath/',http://wikiba.se/ontology#decodeUri(substring(str(?url),'53^^xsd:integer')))"/] v13 --o bind8 bind8 --as--o v14 bind9[/"concat(?party,' ',?timevilde)"/] v7 --o bind9 v10 --o bind9 bind9 --as--o v15 bind10[/"concat('Book published ',str(year-from-dateTime(?booktime)))"/] v4 --o bind10 bind10 --as--o v16