Skip to content

GH-5327 RDF and SPARQL 1.2 Compliant parsers, writers, SPARQL grammar and evaluation#5836

Merged
hmottestad merged 1 commit into
eclipse-rdf4j:developfrom
Ontotext-AD:GH-5327-rdf-sparql-12-parsers-serializers-grammar-eval
Jun 1, 2026
Merged

GH-5327 RDF and SPARQL 1.2 Compliant parsers, writers, SPARQL grammar and evaluation#5836
hmottestad merged 1 commit into
eclipse-rdf4j:developfrom
Ontotext-AD:GH-5327-rdf-sparql-12-parsers-serializers-grammar-eval

Conversation

@desislava-hristova-ontotext

@desislava-hristova-ontotext desislava-hristova-ontotext commented May 17, 2026

Copy link
Copy Markdown
Contributor

GitHub issue resolved: #GH5327

Briefly describe the changes proposed in this PR:

The MR adds supports for RDF 1.2 and SPARQL 1.2 based on the existing branches:
GH-5327 added RDF 1.2 testsuite files for Turtle, TriG, NTriples, NQuads, and refactored testsuite code to run RDF 1.2 and 1.1 test suites GH-5327 Version Announcement in Turtle and TriG writers, Version Parsing in Turtle, TriG, NTriples, and NQuads parsers GH-5327 Changed RDF-Star to RDF 1.2 triple terms, bumped version to 6.0.0 GH-5327 RDF 1.2 implementation for JSON and dirLangString literals
With the addition of the following:

  • Triple Terms: Renamed Triple → TripleTerm throughout the codebase to align with RDF 1.2 terminology. TripleTerm is allowed only on object position as defined in RDF 1.2 specification.
  • SPARQL 1.2 compliance to grammar and built-in functions. Implement SPARQL 1.2 compliant evaluation
  • Add SPARQL 1.2 conformance suite. Conformance tests pass with MemoryStore. Disable SPARQL 1.2 conformance tests for NativeStore and LMDBStore since these are not implemented.
  • Extends the version announcement logic so it is applied in NTriples and Nquads writers. Fixes an issue with incorrect closing of context when statement is part of the named graph and version has to be announced afterward for trig files. Fixes an issue with announcing version in the middle of ttl file where it concatenates the version to the previous triple.
  • Extends RDF-XML parser and XMLLiteral serializer to fully support RDF 1.2 semantics and strict validation rules
  • Updated RDF 1.2 conformance tests for parsers and writers
  • Removal of SPARQL star formats - replacement of legacy star parser/writers and formats with the corresponding classes supporting triple terms, replacement of methods and parameters indicating legacy SPARQL star support with new Triple Term support, removal of legacy star file formats (.srjs, etcs) and mime types.
  • Disabled W3CApprovedSPARQL10QueryTest - Needs further inspection

PR Author Checklist (see the contributor guidelines for more details):

  • my pull request is self-contained
  • I've added tests for the changes I made
  • I've applied code formatting (you can use mvn process-resources to format from the command line)
  • I've squashed my commits where necessary
  • every commit message starts with the issue number (GH-xxxx) followed by a meaningful description of the change

Co-authored-by: Sava Savov sava.savov@graphwise.ai
Co-authored-by: Ralitsa Dimitrova ralitsa.dimitrova@ontotext.com
Co-authored-by: Dancho Ivanov dancho.ivanov@ontotext.com

@desislava-hristova-ontotext desislava-hristova-ontotext marked this pull request as draft May 17, 2026 13:40

private boolean anonymous;

private boolean isBNode;

@hmottestad hmottestad May 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain what this is used for?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@desislava-hristova-ontotext desislava-hristova-ontotext force-pushed the GH-5327-rdf-sparql-12-parsers-serializers-grammar-eval branch from 9b0081c to 4899e30 Compare May 18, 2026 10:43
@@ -80,11 +80,12 @@ public abstract class AbstractLiteral implements Literal {
private static final long serialVersionUID = -1286527360744086451L;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In AbstractLiteral should the base direction be part of the equals and/or hashCode methods?

Comment on lines -199 to +175
List.of("brf"), null, SUPPORTS_NAMESPACES, SUPPORTS_CONTEXTS, SUPPORTS_RDF_STAR);
List.of("brf"), null, SUPPORTS_NAMESPACES, SUPPORTS_CONTEXTS, NO_TRIPLE_TERMS);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't binary rdf support triple terms when it previously had support for RDF*?

