query-f2d42470b182a68dcdefc3e9fa5b1bfe

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?value1 ?named1 ?imported_from1 ?import_URL1 ?value2 ?named2 ?imported_from2 ?import_URL2
WHERE 
{
  ?item p:P10404 ?stat1.
  ?stat1 ps:P10404 ?value1 .
  OPTIONAL {?stat1 pq:P1810 ?named1. }
  OPTIONAL {?stat1 prov:wasDerivedFrom/pr:P143 ?imported_from1 . }
  OPTIONAL {?stat1 prov:wasDerivedFrom/pr:P4656 ?import_URL1 . }  

  ?item p:P10404 ?stat2.
  ?stat1 ps:P10404 ?value2 .
  OPTIONAL {?stat2 pq:P1810 ?named2 . }
  OPTIONAL {?stat2 prov:wasDerivedFrom/pr:P143 ?imported_from2 . }
  OPTIONAL {?stat2 prov:wasDerivedFrom/pr:P4656 ?import_URL2 . }  
  FILTER (STR(?stat1) > STR(?stat2)) 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?import_URL1"):::projected v11("?import_URL2"):::projected v6("?imported_from1"):::projected v10("?imported_from2"):::projected v3("?item"):::projected v5("?named1"):::projected v9("?named2"):::projected v1("?stat1") v2("?stat2") v4("?value1"):::projected v8("?value2"):::projected a1((" ")) a2((" ")) a3((" ")) a4((" ")) c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["str(?stat1) > str(?stat2)"]] f0 --> v1 f0 --> v2 v3 --"p:P10404"--> v1 v1 --"p:statement/P10404"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:qualifier/P1810".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."prov:wasDerivedFrom".-> a1 a1 --"p:reference/P143"--> v6 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."prov:wasDerivedFrom".-> a2 a2 --"p:reference/P4656"--> v7 end v3 --"p:P10404"--> v2 v1 --"p:statement/P10404"--> v8 subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:qualifier/P1810".-> v9 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."prov:wasDerivedFrom".-> a3 a3 --"p:reference/P143"--> v10 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v2 -."prov:wasDerivedFrom".-> a4 a4 --"p:reference/P4656"--> v11 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end