SPARQL.js icon indicating copy to clipboard operation
SPARQL.js copied to clipboard

Use semicolon separator for multiple statements with same subject

Open nyurik opened this issue 7 years ago • 1 comments

When formatting, I think it would be better to preserve semicolon, or even to always use it when possible. E.g. if two consequent statements have the same subject, use semicolon and indent the second statement. If statements have the same subject and predicate, use comma and put all objects on the same line. I think this makes SPARQL much more readable, and highlights the fact that the subject is the same.

Original:

SELECT * WHERE {
?osmid osmt:place "city";
osmt:wikidata ?wd.
}

Expected formatting:

SELECT * WHERE {
  ?osmid osmt:place "city";
         osmt:wikidata ?wd.
}

Current result:

SELECT * WHERE {
  ?osmid osmt:place "city".
  ?osmid osmt:wikidata ?wd.
}

nyurik avatar Dec 03 '18 16:12 nyurik

Another option would be preserving the syntax variant in the AST

iddan avatar Jan 13 '19 01:01 iddan