Some Working SPARQL

Since I’m trying to work on learning SPARQL (and Learning SPARQL) with a goal of working with data from the Yale Center for British Art, I’m testing what I know in their SPARQL endpoint. This is just a log of some currently working queries.

Get everything about one item (id = 499) and then find every other YCBA object with which it shared an exhibition.

SELECT DISTINCT ?o ?s WHERE {
	ycba:object\/499 ?p ?o .
	?s crm:P12i_was_present_at ?o .
}

This query could be collapsed into one line, but exploding it like this highlights the way the natural language works.

Or, if I know an exhibition ID, show me every object that was in it.

SELECT DISTINCT *
WHERE {
   ?s crm:P12i_was_present_at ycba:exhibition\/7 .
}

Next I’ll try to combine these notions and start with an exhibition name or similar, and work out the web of shared objects.