Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

Add option to keep query prefixes #186

@vitalis-wiens

Description

@vitalis-wiens

The current implementation supports to generate either all registered prefixes or only used prefixes from the query body. However, several database vendors provide means to add optimization hints for the execution of the sparql query via Prefix definition.

For Example when configuring the Parser in the following way

var parser = new SparqlParser({
      prefixes: {
        schema: "https://schema.org/",
        owl: "http://www.w3.org/2002/07/owl#"
      }
    });

and having the following query

PREFIX db_opt: <https://db.control.param_10> 
SELECT * WHERE {
  ?s a owl:Class
}

The available options will either print all three prefix definitions (schema, owl, db_opt) or only owl.

We would like to keep the Prefix that is in the Prefix definition of the query and use only the used Prefixes of the query body.

This should result in a query for database vendor should look as follows:

PREFIX db_opt: <https://db.control.param_10> 
PREFIX owl: <http://www.w3.org/2002/07/owl#>
?SELECT * WHERE {
  ?s a owl:Class
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions