gs1 / EPCIS

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

Define inverse names of EPCIS properties #347

Open VladimirAlexiev opened 2 years ago

VladimirAlexiev commented 2 years ago

Inverse properties are redundant in RDF because SPARQL can always navigate in both directions no matter which direction is expressed by a property. (Eg by using an inverse property path: ?y ^epcis:prop ?x instead of ?x epcis:prop ?y.

So it's right that EPCIS does not define any inverses. However, defining the names of potential inverses is useful:

I'd suggest that EPCIS defines the inverse name of each property. I started this as a new col inverse name in the props gsheet using these guidelines:

To be emitted like this (penultimate line):

epcis:bizLocation  a      owl:ObjectProperty , rdf:Property ;
        rdfs:comment      "(Optional) The business location where the objects associated with the EPCs may be found, until contradicted by a subsequent event."@en ;
        rdfs:domain       epcis:EPCISEvent ;
        schema:domainIncludes epcis:EPCISEvent ;
        rdfs:isDefinedBy  epcis: ;
        rdfs:label        "bizLocation"@en ;
        rdfs:range        gs1:Place ;
        schema:rangeIncludes gs1:Place ;
        prov:inverse      "eventWithBizLocation";
        sw:term_status    "stable" .
mgh128 commented 2 years ago

I took a look at https://www.w3.org/TR/prov-o/#inverse-names and at column D of https://docs.google.com/spreadsheets/d/19lseUd1kHiz48VNtrHXy6kafLTlNzS1GsaYiBqdT4UA/edit#gid=138789609 - but as column D currently stands (and as you note above), it's not sufficient, since it shows epcis:bizStep and epcis:errorDeclaration sharing the same inverse name. Since these clearly would not share the same inverse property (because that would imply that they're equivalent properties), the inverse names need to be distinct.

I think we need a stronger justification for this and strong support from the group before we add this.

VladimirAlexiev commented 2 years ago

I prefer simpler names when accessing "virtual inverses" (denoted ..> below):

Event   --> bizStep --> BizStep
BizStep ..> event   ..> Event

because that makes for nicer "symmetric" GraphQL queries, eg

event {bizStep}
bizStep {event}

which is similar to how the JSON API works.

But you're right that if people want to use these names for actual inverses then the names should be distinct:

Event   --> bizStep           --> BizStep
BizStep ..> eventsWithBizStep ..> Event