query-b9f97c0025dc9c00c9afed034f50fb0f

rq turtle/ttl

title:Deprecated values sourced with Beweb, and corresponding correct values SELECT DISTINCT ?item ?itemLabel ?pLabel ?deprecatedValueLabel ?BeWeB ?valueToUseLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "it". } ?item ?property ?deprecatedStatement . ?p wikibase:claim ?property ; wikibase:statementProperty ?stprop . ?deprecatedStatement ?stprop ?deprecatedValue ; prov:wasDerivedFrom ?ref ; wikibase:rank wikibase:DeprecatedRank . OPTIONAL { ?item ?property ?normalStatement . ?normalStatement ?stprop ?normalValue ; wikibase:rank wikibase:NormalRank } . OPTIONAL { ?item ?property ?preferredStatement . ?preferredStatement ?stprop ?preferredValue ; wikibase:rank wikibase:PreferredRank } . BIND(COALESCE(?preferredValue,?normalValue) AS ?valueToUse). ?ref pr:P248 wd:Q77541206 . ?ref pr:P7796 ?beweb. wd:P7796 wdt:P1630 ?fmt . BIND(IRI(REPLACE(?beweb, CONCAT('(',?beweb,')'), ?fmt)) AS ?BeWeB) . } ORDER BY ?pLabel

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Deprecated values sourced with Beweb, and corresponding correct values
SELECT DISTINCT ?item ?itemLabel ?pLabel ?deprecatedValueLabel ?BeWeB ?valueToUseLabel
WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it". }
  ?item ?property ?deprecatedStatement .
  ?p wikibase:claim ?property ; wikibase:statementProperty ?stprop .
  ?deprecatedStatement ?stprop ?deprecatedValue ; prov:wasDerivedFrom ?ref ; wikibase:rank wikibase:DeprecatedRank .
  OPTIONAL { ?item ?property ?normalStatement . ?normalStatement ?stprop ?normalValue ; wikibase:rank wikibase:NormalRank } .
  OPTIONAL { ?item ?property ?preferredStatement . ?preferredStatement ?stprop ?preferredValue ; wikibase:rank wikibase:PreferredRank } .
  BIND(COALESCE(?preferredValue,?normalValue) AS ?valueToUse).
  ?ref pr:P248 wd:Q77541206 .
  ?ref pr:P7796 ?beweb.
  wd:P7796 wdt:P1630 ?fmt .
  BIND(IRI(REPLACE(?beweb,  CONCAT('(',?beweb,')'), ?fmt)) AS ?BeWeB) .
}
ORDER BY ?pLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v16("?BeWeB"):::projected v14("?beweb") v4("?deprecatedStatement") v7("?deprecatedValue") v15("?fmt") v2("?item"):::projected v9("?normalStatement") v10("?normalValue") v5("?p") v1("?pLabel"):::projected v11("?preferredStatement") v12("?preferredValue") v3("?property") v8("?ref") v6("?stprop") v13("?valueToUse") c15(["wd:P7796"]):::iri c11(["wikibase:PreferredRank"]):::iri c9(["wikibase:DeprecatedRank"]):::iri c13(["wd:Q77541206"]):::iri c10(["wikibase:NormalRank"]):::iri c4(["it"]):::literal c2(["bd:serviceParam"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v2 -->v3--> v4 v5 --"wikibase:claim"--> v3 v5 --"wikibase:statementProperty"--> v6 v4 -->v6--> v7 v4 --"prov:wasDerivedFrom"--> v8 v4 --"wikibase:rank"--> c9 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -->v3--> v9 v9 -->v6--> v10 v9 -."wikibase:rank".-> c10 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -->v3--> v11 v11 -->v6--> v12 v11 -."wikibase:rank".-> c11 end bind0[/"?preferredValue?normalValue"/] v12 --o bind0 v10 --o bind0 bind0 --as--o v13 v8 --"pr:P248"--> c13 v8 --"pr:P7796"--> v14 c15 --"wdt:P1630"--> v15 bind1[/"replace(?beweb,concat('(',?beweb,')'),?fmt)"/] v14 --o bind1 v15 --o bind1 bind1 --as--o v16