Skip to content

GH-4181: Validate TRIPLE argument ranges - #4182

Open
linhongyu510 wants to merge 1 commit into
apache:mainfrom
linhongyu510:fix/gh-4181-triple-argument-ranges
Open

GH-4181: Validate TRIPLE argument ranges#4182
linhongyu510 wants to merge 1 commit into
apache:mainfrom
linhongyu510:fix/gh-4181-triple-argument-ranges

Conversation

@linhongyu510

@linhongyu510 linhongyu510 commented Aug 31, 2026

Copy link
Copy Markdown

GitHub issue resolved #4181

Fixes #4181.

Pull request Description:

TRIPLE() now enforces the SPARQL 1.2 RDF triple argument ranges regardless of ARQ strict mode:

  • subjects must be IRIs or blank nodes;
  • predicates must be IRIs;
  • objects must be IRIs, blank nodes, literals, or triple terms.

The implementation also fixes the invalid-subject error message to report the subject argument rather than the predicate. Regression tests cover literal and triple-term subjects plus a non-RDF extension node in object position. Existing non-strict tests were updated because SPARQL 1.2 requires these invalid tuples to raise an evaluation error unconditionally.

Verification:

mvn -pl jena-arq -am \
  -Dtest=TestExprTripleTerms,TestExpressions \
  -Dsurefire.failIfNoSpecifiedTests=false test

Tests run: 301, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS

The same commit was also exercised by the full repository suite:

Tests run: 19717, Failures: 0, Errors: 0, Skipped: 12

AI Assistance Disclosure:

AI assisted with implementation review and test planning. The author reviewed the diff and ran the verification commands above.


  • Tests are included.
  • Documentation change and updates are provided for the Apache Jena website (not applicable; this aligns existing behavior with the SPARQL 1.2 specification and changes no Jena documentation surface).
  • Commits have been squashed to remove intermediate development commit messages.
  • Key commit messages start with the issue number (GH-xxxx)

By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.


See the Apache Jena "Contributing" guide.

Enforce the SPARQL 1.2 RDF triple constraints independently of ARQ strict mode and reject non-RDF object nodes. Update expression tests to cover invalid literal and triple-term subjects and invalid extension-node objects.
@linhongyu510
linhongyu510 marked this pull request as draft August 31, 2026 12:01
@linhongyu510
linhongyu510 marked this pull request as ready for review August 31, 2026 17:37
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.

Triple Operation should throw when positions don't satisfy their range

1 participant