Details
-
Bug
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
Jena 3.14.0
-
None
Description
Description
Creating a query with any QueryBuilder (SelectBuilder, AskBuilder etc.) when an RDF.type predicate is present will result in a query that contains the character 'a' followed by 19 spaces instead of a single 'a' (shortcut to the RDF.type predicate) or "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>" (the URI of the RDF.type predicate).
Example:
new SelectBuilder().addWhere(createVariable("subject"), org.apache.jena.vocabulary.RDF.type, createVariable("object")).buildString()
OR
new SelectBuilder().addWhere(createVariable("subject"), createURI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), createVariable("object")).buildString()
OR
new SelectBuilder().addWhere(createVariable("subject"), "a", createVariable("object")).buildString()
will create the following query
SELECT * WHERE { ?subject a ?object}
Probably caused by:
https://github.com/apache/jena/commit/6570c25be8c6e958a5647a7d2c1e23466498b332
Summary
The formatting of the query is invalid when the rdf:type predicate is present.
Steps to reproduce
Check the result of
new SelectBuilder().addWhere(createVariable("subject"), "a", createVariable("object")).buildString()
Expected results
SELECT * WHERE { ?subject a ?object}
Actual results
SELECT * WHERE { ?subject a ?object}
Attachments
Issue Links
- links to