query-e9fdbdd70760c51a31f38ccc8b4ee6d1

rq turtle/ttl

Catalog codes and inventory numbers SELECT DISTINCT ?item ?itemLabel (GROUP_CONCAT(DISTINCT ?catalogcode ; separator = " -- ") as ?catalogcodes) (GROUP_CONCAT(DISTINCT ?inventorynumber ; separator = " -- ") as ?inventorynumbers) WHERE { ?item p:P31/ps:P31 wd:Q457843 . ?item p:P195/ps:P195 wd:Q1526131 . OPTIONAL {?item p:P528/ps:P528 ?catalogcode. } OPTIONAL {?item p:P217/ps:P217 ?inventorynumber. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?item ?itemLabel

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Catalog codes and inventory numbers
SELECT DISTINCT
?item ?itemLabel 
(GROUP_CONCAT(DISTINCT ?catalogcode ; separator = " -- ") as ?catalogcodes)
(GROUP_CONCAT(DISTINCT ?inventorynumber ; separator = " -- ") as ?inventorynumbers)
WHERE 
{
  ?item p:P31/ps:P31 wd:Q457843 .
  ?item p:P195/ps:P195 wd:Q1526131 .
  OPTIONAL {?item p:P528/ps:P528 ?catalogcode. }
  OPTIONAL {?item p:P217/ps:P217 ?inventorynumber. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?catalogcode"):::projected v4("?catalogcodes") v3("?inventorynumber"):::projected v5("?inventorynumbers") v1("?item"):::projected a1((" ")) a2((" ")) a3((" ")) a4((" ")) c6(["wd:Q1526131"]):::iri c12(["bd:serviceParam"]):::iri c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal c3(["wd:Q457843"]):::iri v1 --"p:P31"--> a1 a1 --"p:statement/P31"--> c3 v1 --"p:P195"--> a2 a2 --"p:statement/P195"--> c6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P528".-> a3 a3 --"p:statement/P528"--> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P217".-> a4 a4 --"p:statement/P217"--> v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end bind2[/"?catalogcode"/] v2 --o bind2 bind2 --as--o v4 bind3[/"?inventorynumber"/] v3 --o bind3 bind3 --as--o v5