rdflib
rdflib copied to clipboard
Fix Issue #790. Adding QueryBuilder.
Fixes #790. Developing a query-builder taking guidance from the examples in the issue.
Functions added:
- SELECT
- WHERE
- OPTIONAL
- UNION
- ORDER BY, GROUP BY
- AGGREGATES - (functions)
- FILTER - (functions), (operations)
- LIMIT, OFFSET
- FOR_GRAPH - setting graph for a query using
- MOVE, ADD
- INSERT, DELETE
- NESTED QUERY (example)
Coverage increased (+0.4%) to 76.161% when pulling 3e429bd167456e1b50a831c1a78b016581aab699 on anubhavj99:Issue790 into 037ea51e5f4863a7f98ff59972fcd34d39a7ed97 on RDFLib:master.
What's the status? Can we get it merged?
Hi @anubhavj99 , @Arshdeep25 & @magdasalatka apoligies for missing this PR, I don't know why we haven't addressed it yet. I'm going to put it to multiple review now.
@joernhees I think you might like to review this since you were part of the discussion on Issue #790 that it claims to fix.
As commented in the issue (https://github.com/RDFLib/rdflib/issues/790#issuecomment-687613468) I would prefer to have separate QueryBuilders for different query types, e.g.
query = query_builder.Select().where(...)
instead of:
query = query_builder.QueryBuilder.Select().where(...)
As it allows for simplifications in the code and also avoids the question how to handle api usage like:
query = query_builder.QueryBuilder().SELECT(...).INSERT(...)
I can see the appeal of the current naming SELECT().WHERE()
instead of the pep8
conform .where()
but I would like to ask: is that appeal big enough to not follow pep8 as requested in the dev-guide?
With every exception we get further away from doing more linting inside the CI
I'd like to emphasize that this is a very valuable contribution. It helped me a lot in one of my recent projects. Thanks @anubhavj99, @Arshdeep25 and @saksham16085!
Now, how can we get this into RDFLib?
I'd be happy to contribute some additions from my (not yet public) project, such as
- group graph pattern
- UNION
- OPTIONAL with arbitrary graph pattern
- VALUES
- GROUP_CONCAT
- FILTER (NOT) EXISTS
- execution of xpath functions