@aschwarte10

Copy link
Copy Markdown
Contributor

Over the past days I have conducted a bit of smoke testing of this change from a user perspective. I have successfully used RDF 1.2 and SPARQL 1.2 constructs in our application (in the example backed by a memory store as the first reference implementation inside RDF4J). I was able to use different serialization formats and also successfully executed different queries.

Also a quick smoke test in the RDF4J workbench was successful.

I would opt for merging this and making available as second 6.0 milestone build to a broader audience.

When there are edge cases, we can stil iterate upon those later

Great work in this PR which has been done by a broader round of contributors 👍

@kenwenzel kenwenzel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove superfluous unrelated test in lmdb module.

Comment thread core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TripleTermStoreTest.java Outdated

@aschwarte10 aschwarte10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work and a huge step for the RDF4J project. This PR lifts the project to the new RDF 1.2 and SPARQL 1.2 standard.

As stated in my previous comment, I have done some acceptance testing from a user's point of view. Everything working smoothly.

I would be happy to see this merged and made available in a second 6.0 milestone build for broader exposure. We can use this state as a basis for next steps (e.g. LMDB changes) and for broader validation.

Looking forward to seeing reviews from others and getting this in

… branches:

eclipse-rdf4jGH-5327 added RDF 1.2 testsuite files for Turtle, TriG, NTriples, NQuads, and refactored testsuite code to run RDF 1.2 and 1.1 test suites
eclipse-rdf4jGH-5327 Version Announcement in Turtle and TriG writers, Version Parsing in Turtle, TriG, NTriples, and NQuads parsers
eclipse-rdf4jGH-5327 Changed RDF-Star to RDF 1.2 triple terms, bumped version to 6.0.0
eclipse-rdf4jGH-5327 RDF 1.2 implementation for JSON and dirLangString literals
With the addition of the following:
- Triple Terms: Renamed Triple → TripleTerm throughout the codebase to align with RDF 1.2 terminology. TripleTerm is allowed only on object position as defined in RDF 1.2 specification.
- SPARQL 1.2 compliance to grammar and built-in functions. Implement SPARQL 1.2 compliant evaluation
- Add SPARQL 1.2 conformance suite and run also tests that are not approved. Add a passing conformance test suite for the MemoryStore. Disable LMDB and NativeStore SPARQL conformance test since their base direction and triple term support is not implemented yet.
- Add RDF 1.2 xml conformance suite
- Disable W3CApprovedSPARQL10QueryTest. Needs further inspection.

- Extends the version announcement logic so it is applied in NTriples and Nquads writers. Fixes an issue with incorrect closing of context when statement is part of the named graph and version has to be announced afterward for trig files. Fixes an issue with announcing version in the middle of ttl file where it concatenates the version to the previous triple.
- Extends RDF-XML parser and XMLLiteral serializer to fully support RDF 1.2 semantics and strict validation rules
- Updated RDF 1.2 conformance tests for parsers and writers
- Remove RDF-star factories, rename Values.triple to Values.tripleTerm
- Removal of SPARQL star formats -  replacement of legacy star parser/writers and formats with the corresponding classes supporting triple terms, replacement of methods and parameters indicating legacy SPARQL star support with new Triple Term support, removal of legacy star file formats (.srjs, etcs) and mime types.

Co-authored-by: Sava Savov <sava.savov@graphwise.ai>
Co-authored-by: Ralitsa Dimitrova <ralitsa.dimitrova@ontotext.com>
Co-authored-by: Dancho Ivanov <dancho.ivanov@ontotext.com>
@desislava-hristova-ontotext desislava-hristova-ontotext force-pushed the GH-5327-rdf-sparql-12-parsers-serializers-grammar-eval branch from 2adfa2f to 4e230c1 Compare June 1, 2026 10:38
@hmottestad hmottestad marked this pull request as ready for review June 1, 2026 10:51
@hmottestad

hmottestad commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Based on contributions by Sarah Grand https://github.com/SarahGrand @SarahGrand

@hmottestad hmottestad merged commit 7f9c893 into eclipse-rdf4j:develop Jun 1, 2026
20 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants