uncefact / spec-jsonld

Exposing the UN/CEFACT vocabulary as web semantics
https://service.unece.org/trade/uncefact/vocabulary/uncefact/
13 stars 5 forks source link

How best to represent hierarchical code-lists? #101

Open onthebreeze opened 2 years ago

onthebreeze commented 2 years ago

Codes Like

Are essentially trees. Even though each code in the tree has a unique value - eg L1.L2.L3.L4. Whats the semantically correct way to represent these in JSON-LD? I can see two options

Semwodg commented 9 months ago

It is important to consider the parent/child structure, but thought is also required to consider how siblings under a parent are associated. For example: it may be safe to assume that siblings on a branch are disjointly associated. In that way each child on the branch can be used independently of siblings.

SKOS provides the tree structure, and delivers flexible pathways to nodes, including an approach to Disjointness. See: SKOS Reference - 8.6.9. Alternate Paths in the Hierarchical Relation

It gets interesting if/when an OWL representation is required, however even then using rdfs:subClassOf to denote a parent/child relationship takes place. Uniqueness is maintained in SKOS and OWL, so its about association and navigation I think. Structure can be retained and that may make sense from a maintenance viewpoint but also in the case where inferencing is desirable.

Either approach is valid, and if a "flat" list is required it can be generated from the structure.

Semwodg commented 9 months ago

I should mentioned, JSON LD exports from both SKOS and OWL using standard tools like most semantic platforms, Python, etc.