Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryBuilder should generate query syntax trees that correspond to parser output. #2156

Open
afs opened this issue Jan 5, 2024 · 0 comments
Labels
enhancement Incrementally add new feature Query Builder Query Builder

Comments

@afs
Copy link
Member

afs commented Jan 5, 2024

Version

5.0.0

Feature

See #2153 and #2155 .

Even if the algebra generator is changed to cope with the non-parser AST generated by querybuilder (PR #2155), should the querybuilder try to generate parser-compatible ASTs?

When used over the wire, a query is always in string form.

Example (Jena 4.10.0):

    public static void querybuilderOutput() {
            SelectBuilder selectBuilder = new SelectBuilder();
            selectBuilder.addFilter(selectBuilder.makeExpr("true"));
            Query query = selectBuilder.build();
            System.out.println(query);
            Query query2 = QueryFactory.create(query.toString());
            System.out.println(query2);
            System.out.println("Parsed builder output equals input? "+query.equals(query2));
    }

Output:

SELECT  *
WHERE
  { FILTER ( true )}

SELECT  *
WHERE
  { FILTER ( true ) }

Parsed builder output equals input? false

Note the slight difference in the query strings due to the presence of the ElementGroup in the second, parsed case, which isn't in querybuilder form.

The query patterns of the WHERE clause are:

  • querybuilder : ElementFilter(true)
  • parser : ElementGroup ( ElementFilter(true) ).

Are you interested in contributing a solution yourself?

None

@afs afs added enhancement Incrementally add new feature Query Builder Query Builder labels Jan 5, 2024
@afs afs changed the title Querybuilder should generate query syntax trees that correspond to parser output. QueryBuilder should generate query syntax trees that correspond to parser output. Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Incrementally add new feature Query Builder Query Builder
Projects
None yet
Development

No branches or pull requests

1 participant