3lbits / CIM4NoUtility

CIM for the Norwegian Power Utility
Creative Commons Attribution Share Alike 4.0 International
20 stars 7 forks source link

JSON-LD: richer context, network context #329

Open VladimirAlexiev opened 6 months ago

VladimirAlexiev commented 6 months ago

@Sveino

dcterms:title "DIGIN" . dcterms:title "CC BY-NC-SA 4.0" . dcterms:title "PUBLIC" . rdf:type dcat:Dataset ; ``` - [x] The reason for that lack is that you've mixed statements both at top level and inside `@graph` - [x] Use proper RDF software to produce JSON-LD. If you have correct RDF/XML, making correct JSON-LD with a proper software is a matter of crafting a good context, then picking appropriate options ("compact" with that context"). Eg in Java, the best is the `Titanium` library (but for simple JSON-LD 1.0, `jsonld-java` is faster). What did you use to make the defective JSON-LD? - [ ] A good context is crucial to produce good JSON-LD. The context I see merely defines prefixes. You should also define term `@type` (what is `@id`, what is `xsd:integer`, etc) - [ ] Use a network context, not an embedded one - [ ] This has numerous problems: The URL is double-quoted The URL doesn't resolve "CGMES" cannot possibly be a "spatial" resource Use `dct:` not `dcterms: Define "dct:spatial" in the context, then you can use the pure value in instance data ```json "dcterms:spatial": { "@id": "\"http://energy.referencedata.eu/CGMES\"" ``` - [ ] If it's important to preserve numeric values, then transfer them as string (with datatype defined in context). Eg `"cim:ACLineSegment.r": 0.015999999945951` can easily get converted to eg `1.5999999999e-2` depending on JSON implementation.
VladimirAlexiev commented 6 months ago

My mistake: --formatted ttl outputs only the default graph since Turtle doesn't carry named graphs. --formatted trig shows that the first 3 issues are ok (so I ticked the boxes).

I made a gist that shows how to implement "good context" and "preserve numeric values": https://gist.github.com/VladimirAlexiev/d691a9c66c348877d6c90420b52dec40