Rewrote getRelations in SPARQL.