Small SPARQL, RDQL, etc. Cheat Sheet
For the lack of the same, I'll put here some of my notes on SPARQL, RDQL, graph databases, and semantic web related topics in general... Will probably branch out to several pages in future, but for now, it's just a small mess.
Introduction
I'm using Redland 1.0.13, Raptor 2.0.4, and Rasqal 0.9.26 as reference implementation of SPARQL 1.0, SPARQL 1.1, and RDQL.
Basic Observations
Main rule of thumb I observed in many systems - fixing object ("RHS") of the triplet is much cheaper than fixing subject ("LHS"), sometimes in the order of 3-4 magnitudes.
In other words - having only triplets
something contains a-thing
and querying for "all things that given fixed something contains"
SELECT ?thing WHERE { something contains ?thing }
might take substantially longer than storing also
a-thing contained-in something
triplets along, and querying for "all things contained in given fixed something"
SELECT ?thing WHERE { ?thing contained-in something }