query-3b3932b3ee08d6528dc879f67cc58edd

rq turtle/ttl

Propertiessubclass of (P279)instance of (P31)Science Museum Group ID (P8694)inventory number (P217) Things called a "loom" that have an inventory number OR a Science Museum Group ID

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?thingLabel ?name ?ID ?ID2 WHERE {
VALUES ?prop {wdt:P279 wdt:P31}
?thing ?prop wd:Q173056; 
  rdfs:label ?name FILTER (lang(?name)="en") FILTER STRENDS(?name, " loom") #this is case sensitive! 

{ ?thing wdt:P8694 ?ID .} # has SMG ID
UNION
{ ?thing wdt:P217 ?ID2 . } # has inventory number of any kind

} ORDER BY ?name

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?ID"):::projected v5("?ID2"):::projected v1("?name"):::projected v2("?prop") v3("?thing") c3(["wd:Q173056"]):::iri f0[["ends-with(?name,' loom')"]] f0 --> v1 f1[["?name = 'en'"]] f1 --> v1 bind2[/VALUES ?prop/] bind2-->v2 bind20(["wdt:P279"]) bind20 --> bind2 bind21(["wdt:P31"]) bind21 --> bind2 v3 -->v2--> c3 v3 --"rdfs:label"--> v1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P217"--> v5 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P8694"--> v4 end union0r <== or ==> union0l end