abian created this task.
abian added a project: Wikidata Query UI.
Restricted Application added a subscriber: Aklapper.
Restricted Application added a project: Wikidata.

TASK DESCRIPTION

As a user I want to have an option to automatically transform my SPARQL queries into a standard, consistent format (upper/lowercase, indentation, cosmetic spaces, line breaks, etc.) with the Wikidata Query UI in order to share them. As a Wikidata contributor I also want to have that option in order to apply the same format to all the queries on https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples.

Problem: There are too many ways of writing the same SPARQL query and this fact makes users write their queries using different criteria and copypasted fragments from several sources and examples. This makes a single query inconsistent with itself. On the other hand, there is no way of automatically reformatting SPARQL queries from the Wikidata Query UI and it's tedious to do it manually.

Example:

Screenshots/mockups:

BDD
GIVEN a SPARQL query
AND an option to reformat queries from the Wikidata Query UI
WHEN I click that option
THEN the SPARQL query is reformatted consistently

Acceptance criteria:

  • All parentheses, ( and ), when they aren't part of a literal or a comment, are preceded/followed by the same combination of whitespaces/tabs/line feeds/carriage returns. Opening and closing parentheses can follow different rules.
  • All brackets, [ and ], when they aren't part of a literal or a comment, are preceded/followed by the same combination of whitespaces/tabs/line feeds/carriage returns. Opening and closing brackets can follow different rules.
  • All braces, { and }, when they aren't part of a literal or a comment, are preceded/followed by the same combination of whitespaces/tabs/line feeds/carriage returns. Opening and closing braces can follow different rules.
  • All symbols ;, when linking triples with a common subject, are preceded/followed by the same combination of whitespaces/tabs/line feeds/carriage returns.
  • All SPARQL clauses, when used as such, are uppercase.
  • There is no more than one whitespace between SPARQL clauses.
  • There are no blank lines (except, perhaps, the last one).
  • Each level of nesting introduces an indentation with the same number of whitespaces.
  • The dot symbol, ., when finishing a triple, is always followed by a line feed/carriage return.
  • Other possible rules to get a standard, consistent format without modifying the semantics.

Open questions:


TASK DETAIL
https://phabricator.wikimedia.org/T204122

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: abian
Cc: abian, Aklapper, Lahi, Gq86, Lucas_Werkmeister_WMDE, GoranSMilovanovic, QZanden, EBjune, merbst, LawExplorer, Salgo60, Jonas, Xmlizer, jkroll, Smalyshev, Wikidata-bugs, Jdouglas, aude, Tobias1984, Manybubbles, Lydia_Pintscher, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to