query-b05d4a315d0e6b1d700f30466ee58b73

rq turtle/ttl

TODO

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 bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?article ?sitelink (GROUP_CONCAT(DISTINCT ?occupationLabel_;separator="; ") as ?occupationLabel)
WHERE 
{
  VALUES ?occ {                   # list of occupations
    wd:Q28389   # screenwriter
    wd:Q2526255 # film director
    wd:Q33999   # actor
  }

  ?item wdt:P106/wdt:P279* ?occ . # item has this occupation of a subclass thereof
  ?item wdt:P106 ?occupation .    # exactly which occupation does the item have
  ?occupation wdt:P279* ?occ .    # we're only interested in occupations which are related to the above list
  ?item wdt:P27 wd:Q953.          # country of citizenship

  OPTIONAL {?article schema:about ?item ;     # do they have an EN wiki article?
  schema:isPartOf <https://en.wikipedia.org/> ;
  schema:name ?sitelink .}

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". 
                         ?item rdfs:label ?itemLabel .
                         ?occupation rdfs:label ?occupationLabel_ .}  
} GROUP BY ?item ?itemLabel ?article ?sitelink

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?article"):::projected v2("?item"):::projected v6("?itemLabel"):::projected v1("?occ") v3("?occupation") v8("?occupationLabel") v7("?occupationLabel_"):::projected v5("?sitelink"):::projected a1((" ")) c7([https://en.wikipedia.org/]):::iri c10(["bd:serviceParam"]):::iri c4(["wd:Q953"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?occ/] bind0-->v1 bind00(["wd:Q28389"]) bind00 --> bind0 bind01(["wd:Q2526255"]) bind01 --> bind0 bind02(["wd:Q33999"]) bind02 --> bind0 v2 --"wdt:P106"--> a1 a1 --"wdt:P279"--> v1 v2 --"wdt:P106"--> v3 v3 --"wdt:P279"--> v1 v2 --"wdt:P27"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."schema:about".-> v2 v4 --"schema:isPartOf"--> c7 v4 --"schema:name"--> v5 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 v2 --"rdfs:label"--> v6 v3 --"rdfs:label"--> v7 end bind2[/"?occupationLabel_"/] v7 --o bind2 bind2 --as--o v8