Cleanup of graph implementation and fixed SPARQL dialect.

Change-Id: I78f890e4b6739bba161335091352d5979d36ff03