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

Stringify single-variable VALUES without parens #69

Merged
merged 1 commit into from
Dec 2, 2018

Conversation

lucaswerkmeister
Copy link
Contributor

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 in SparqlGenerator 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 invalid VALUES 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?

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 in SparqlGenerator when possible.

Partially fixes RubenVerborgh#68 (does not address line folding).
@RubenVerborgh
Copy link
Owner

Thanks!

@RubenVerborgh RubenVerborgh merged commit 110ff38 into RubenVerborgh:master Dec 2, 2018
@RubenVerborgh
Copy link
Owner

Regarding tests: the library is currently not tested as well as I'd want to. But given how things are going now, I don't expect this to break in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove parens and multi-line when formatting VALUES
2 participants