query-52ecf759240df95af9d5b1dba0fe4b1a

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 ?person ?personLabel ?givenName ?occupation
WHERE
{
  {

{
  SELECT ?person
  WHERE
  {
    {
      # Get items that are instance of a subclass of human AND items with sitelink to dewiki
      { ?person wdt:P31/wdt:P279* wd:Q5. }
      UNION
      { ?hasSitelink schema:about ?person; schema:isPartOf <https://de.wikipedia.org/>. }
    }
    ?person wdt:P509 wd:Q175111.
  }
}    OPTIONAL { ?person wdt:P735 ?givenNameItem. }
  }
  UNION
  {

{
  SELECT ?person
  WHERE
  {
    {
      # Get items that are instance of a subclass of human AND items with sitelink to dewiki
      { ?person wdt:P31/wdt:P279* wd:Q5. }
      UNION
      { ?hasSitelink schema:about ?person; schema:isPartOf <https://de.wikipedia.org/>. }
    }
    ?person wdt:P509 wd:Q175111.
  }
}    OPTIONAL { ?person wdt:P106 ?occupationItem. }
  }
  SERVICE wikibase:label
  {
    bd:serviceParam wikibase:language "de,en".
    ?person rdfs:label ?personLabel.
    ?givenNameItem rdfs:label ?givenName.
    ?occupationItem rdfs:label ?occupation.
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?givenName"):::projected v3("?givenNameItem") v2("?hasSitelink") v7("?occupation"):::projected v4("?occupationItem") v1("?person"):::projected v5("?personLabel"):::projected a1((" ")) a2((" ")) c6([https://de.wikipedia.org/]):::iri c8(["wd:Q175111"]):::iri c12(["bd:serviceParam"]):::iri c3(["wd:Q5"]):::iri c14(["de,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v2 --"schema:about"--> v1 v2 --"schema:isPartOf"--> c6 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c3 end union1r <== or ==> union1l end v1 --"wdt:P509"--> c8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P106".-> v4 end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v2 --"schema:about"--> v1 v2 --"schema:isPartOf"--> c6 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 end union2r <== or ==> union2l end v1 --"wdt:P509"--> c8 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P735".-> v3 end end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 v1 --"rdfs:label"--> v5 v3 --"rdfs:label"--> v6 v4 --"rdfs:label"--> v7 end