query-485e41c734b1ad137f7254f6d3ce31dc

rq turtle/ttl

.on TwitterOriginally posted

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
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 ?item ?itemLabel ?NSDAPMemberSince ?NSDAPMemberUntil ?BundesverdienstkreuzWhen WHERE {
  ?item wdt:P31 wd:Q5;
        p:P102 ?partyStatement;
        p:P166 ?awardStatement.
  ?partyStatement ps:P102 wd:Q7320.
  ?awardStatement ps:P166/wdt:P279* wd:Q21164.
  OPTIONAL { ?partyStatement pq:P580 ?NSDAPMemberSince_. }
  OPTIONAL { ?partyStatement pq:P582 ?NSDAPMemberUntil_. }
  OPTIONAL { ?awardStatement pq:P585 ?BundesverdienstkreuzWhen_. }
  BIND(COALESCE(?NSDAPMemberSince_, "unknown"@en) AS ?NSDAPMemberSince)
  BIND(COALESCE(?NSDAPMemberUntil_, "unknown"@en) AS ?NSDAPMemberUntil)
  BIND(COALESCE(?BundesverdienstkreuzWhen_, "unknown"@en) AS ?BundesverdienstkreuzWhen)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY
DESC(BOUND(?NSDAPMemberSince_))
DESC(BOUND(?NSDAPMemberUntil_))
DESC(BOUND(?BundesverdienstkreuzWhen_))
ASC(?NSDAPMemberSince_)
ASC(?NSDAPMemberUntil_)
ASC(?BundesverdienstkreuzWhen_)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?BundesverdienstkreuzWhen"):::projected v3("?BundesverdienstkreuzWhen_") v7("?NSDAPMemberSince"):::projected v1("?NSDAPMemberSince_") v8("?NSDAPMemberUntil"):::projected v2("?NSDAPMemberUntil_") v6("?awardStatement") v4("?item"):::projected v5("?partyStatement") a1((" ")) c9(["wd:Q21164"]):::iri c14(["bd:serviceParam"]):::iri c6(["wd:Q7320"]):::iri c2(["wd:Q5"]):::iri c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal v4 --"p:direct/P31"--> c2 v4 --"p:P102"--> v5 v4 --"p:P166"--> v6 v5 --"p:statement/P102"--> c6 v6 --"p:statement/P166"--> a1 a1 --"p:direct/P279"--> c9 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P580".-> v1 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P582".-> v2 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:qualifier/P585".-> v3 end bind0[/"?NSDAPMemberSince_sunknown^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>'"/] v1 --o bind0 bind0 --as--o v7 bind1[/"?NSDAPMemberUntil_sunknown^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>'"/] v2 --o bind1 bind1 --as--o v8 bind2[/"?BundesverdienstkreuzWhen_sunknown^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>'"/] v3 --o bind2 bind2 --as--o v9 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 end