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

Đang mở
#4,388 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@afs đang làm issue này rồi.

Từ ngày 6/11/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.

Ngôn ngữ chính
Java
Star
1.5k
Fork
733
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
56

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/jena

Tất cả issue của apache/jena

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.