-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Summary
When converting between TriG / JSON-LD and CIMXML, the handling of base IRIs and UUID-based instance identifiers is currently inconsistent and causes ambiguity in identifier construction and serialization.
This ticket defines a clear and deterministic rule set for:
-
Use of @base in TriG and JSON-LD
-
Use of modelURL as dataset-level authority
-
Serialization of UUID-based instance identifiers
-
Differences between CIMXML and RDF syntaxes
The goal is to support object-oriented internal models (UUID without scheme) while producing portable, standards-compliant RDF serializations.
Current behaviour
During conversion from TriG → CIMXML, we observe dataset metadata such as:
<json-ld:base>http://www.Statnett.no/IGM/Nordic44_CGM#</json-ld:base>
with namespace:
xmlns:json-ld="https://www.w3.org/ns/json-ld#"
This appears inside a dcat:Dataset
At the same time:
-
TriG and JSON-LD support @base
-
CIMXML (not RDF/XML in general) currently does not support @base
-
UUID-based identifiers are sometimes emitted as relative values
This issue is related to #9.
Technical clarifications (important)
CIMXML vs RDF/XML
-
RDF/XML does support base IRIs via xml:base
-
CIMXML (current implementation) does not support base IRIs
-
Therefore, CIMXML must not rely on base resolution
rdf:ID vs rdf:about
-
rdf:IDcannot start with a number (XML NCName restriction) -
rdf:aboutcan start with a number, but then represents a relative IRI -
Relative IRIs require a base to become absolute
Design intent
We want:
- Internal object identity to be simple and OO-friendly
→ UUID string without scheme (e.g. 26cc8d71-…)
- External RDF identity to be explicit and deterministic
→ either HTTP-based or urn:uuid:-based
-
Identical local UUID tokens regardless of output format
-
No reliance on fragile URN base resolution rules
Decisions
1. Add modelURL
KGraph SHALL expose a dataset-level attribute:
modelURL : absolute HTTP(S) IRI
Example:
https://model4powersystem.eu/NO/
2. Rules for @base in TriG and JSON-LD
HTTP base
-
modelURL SHALL be used as @base in TriG and JSON-LD by default
-
modelURL SHALL end with /
@base <https://model4powersystem.eu/NO/> .
Rationale:
-
Ensures predictable relative IRI expansion
-
Avoids file-vs-directory ambiguity
URN base
-
@baseSHALL NOT be used to minturn:uuididentifiers -
UUID URNs SHALL be serialized as absolute IRIs
Rationale:
-
@base <urn:uuid:>and@base <urn:uuid:/>produce non-canonical or ambiguous results -
RFC3986 relative resolution with URNs is not portable across parsers
3. Rules for UUID-based identifiers
Internal representation:
mRID = "26cc8d71-12f1-4de9-9e68-125d95073a75"
Serialization:
| Target | Output |
|---|---|
| HTTP model | https://model4powersystem.eu/NO/26cc8d71-... |
| UUID model | urn:uuid:26cc8d71-... |
The choice is made at serialization time, not by changing the internal object model.
4. Rules for CIMXML output
- CIMXML SHALL NOT contain:
-- @base
-
json-ld:base
-
CIMXML SHALL always use absolute IRIs in rdf:about
-
Relative identifiers SHALL NOT be emitted in CIMXML
Rationale:
-
CIMXML currently has no base resolution mechanism
-
Absolute IRIs avoid ambiguity and XML name constraints
Examples
TriG (HTTP-based model)
@base <https://model4powersystem.eu/NO/> .
@prefix cim: <https://cim.ucaiug.io/ns#> .
<26cc8d71-12f1-4de9-9e68-125d95073a75>
a cim:PowerPlant ;
cim:name "Melkøya" .Expands to:
https://model4powersystem.eu/NO/26cc8d71-...
TriG (UUID-based model)
@prefix cim: <https://cim.ucaiug.io/ns#> .
<urn:uuid:26cc8d71-12f1-4de9-9e68-125d95073a75>
a cim:PowerPlant ;
cim:name "Melkøya" .incorrect: TriG (UUID-based)
@prefix cim: <https://cim.ucaiug.io/ns#> .
@base <urn:uuid:> .
<26cc8d71-12f1-4de9-9e68-125d95073a75>
a cim:PowerPlant ;
cim:name "Melkøya" .