Dynamic SPARQL query construction is essential for how rdfproxy works and also the (conceptually) most difficult and potentially error-prone part of the library.
Basically, the SPARQL adapter has to construct two queries, an items_query and a count_query - exactly how those queries are constructed and what modifications and injections have to happen depends on the query and on the supplied model.
Currently, the logic for query construction is expressed as a set of functions in rdfproxy.utils.sparql_utils.
Query construction logic should utilize a protocol-based constructor dispatch mechanism and could be bundled in a QueryConstructor class.
This would significantly help with keeping the query modification logic organized and also allow for much cleaner code in rdfproxy.SPARQLModelAdapter, e.g.:
Dynamic SPARQL query construction is essential for how
rdfproxy
works and also the (conceptually) most difficult and potentially error-prone part of the library.Basically, the SPARQL adapter has to construct two queries, an
items_query
and acount_query
- exactly how those queries are constructed and what modifications and injections have to happen depends on the query and on the supplied model.Currently, the logic for query construction is expressed as a set of functions in
rdfproxy.utils.sparql_utils
.Query construction logic should utilize a protocol-based constructor dispatch mechanism and could be bundled in a
QueryConstructor
class.This would significantly help with keeping the query modification logic organized and also allow for much cleaner code in
rdfproxy.SPARQLModelAdapter
, e.g.: