Repository navigation
feat(rdf)!: JSON-LD @base, scopes and @direction per spec; RDF term equality and document order in Python - #2284
Conversation
A relative @id was joined to @base as a string, so `../b` against http://b.org/x/y gave http://b.org/x/y../b and `a` against http://b.org/doc gave http://b.org/doca, while Turtle resolved the same references by RFC 3986. JSON-LD now uses the resolver Turtle does, in transactions, queries, bulk import and fluree.parse alike. A relative @base or @vocab resolves against the base already in effect. A base ending in `/` resolves as before. Under one ending in `#`, or a non-hierarchical base such as urn:, a bare reference now resolves to a different IRI: `alice` against http://example.org/ns# is http://example.org/alice, and `#alice` is what names http://example.org/ns#alice. Compaction against @base gives a reference that resolves back: `#alice` under a base ending in `#`, and the full IRI where the shortened form would read differently (a leading `/`, a colon in the first segment, a dot segment). The string-joining iri::join is removed.
… propagates A type-scoped context applied to every node object nested in the typed node. JSON-LD 1.1 scopes it to the typed node's own properties unless the scoped context says "@propagate": true, and now Fluree does too: a nested node object starts from the context the typed node had before its types' contexts, while a lone {"@id": …} reference, a value object and the typed node's own values keep them. A named graph, an annotation and an embedded triple-term node are new node objects too. A property's scoped context applied to a single node object it held but not to node objects in an array; it applies to each now.
A JSON-LD value object's @direction was dropped, and every JSON-LD writer gave a directional string's tag whole as its @language ("ar--rtl"), which is no valid language tag. Fluree holds a direction in its language tag, as Turtle's "x"@ar--rtl writes it; JSON-LD now reads and writes it there. - Expansion joins a value object's @direction ("ltr" or "rtl") to its language: {"@value": "x", "@language": "ar", "@direction": "rtl"} is "x"@ar--rtl in a transaction, a bulk import and fluree.parse. A direction with no language is dropped, as JSON-LD's RDF conversion drops it; another direction is refused. - A JSON-LD where clause joins it the same way, so it matches what an insert stored. - Query output, hydration, typed output, export, SHACL reports and the graph writer split the tag into @language and @direction.
fluree.IRI, BlankNode and LangString are str subclasses that compared as their text, so an IRI equalled the string literal with its text, "Paris" equalled "Paris"@fr while "Paris"@fr did not equal "Paris"@en, and a set of distinct quads collapsed: FIBO's 132,594 quads became 132,590. They stay str subclasses that print, slice and pass as their text, but now compare as RDF terms: an IRI equals only an IRI, a blank node only a blank node, and a LangString only one with the same text, tag and direction. Quad and Triple compare their objects by kind too, so 1, True, 1.0 and Decimal(1) are four literals, and a JSON (dict) value hashes. Code that compared a result to a plain string, `row.s == "http://..."`, now finds them unequal; compare with fluree.IRI(...). - IRI(text) and Literal(value, datatype) check for an absolute IRI and raise ValueError otherwise. IRIs the engine returns are made without the check, so data stored before it reads back. - LangString has a direction ("ltr", "rtl" or None); the engine's "ar--rtl" tag reads as language "ar", direction "rtl", and LangString("x", "ar--rtl") is LangString("x", "ar", "rtl"). - fluree.ntriples(value) writes a term, a Triple or a whole Quad in N-Triples, as serialize writes it; str(quad) is its N-Quads line. - fluree.parse takes UTF-8 bytes, such as a request body.
fluree.parse returned a document's quads grouped by graph, the default graph first, each graph's reifications after its triples, and a JSON-LD node's nested nodes and list cells before the statement pointing to them. It returned no prefixes. Both matter to a caller that presents a document back as it was written. - GraphCollectorSink::recording_order notes where each statement went and each prefix declared, rewound with an aborted statement and relabeled with the dataset's blank nodes; into_ordered_dataset reads them. - rdf::parse_document gives a Document whose statements() follow the document, and whose prefixes are the declarations in order. - The JSON-LD adapter emits a node's statement before describing the node object it points to, and a list's cells now stand where the list does rather than at the end of the graph. Bulk import reads the same events in the new order; what it stores is unchanged. - fluree.parse returns a Quads list in document order, with `prefixes`: the prefixes a Turtle or TriG document declares.
…ed JSON-LD fluree.serialize wrote the default graph first and named graphs by name, whatever order the quads came in, and gave a subject one Turtle block per run of its statements, so a subject the quads returned to later got a second block (a 38.9 KB response wrote 41.4 KB). It had no expanded JSON-LD output. - Graph::gather_subjects brings each subject's triples, and each predicate's, together in the order they first appear; a graph already grouped is left as it is. - format_trig_ordered, format_nquads_ordered and format_jsonld_dataset_ordered write graphs in a given order, the default graph among them (TriG writes its triples at top level where it comes). The unordered writers, and CONSTRUCT output, are unchanged. - rdf::serialize_ordered gathers subjects for Turtle and TriG and writes graphs in order; rdf::serialize_expanded_jsonld writes the json-ld#expanded profile. - fluree.serialize keeps the quads' order, graphs as the quads first name them, and takes expanded=True for expanded JSON-LD.
Clippy's type_complexity refused the inline (quads, prefixes) tuple.
aaj3f
left a comment
There was a problem hiding this comment.
@bplatz these are nice fixes, and at a design level no pushback from me on any of the six parts: the RFC 3986 resolver Turtle and SPARQL already share, @propagate as the algorithm's previous context, direction stored in the tag form Turtle already writes with one split helper for every JSON-LD writer, and order recorded opt-in in the sink so transactions and import pay nothing for it.
On the @base change: I'm on board with RFC resolution, since it's the spec and it's what Turtle already does. What I'd make the case for before merge is an upgrade note that names the case that will actually bite: a context with a # or urn: @base and no @vocab, which our parsers treat as one namespace for ids and terms. After this, the same document writes new subjects beside the old ones without an error, so the note should say how to check for it and what to write instead (details inline). I think that's the minimum we should ship with. One more option for you to weigh, and it's your call: since nothing errors, a one-time warning when a reference resolves differently than it used to (base plus reference), the same posture we landed on for config in #2249. Logs won't reach a Python user, so the note would still carry most of the weight, and I'd understand if you'd rather stop at the note.
On the Python terms: I'm on board with type-strict equality. It's what rdflib does (URIRef("x") == "x" is False there too), so it's what an RDF-minded Python user expects. Just give it its own entry in compatibility.md, since the body says it's there and it isn't yet.
One class note, not for this PR: with the direction living in the language tag, every consumer of the tag has to split it, and this PR is the class fix for the JSON-LD writers. The instances still outside it are SPARQL's: LANG() returns ar--rtl (eval/string.rs:155-181), the SPARQL JSON and XML results write it whole as xml:lang (format/sparql.rs:345, sparql_xml.rs:308), and the SPARQL lexer can't write "x"@ar--rtl at all (inline below). The structural fix is the first-class rdf:dirLangString that compatibility.md already names as the future extension. The point fixes here are right for this PR.
Full review below:
✅ Approve with nits.
@bplatz I like how carefully each of these was taken back to the spec, and the order recording is a nice touch for anyone presenting a document back the way it was written. Each of the six parts is the design I'd have picked, the chokepoints are in the right places (resolve_iri, NodeKeys.nodes, split_base_direction, an opt-in sink), and every new test runs in CI on this head. The one thing I'd hold the merge for is the compatibility notes: the @base change moves subjects for anyone using a # or urn: base without @vocab, the output side changes too, and the Python equality break isn't in compatibility.md yet. The rest are optional: two nested-node entry points that still see the type's scoped context, a per-item context clone worth hoisting, a relative @base with no base, @direction from a context, the SPARQL lexer, and a few doc lines.
Adherence to repo commitments:
- Patterns/abstractions: ✔ reuses
fluree_vocab::iri::resolve_iriinstead of a third resolver, one split helper for every JSON-LD writer, order recorded in the existing collecting sink rather than a second reader.⚠️ @directionis parsed twice (expand.rsand the where parser'snode_map.rs), a split this PR inherits rather than introduces. - Performance (speed first, memory second): ✔ no query, index or commit path changes; writers add an allocation-free tag split; order recording is opt-in. One avoidable per-item
ParsedContextclone under property-scoped arrays in expansion (inline), not a regression on anything that expanded correctly before. - Deployment targets: ✔ pure parse and format code reachable from every host (embedded
fluree-db-api,fluree-db-server, wasm32), with no threads, filesystem, clock, background work or process-lifetime cache; wasm32 and wasm-smoke green on this head, Python green on Linux, macOS and Windows. - Testing: ✔ unit tests per fix plus
it_query_datatype::directional_strings_read_and_write_directionand the Python suite, all run in CI on5acd2ca14.⚠️ the array-wrapped list,@reverseand relative-@basecases above are untested. - Conventions: ✔ multi-line commit bodies,
!on the breaking commits, docs updated acrosscompatibility.md,rdf-documents.md,iri-and-context.mdand the README.⚠️ compatibility.mdis missing the Python break and the output compaction change.
Verified at branch HEAD: CI run 42521424742 on 5acd2ca14 is green (test 16234 passed, clippy, fmt, testsuite-sparql, wasm32, wasm-smoke, python ×3 with 457 passed); Claude probed the Python term semantics against this PR's _terms.py and traced the rest in code.
Approving so you can merge when ready, but please get the compatibility notes in first, and maybe worth considering a few of the others while you're there.
| - Under a base ending in a path segment, the segment is replaced: `alice` under `http://example.org/doc` is `http://example.org/alice`. | ||
| - Under a non-hierarchical base such as `urn:ex:`, `alice` is `urn:alice`. Define a prefix for such a namespace instead. | ||
|
|
||
| A relative `@base` or `@vocab` resolves against the base already in effect. Data already written stays as it is. |
There was a problem hiding this comment.
Before merge (docs). The breaking-change notes miss the case most likely to bite, the output side, and the Python break. A few gaps in what an upgrading user reads here:
- The base-as-vocab idiom. Our JSON-LD transaction and query parsers copy
@baseinto@vocabwhen a context has no@vocab(normalize_context_value,fluree-db-transact/src/parse/jsonld.rs:1506-1516andfluree-db-query/src/parse/mod.rs:487-497). So{"@base": "http://example.org/ns#"}used to be a one-namespace context:alice,Personandknowsall landed inns#. After this PR terms still do and references don't, so{"@id": "alice", "@type": "Person"}writeshttp://example.org/alicetypedns#Person. On a ledger written before the upgrade, the same document now writes a second subject beside the first, and awhereordeletenaming"alice"misses the stored one, without an error. Same for aurn:ex:base (urn:ex:alicebefore,urn:alicenow). "Data already written stays as it is" is true, and it's exactly the problem. I think the note should name this idiom, say how to tell whether you're affected (a context whose@basedoesn't end in/), and give the fix (#alice, or a prefix). - Query output. Under a
#base,@ids now compact to#alicewhere they used to come back asalice(fluree-graph-json-ld/src/compact.rs:126-129), and a suffix starting with/, with a colon in its first segment or with a dot segment now comes back as the full IRI. A client reading@idsees a different string. That's correct, it just deserves a line under this heading. - Python. The body says this section "covers each of these", but the
IRI/BlankNode/LangStringequality change (row.s == "http://..."is nowFalse) is only in the Python README. Worth its own####entry here, next to the DROP one. docs/concepts/iri-and-context.md:158-160still says@vocab: ""makes bare terms and base-relative identifiers "share the same namespace". For a base that doesn't end in/that stops being true after this PR.
There was a problem hiding this comment.
Addressed in 95a713f. On the one-time warning: leaving it at the note. It would compute the old join for every relative reference during expansion, on the import path, for a log line a Python user never sees.
| { | ||
| parse_node_value(item, entry, context, nodes, &item_path, strict)? | ||
| } | ||
| JsonValue::Object(map) if is_list_item(map) || is_set_item(map) => { |
There was a problem hiding this comment.
Optional. Two node-object entry points still start from the type-scoped context. Reading expand.rs, the array-wrapped list arm here sends the item to expand_node_internal(item, context, …), and the @reverse map does the same at expand.rs:866 (not in this diff). Both maps carry no @type, so inside them nodes resolves to the typed node's context, and a node object nested in them still sees the type's scoped context.
So with T scoped as in type_scoped_context_stops_at_nested_nodes, "p": {"@list": [{"name": "x"}]} expands name with the outer context (right), but "p": [{"@list": [{"name": "x"}]}] expands it with T's. The algorithm reverts at both, since each is a map that is neither a value object nor a lone @id. The array-wrapped list also skips p's own scoped context today (pre-existing).
Maybe route the list/set item through parse_node_value(item, entry, context, nodes, …) as the non-array arm does, expand the @reverse map against keys.nodes, and add both shapes to type_scoped_context_stops_at_nested_nodes. Since compatibility.md:87 now drops the propagation deviation, the docs claim this already. It's minor and non-blocking, but if you agree it's right, I'd rather see it folded in now than lost in the backlog.
| let start = if is_reference { context } else { nodes }; | ||
| let ctx = match entry.and_then(|e| e.context.as_deref()) { | ||
| Some(scoped) => { | ||
| let mut merged = start.clone(); |
There was a problem hiding this comment.
Optional (performance). The property's scoped context is now rebuilt per array item. expand_nested_node clones start and applies scoped for each node object, and the array arm now calls it per item, so an array of N nodes under a property with a scoped context clones the whole ParsedContext N times. This regresses nothing that expanded correctly before (arrays skipped the scoped context entirely, which was the bug), and I don't think scoped contexts are common in big documents, but import is exactly where the very large arrays live.
start and scoped are the same for every item, so the merge could be built once per property value in parse_node_value (a Cow beside nodes) and passed down, leaving only the lone-{"@id"} case to start from context. Minor and non-blocking, but cheap to fold in now.
| Some(JsonValue::String(s)) => { | ||
| result.base = Some(match base.base.as_deref() { | ||
| Some(current) => resolve_iri(current, s), | ||
| None => s.clone(), |
There was a problem hiding this comment.
Optional. A relative @base with no base in effect yields an IRI starting with :. When no base is in effect, the relative @base is kept as written, and resolve_iri then treats it as a base with an empty scheme (fluree-vocab/src/iri.rs:144-146) and recomposes scheme + ":" + path (:120-121). So {"@context": {"@base": "foo/"}, "@id": "a"} gives :foo/a, where it used to give foo/a. Claude traced this rather than ran it. fluree.parse refuses it through check_absolute, but Claude didn't find a guard on the transaction path, and :foo/a is not what anyone wrote either way.
JSON-LD's context processing raises invalid base IRI for exactly this case, so maybe return a JsonLdError here when base.base is None and s isn't absolute. Minor, but if you agree, I'd rather see it in this PR.
| /// A value object's `@direction`, which Fluree joins to its language tag as | ||
| /// RDF 1.2 writes it (`ar` and `rtl` are `ar--rtl`). A string with a | ||
| /// direction but no language is plain, as JSON-LD's RDF conversion makes it. | ||
| fn base_direction(map: &Map<String, JsonValue>) -> Result<Option<&str>> { |
There was a problem hiding this comment.
Optional. @direction is read from a value object only. JSON-LD 1.1 has three places for it: the value object, a default @direction in a context, and @direction on a term definition. The spec's own examples use the context form for whole documents of Arabic or Hebrew text. Today the context form falls into "Ignore unknown @-keywords" (context.rs:351), so {"@context": {"@language": "ar", "@direction": "rtl"}, "title": "…"} stores "…"@ar and the direction is gone, silently. The docs say so for the context form, and say nothing about the term form.
Since the plain-string path already applies the term or default language, the direction can sit right beside it (a direction on ParsedContext and ContextEntry, joined the way base_direction does). That would make the title's "per spec" hold for direction. Small side note: the test at expand.rs:1776-1783 pins {"@value": "v", "@direction": "ltr"} under a default @language: en as en--ltr. In the expansion algorithm a value object doesn't take the default language (only a plain string does), so the spec gives a plain "v". That deviation is older than this PR (and #2283 keeps it too), so perhaps just don't pin it in a new test, or list it in compatibility.md. Fold-it-in-now territory if you agree.
|
|
||
| // `@direction` joins the language tag, as a transaction stores it; with | ||
| // no language it is dropped there, so it is here. | ||
| let constant_lang = match (constant_lang, obj.get("@direction")) { |
There was a problem hiding this comment.
Optional (parity). A JSON-LD where can now match a directional string; SPARQL still can't write one. The SPARQL lexer's LANGTAG loop stops at -- (fluree-db-sparql/src/lex/lexer.rs:965-973), so "مرحبا"@ar--rtl can't appear in a SPARQL query, and the W3C lang-basedir tests sit in the skip register (testsuite-sparql/tests/registers/mod.rs:403-406). This isn't introduced here (Turtle-stored directional strings were already unmatchable from SPARQL), but this PR is where JSON-LD gets ahead.
Accepting --ltr|--rtl after the tag, as the Turtle lexer does (fluree-graph-turtle/src/lex/lexer.rs:374), plus a SPARQL leg in directional_strings_read_and_write_direction, would keep the two in step. Minor and non-blocking, but I'd rather see it here than in the backlog. Commenting here because fluree-db-sparql/src/lex/lexer.rs is not in this diff.
There was a problem hiding this comment.
Filed as #2361, with LANG() and the SPARQL result formats.
| is dropped, but `LANG()` returns `en--ltr`, JSON-LD output carries that in | ||
| `@language`, and `langMatches(?l, "en")` will not match it. First-class | ||
| `rdf:dirLangString` is a future extension. | ||
| is dropped, but `LANG()` returns `en--ltr`, and `langMatches(?l, "en")` will |
There was a problem hiding this comment.
Optional (nit). This is so minor, but since this paragraph was rewritten: langMatches(?l, "en") does match en--ltr. eval_lang_matches (fluree-db-query/src/eval/rdf.rs:273-275) matches a tag that starts with the range followed by -, and en--ltr is en then -. Maybe drop that clause, or say LANG() is the one that surprises.
| text, as a `str` or UTF-8 `bytes`, needs `format=`, and a dict or list is | ||
| JSON-LD. Turtle, TriG and JSON-LD resolve relative IRIs against `base=`, | ||
| by RFC 3986. | ||
| - Quads compare as RDF statements: a set of them keeps an IRI apart from a |
There was a problem hiding this comment.
Optional. "Quads compare as RDF statements" holds in lexical mode, not quite in the default value mode. Claude loaded this PR's _terms.py and checked: with literals="value", "1"^^xsd:int, "1"^^xsd:integer and "01"^^xsd:integer all become 1, so three distinct statements are one quad in a set; decimal 1.0/1.00 and float/double collapse the same way. With literals="lexical" all three stay apart. I'm not suggesting value mode change, it's the point of value mode, but a sentence here (and in Quad's docstring) like "for RDF term identity (dedup, diff, sort), parse with literals="lexical"" would keep the claim true. rdflib's Literal equality is lexical too, so that's what an rdflib user would expect. Minor and non-blocking.
| let graph = quad.getattr(intern!(py, "graph"))?; | ||
| let graph = (!graph.is_none()).then(|| nodes.term(graph)).transpose()?; | ||
| match &graph { | ||
| None if !graph_order.contains(&None) => graph_order.push(None), |
There was a problem hiding this comment.
Optional (nit). Not a big deal, but graph_order.contains(&None) scans the order list for every default-graph quad, and when the default graph first shows up after many named graphs each scan runs that far. A bool would do it. Cheap to fold in.
| /// itself under one ending in `/`, and `None` for a suffix resolution would | ||
| /// read differently (a leading `/`, a scheme-like first segment, a dot | ||
| /// segment). | ||
| fn base_reference(base: &str, suffix: &str) -> Option<String> { |
There was a problem hiding this comment.
Praise. base_reference is really nice: it shortens only when resolution reads back to the same IRI, and base_compaction_expands_back proves it by round-tripping every case through expand::iri. That round-trip assertion is the right shape of test for the whole @base change.
# Conflicts: # fluree-graph-json-ld/src/expand.rs
…refuse a baseless relative @base A node inside a list an array holds, or inside an `@reverse` map, still started from the typed node's context, so a type's scoped context reached it. Both now start from the context nested nodes use. A list in an array also takes its property's scoped context, which it skipped. A relative `@base` with no base in effect was kept as written and then resolved as a base with an empty scheme, giving IRIs like `:foo/a`. It is refused. A property's scoped context is merged once per property value rather than once per node in an array. The compatibility reference names the `@base`-as-vocabulary case that moves subjects, the change in compacted `@id`s, and the Python term equality change. The direction test no longer pins a value object taking the default language.
The envelope-release test came from main, where a ledger's data sits at `<ledger>/<branch>/txn`. On next it sits under the incarnation's `@<id>` directory, so the test read a path that does not exist and has failed since it was merged in.
Fixes JSON-LD behavior that deviated from the spec, makes Python RDF terms compare as RDF terms, and keeps a document's order and prefixes through
parseandserialize. One commit per part.JSON-LD (transactions, queries, bulk import and
fluree.parse)@baseresolves by RFC 3986 (9dc2679b7). Relative references used to be joined to@baseas strings, which gavehttp://b.org/x/y../bandhttp://b.org/doca. Turtle already used the RFC resolver, so the same reference resolved differently in the two syntaxes.@baseor@vocabnow resolves against the base already in effect. A relative@basewith no base to resolve against is refused.@basegives a reference that resolves back:#aliceunder a base ending in#, and the full IRI where a shortened one would read differently.iri::joinis removed."@propagate": true(2aecdeb42). This was listed incompatibility.mdas a deviation.@reversemap too.@direction(6e4d0061b). It is joined into the language tag (ar--rtl), the form Fluree already stores for Turtle.@languageand@direction: query output, hydration, typed output, export, SHACL reports and the graph writer. Before, they emitted the invalid"@language": "ar--rtl".whereclauses match it the same way.Python and RDF documents
c60d1ddd3, breaking).IRI,BlankNodeandLangStringstaystrsubclasses but now compare by kind."Paris"no longer equals"Paris"@fr.QuadandTriplecompare their objects by kind too, so1,True,1.0andDecimal(1)stay distinct in a set.IRI(...)andLiteral(..., datatype)check for an absolute IRI. IRIs the engine returns skip the check, so existing data reads back.LangStringgains adirectionfield.fluree.ntriples(term)writes a term in N-Triples, andstr(quad)is the quad's N-Quads line.fluree.parseaccepts UTF-8bytes.08bbbe92c).GraphCollectorSink::recording_orderrecords each statement's position, andrdf::parse_documentreturns them in document order with the prefixes as declared.fluree.parsereturns aQuadslist with.prefixes.446367d0b).Graph::gather_subjectsbrings each subject's statements together, in first-seen order.format_*_orderedwriters write graphs in a given order.rdf::serialize_orderedandrdf::serialize_expanded_jsonldare new.fluree.serializekeeps the quads' order and takesexpanded=True.Breaking changes
row.s == "http://...") now getsFalse; compare withfluree.IRI(...).@baseresolution changes for bases that don't end in/: a base ending in#, a base ending in a path segment, andurn:bases.@baseand no@vocab, which Fluree reads as one namespace for ids and terms. Terms still land there and ids no longer do, so the same document writes new subjects beside the stored ones, without an error.@ids in query results change to match (#aliceunder a#base).@basewith no base in effect is refused."@propagate": true.The
compatibility.mdbehavior-changes section covers each of these.Performance
@base, a type-scoped context or@direction.Follow-ups
@languageand the term's datatype)@directionfrom a context or a term definition)LANG()and the SPARQL result formats return the joined tag)Tests
Each fix's test fails without the fix. That was checked by reverting the fix and re-running.
relative_references_resolve_against_base_per_rfc_3986,type_scoped_context_stops_at_nested_nodes,type_scoped_context_stops_inside_array_lists_and_reverse,relative_base_without_a_base_is_refused,property_scoped_context_reaches_each_node_in_an_array,direction_joins_the_language_tag.base_compaction_expands_back.directional_string_writes_its_direction,language_tag_writes_direction_apart.direction_joins_the_language_tag_in_where.rdfmodule:a_document_keeps_its_order,json_ld_nests_and_lists_keep_their_order,a_document_keeps_its_prefixes,serialize_ordered_keeps_graph_and_subject_order,expanded_json_ld_has_every_value_in_an_array.gather_subjects_keeps_first_appearance.it_query_datatype::directional_strings_read_and_write_direction.test_rdf.pyfor term equality, validation, direction,ntriples, bytes, document order, prefixes, and serializer order and expanded output. Existing tests that compared results to plain strings now compare withIRI(...).