gs1 / EPCIS

Draft files being shared for EPCIS 2.0 development
Other
20 stars 7 forks source link

Adjust EPCIS-SHACL.ttl to accommodate EPCIS-JSON-Schema-single-event.json structure #126

Closed dakbhavesh closed 3 years ago

dakbhavesh commented 3 years ago

Hi @mgh128, While going through latest draft it struck me that we need to update the SHACL definition file to accommodate single event EPCIS JSON body structure.

mgh128 commented 3 years ago

Hi @dakbhavesh

Thanks for considering this. I'm not convinced that we do need to make an update to https://github.com/gs1/EPCIS/blob/master/JSON/EPCIS-SHACL.ttl

because it does not depend on a hierarchical ordering within EPCISDocument, EPCISBody etc.

The validation rules for ObjectEvent are expressed within epcis:ObjectEventShape which targets the class epcis:ObjectEvent (whether it appears in isolation as a single event or within a set of events)

Please see lines 33-61

epcis:ObjectEventShape a sh:NodeShape ; sh:targetClass epcis:ObjectEvent ; ...

Similar SHACL validation constraints are defined for each event type / subclass and should validate each event of that type, whether it appears as a single event or in a list of events.

dakbhavesh commented 3 years ago

Hi @mgh128, What confused me in current EPCIS-SHACL.ttl is presence of validations for epcisBody.eventList and that made me think that epcisBody.event should also be incorporated.

We can go with what you suggested, however we should guide users by describing somewhere either in draft or on documentation of SHACL file.

mgh128 commented 3 years ago

Hi @dakbhavesh

SHACL works differently from JSON Schema or XSD. So just because the same SHACL file includes validation rules for EPCISBody etc. , that is not a problem.

It uses targetClass to target specific Linked Data classes (such as ObjectEvent), whether they exist individually in isolation or nested somewhere within the hierarchy of an EPCISDocument.

SHACL and Linked Data have more of a flatter / random-access to data depending on the type of class, wherever it appears, so it's a much less hierarchical approach than you might have assumed.

You can also verify this using https://shacl.org/playground/

dakbhavesh commented 3 years ago

Hi @mgh128, May be its due to my lack of complete understanding of SHACL I was missing the point of validation in isolation is possible.

Thanks for making it clear.

Closing the issue.