Stringify single-variable VALUES without parens #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SPARQL has a special syntax for the common case of
VALUES
clauses with only one variable, where the parentheses may be omitted. Produce such clauses inSparqlGenerator
when possible.Partially fixes #68 (does not address line folding).
This doesn’t add any tests yet, because I’m not sure how they should be done. The existing tests for
SparqlGenerator
don’t directly compare the original and generated query string: they parse both and then assert that they’re equal. Such a comparison is not affected by this change – a test for this would check that we don’t generate invalidVALUES
clauses, but not ensure that we don’t stop generating the single-variable version in the future.I could add a very specific test for this feature to
SparqlGenerator-test.js
(or a new test file), but most of the existing tests are parameterized and work on a list of queries. So perhaps it would be better to add another test which compares the generated SPARQL to a certain file (say,test/generatedQueries/QUERY.sparql
) if it exists?