WIP: Add code to find root pattern of a SPARQL query

The goal is to simplify the query by removing any patterns that
depend on variables in other patterns, to make something that will
execute much faster than the full query but hopefully still give
some idea of the number of results needed.

The best SPARQL parsing library available appears to be Rasqal, but
this is C only so I have written the code in C for now to be called
from Python as an external binary.

Rasqal doesn't expose enough functions for manually creating and
manipulating rasqal_query and rasqal_graph_pattern objects, so
I need to either come up with a further hack to come up with a
new RDF query, or use a Python SPARQL parser instead.