Problem/Motivation

When modules alter SPARQL queries using hook_query_alter() or hook_query_TAG_alter(), they may introduce invalid SPARQL syntax, particularly in SELECT clauses. This commonly occurs when multiple variables are selected with incorrect comma placement after DISTINCT.

Steps to reproduce

  1. Implement a hook_query_alter() that modifies the SELECT clause to include multiple variables
  2. Execute the SPARQL query
  3. Observe parse error: Encountered " "," ", "" at line 1, column 20

Proposed resolution

Add a fixSparqlSyntax() method in the Query::compile() method to sanitize SPARQL syntax after hook alterations.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

vdacosta@voidtek.com created an issue.