edi3 / edi3-json-ld-ndr

GNU General Public License v3.0
0 stars 2 forks source link

add @id and @type to the codelist files #46

Open onthebreeze opened 3 years ago

onthebreeze commented 3 years ago

It would be helpful to add @id and @type atttributes to the codelist files - so, for example

https://edi3.org/vocabulary/rec20.jsonld

{
@context: {
unece: "https://service.unece.org/trade/uncefact/vocabulary/unece#",
uncl4237: "https://service.unece.org/trade/uncefact/vocabulary/uncl4237#",
rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
rdfs: "http://www.w3.org/2000/01/rdf-schema#"
},
@graph: [
{
@id: "uncl4237:Payable_elsewhere",
@type: "unece:UNECECL4237Code",
rdfs:comment: "Responsibility for payment of transport charges unknown at time of departure.",
rdf:value: "A"
},
etc..
]}

becomes

{
@context: {
unece: "https://service.unece.org/trade/uncefact/vocabulary/unece#",
uncl4237: "https://service.unece.org/trade/uncefact/vocabulary/uncl4237#",
rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
rdfs: "http://www.w3.org/2000/01/rdf-schema#",
@id:"https://edi3.org/vocabulary/uncl4237.jsonld,
@types:"unece:Codelist"
},
@graph: [
{
@id: "uncl4237:Payable_elsewhere",
@type: "unece:UNECECL4237Code",
rdfs:comment: "Responsibility for payment of transport charges unknown at time of departure.",
rdf:value: "A"
},
etc..
]}

so that processors can uniquely identify the codelist ID and also know that they are processing a codelist.

Fak3 commented 2 years ago

This can be done with named graphs:

{
  "@context": { ... },
  "@id": "https://service.unece.org/trade/uncefact/vocabulary/rec21",
  "@type": "unece:Codelist",
  "generatedAt": "2012-04-09T00:00:00",
  "@graph": [ {}, {}, ... ]
}