IRI resolution against a same-scheme base rewrites absolute info: IRIs (info:a/b -> info:a/a/b) since jena-iri removal

Open
#4,388 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@afs is already working on this.

Since Nov 6, 2026.

Assessment

This issue has not been assessed yet.

Description

Version

6.2.0

What happened?

When the base IRI and the reference share a scheme and the scheme uses a rootless path with no authority (e.g. info:), an absolute reference is resolved as if it were relative:

var m = ModelFactory.createDefaultModel();
m.read(new ByteArrayInputStream(
    "<info:fedora/resource1> <http://x/p> <info:fedora/resource2> .".getBytes()),
    "info:fedora/resource1", "TURTLE");
m.write(System.out, "N-TRIPLES");

Jena 5.5.0 (default provider IRIProviderJenaIRI):

<info:fedora/resource1> <http://x/p> <info:fedora/resource2> .

Jena 6.2.0 (default provider IRIProvider3986):

<info:fedora/fedora/resource1> <http://x/p> <info:fedora/fedora/resource2> .

The same happens with UpdateFactory.create(sparql, base).

The cause is in IRI3986.resolve, which already behaves this way in 5.5.0:

IRI3986.create("info:fedora/resource1").resolve(IRI3986.create("info:fedora/resource2"))
// -> info:fedora/fedora/resource2

This matches the non-strict branch of RFC 3986 §5.2.2 (if (!strict) and R.scheme == Base.scheme then undefine R.scheme). RFC 3986 calls this a loophole from earlier specifications whose use "should be avoided" and keeps it only for backward compatibility. A reference with a scheme is expected to be returned unchanged, apart from dot-segment removal.

In 5.x this did not matter because IRIProviderJenaIRI was the default. 6.x removes jena-iri, so IRIProvider3986 is the only provider and there is no way to get strict resolution.

Impact: Fedora Commons (fcrepo) parses internal RDF and SPARQL Update with an info:fedora/... base. With 6.x, every absolute info:fedora/... IRI is rewritten to info:fedora/fedora/..., which corrupts stored triples. Found while evaluating the upgrade in https://github.com/fcrepo/fcrepo/pull/2338.

Expected: an absolute reference whose scheme equals the base's scheme resolves to itself (strict RFC 3986 resolution), or strict mode can at least be configured.

Dominant language
Java
Stars
1.5k
Forks
733
Avg merge
1d 4h
Merged PRs (30d)
48

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/jena

All issues in apache/jena

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.