complete rewrite of RDF engine