query-49fdc383a25bb606dc995d06594a2287

rq turtle/ttl

Raymond

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 p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel
       ?rank1
       (GROUP_CONCAT(DISTINCT CONCAT(?qual1, ": ", IF(BOUND(?qvalue1Label), ?qvalue1Label, STR(?qvalue1))); SEPARATOR="; ") AS ?qualifiers1)
       ?rank2
       (GROUP_CONCAT(DISTINCT CONCAT(?qual2, ": ", IF(BOUND(?qvalue2Label), ?qvalue2Label, STR(?qvalue2))); SEPARATOR="; ") AS ?qualifiers2)
WHERE
{

{
  SELECT ?item ?GND_statement1 ?GND_statement2
  WHERE
  {

{
  SELECT ?item
  WHERE
  {
    ?item p:P227 [].
  }
  GROUP BY ?item
  HAVING (COUNT(?item) > 1)
}    ?item wdt:P31 wd:Q5. # only humans
    ?item p:P227 ?GND_statement1.
    ?item p:P227 ?GND_statement2.
    FILTER (?GND_statement1 != ?GND_statement2)
    FILTER (STR(?GND_statement1) < STR(?GND_statement2))
  }
}  ?sitelink schema:about ?item.
  ?sitelink schema:isPartOf <https://de.wikipedia.org/>.
  ?GND_statement1 wikibase:rank ?rank1.
  ?GND_statement2 wikibase:rank ?rank2.
  OPTIONAL { ?GND_statement1 ?qualifier1 ?qvalue1. ?qualifierproperty1 wikibase:qualifier ?qualifier1. }
  OPTIONAL { ?GND_statement2 ?qualifier2 ?qvalue2. ?qualifierproperty2 wikibase:qualifier ?qualifier2. }
  SERVICE wikibase:label
  {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de".
    ?item rdfs:label ?itemLabel.
    ?qualifierproperty1 rdfs:label ?qual1.
    ?qualifierproperty2 rdfs:label ?qual2.
    ?qvalue1 rdfs:label ?qvalue1Label.
    ?qvalue2 rdfs:label ?qvalue2Label.
  }
}
GROUP BY ?item ?itemLabel ?GND_statement1 ?GND_statement2 ?rank1 ?rank2

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?GND_statement1") v2("?GND_statement2") v4("?_anon_42b5416610844a34809f33a099ae9de193169") v3("?item"):::projected v14("?itemLabel"):::projected v15("?qual1"):::projected v16("?qual2"):::projected v8("?qualifier1") v11("?qualifier2") v10("?qualifierproperty1") v13("?qualifierproperty2") v19("?qualifiers1") v20("?qualifiers2") v9("?qvalue1"):::projected v17("?qvalue1Label"):::projected v12("?qvalue2"):::projected v18("?qvalue2Label"):::projected v6("?rank1"):::projected v7("?rank2"):::projected v5("?sitelink") a2((" ")) a1((" ")) c7([https://de.wikipedia.org/]):::iri c13(["#91;AUTO_LANGUAGE#93;,de"]):::literal c11(["bd:serviceParam"]):::iri c4(["wd:Q5"]):::iri f0[["str(?GND_statement1) < str(?GND_statement2)"]] f0 --> v1 f0 --> v2 f1[["?GND_statement1 != ?GND_statement2"]] f1 --> v1 f1 --> v2 f2[[" > '1^^xsd:integer'"]] f2 --> a1 v3 --"p:P227"--> a2 bind4[/"count(?item)"/] v3 --o bind4 bind4 --as--o v4 v3 --"p:direct/P31"--> c4 v3 --"p:P227"--> v1 v3 --"p:P227"--> v2 v5 --"schema:about"--> v3 v5 --"schema:isPartOf"--> c7 v1 --"wikibase:rank"--> v6 v2 --"wikibase:rank"--> v7 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -->v8--> v9 v10 -."wikibase:qualifier".-> v8 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -->v11--> v12 v13 -."wikibase:qualifier".-> v11 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 v3 --"rdfs:label"--> v14 v10 --"rdfs:label"--> v15 v13 --"rdfs:label"--> v16 v9 --"rdfs:label"--> v17 v12 --"rdfs:label"--> v18 end bind7[/"concat(?qual1,': ',if(bound(?qvalue1Label),?qvalue1Label,str(?qvalue1)))"/] v15 --o bind7 v17 --o bind7 v9 --o bind7 bind7 --as--o v19 bind8[/"concat(?qual2,': ',if(bound(?qvalue2Label),?qvalue2Label,str(?qvalue2)))"/] v16 --o bind8 v18 --o bind8 v12 --o bind8 bind8 --as--o v20