query-f512c5ea9df9d45ff5b2088acc07ad66

rq turtle/ttl

P217 + prov:wasDerivedFrom. this query? Something sort of similar to (P217)inventory number , along with a local particular source reference to a (P248)stated in How to query Wikidata to get a list of items that include a I'd like a result with columns like this: Q-Person / Person-label / Title-of-source / Inventory-number Q1234 / John Smith / Biographical Dictionary / 5-8907 Q5678 / Anthony Williams / Biographical Dictionary / 12-99944 of an item that includes the source and local identifier as a reference. Here is an example 19:25, 19 June 2021 (UTC)) talk (M2545I know "prov:wasDerivedFrom" is involved, but unfortunately my SPARQL skills remain rudimentary. Advice gratefully accepted. -- : I think this query should produce what you want...M2545@

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
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#>
SELECT ?x ?xLabel ?source ?sourceLabel ?inventory_num ?propertyLabel  WHERE {
  VALUES ?source { wd:Q107290461 }   # place the sources here
  ?x ?p ?stmt .
  ?stmt prov:wasDerivedFrom [ 
      pr:P248 ?source ;        # stated in
      pr:P217 ?inventory_num 
         ] .
  ?property wikibase:claim ?p .  # what property is the reference on
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY ?inventory_num

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?inventory_num"):::projected v4("?p") v6("?property") v2("?source"):::projected v5("?stmt") v3("?x"):::projected a1((" ")) c6(["bd:serviceParam"]):::iri c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?source/] bind0-->v2 bind00(["wd:Q107290461"]) bind00 --> bind0 v3 -->v4--> v5 a1 --"pr:P248"--> v2 a1 --"pr:P217"--> v1 v5 --"prov:wasDerivedFrom"--> a1 v6 --"wikibase:claim"--> v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end