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

Remove parens and multi-line when formatting VALUES #68

Closed
nyurik opened this issue Nov 30, 2018 · 2 comments · Fixed by #69
Closed

Remove parens and multi-line when formatting VALUES #68

nyurik opened this issue Nov 30, 2018 · 2 comments · Fixed by #69

Comments

@nyurik
Copy link

nyurik commented Nov 30, 2018

Per issue reported for Wikidata Query Service, please do not add parenthesis to a single value VALUES list. Examples:

Original text

SELECT * WHERE {
  VALUES ?a { wd:Q1 wd:Q2 ... }
}

Desired results

# short list
SELECT * WHERE {   VALUES ?a { wd:Q1 wd:Q2 } }
# long list
SELECT * WHERE {
  VALUES ?a {
    wd:Q1 wd:Q2 wd:Q1 wd:Q2 wd:Q1 wd:Q2 wd:Q1 wd:Q2 wd:Q1 wd:Q2 wd:Q1 wd:Q2
    wd:Q1 wd:Q2 wd:Q1 wd:Q2 wd:Q1 wd:Q2 wd:Q1 wd:Q2 wd:Q1 wd:Q2 wd:Q1 wd:Q2
  }
}

Current result

SELECT * WHERE {
  VALUES (?a) {
    (wd:Q1)
    (wd:Q2)
  }
}
lucaswerkmeister added a commit to lucaswerkmeister/SPARQL.js that referenced this issue Dec 1, 2018
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).
lucaswerkmeister added a commit to lucaswerkmeister/SPARQL.js that referenced this issue Dec 1, 2018
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).
@nyurik
Copy link
Author

nyurik commented Dec 3, 2018

@RubenVerborgh thanks you for such a quick response!!! I noticed that in #69 you only dealt with the parentheses, not the multiline issue, but you closed this one. Should multiline be a separate issue? Thx!!

@RubenVerborgh
Copy link
Owner

RubenVerborgh commented Dec 3, 2018 via email

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 a pull request may close this issue.

2 participants