gs1 / EPCIS

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

Consider standard JSON idiom terms for type and id #172

Closed jmcanterafonseca-iota closed 2 years ago

jmcanterafonseca-iota commented 3 years ago

With JSON-LD 1.1 protected @context and local contexts there is no need to alias "@type" into "isA". Also eventID could be just id thus having a more idiomatic JSON / JSON-LD :

   {
     "@context": ["https://ns.gs1.org/2021/epcis/v2"],
     "id": "htttps://example.org/eventsA34HJJ",
     "type": "ObjectEvent",
     "epcList": ["urn:epc:id:sgtin:xxxxxxx"],
     "bizStep": "shipping",
     "disposition": "in_progress"
   }
mgh128 commented 3 years ago

Regarding eventID, that field is already present in v1.2 and the XSD schema for the XML data binding, so I don't think we can simply replace eventID with id. However, we'll check what can be done to make better use of JSON-LD v1.1 features.

mgh128 commented 3 years ago

Regarding type vs our current isA alias, the problem was that within the v1.2 XSD schema, we already used the type property within each element of a sourceList, destinationList or bizTransactionList

If we can locally scope the type that appears within elements of sourceList, destinationList or bizTransactionList to map to https://ns.gs1.org/epcis/type while the type that declares the event type maps to @type, then we can achieve the simplification you suggest and eliminate the isA alias for @type. Feel free to submit a pull request for https://github.com/gs1/EPCIS/blob/master/epcis-context.jsonld . I'll also make some tests.

mgh128 commented 3 years ago

I've done some testing of locally scoped @context within sourceList, destinationList and bizTransactionList - now created a file https://github.com/gs1/EPCIS/blob/master/epcis-context-protected.jsonld

This would allow us to replace all isA aliases of @type with type throughout all examples. Needs some group discussion on Tuesday.

jmcanterafonseca-iota commented 3 years ago

great, thank you!

On Sun, Feb 14, 2021 at 3:54 PM Mark Harrison notifications@github.com wrote:

I've done some testing of locally scoped @context https://github.com/context within sourceList, destinationList and bizTransactionList - now created a file https://github.com/gs1/EPCIS/blob/master/epcis-context-protected.jsonld

This would allow us to replace all 'isA' aliases of @type https://github.com/type with 'type' throughout all examples. Needs some group discussion on Tuesday.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gs1/EPCIS/issues/172#issuecomment-778788912, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQEZJLVRYXLRBN5UHOQMPKTS67PYXANCNFSM4XRE3YVQ .

-- IOTA Foundation c/o Nextland Strassburgerstraße 55 10405 Berlin, Germany

Board of Directors: Dominik Schiener, Serguei Popov, Navin Ramachandran ID/Foundation No.: 3416/1234/2 (Foundation Register of Berlin)

VladimirAlexiev commented 3 years ago

I agree with @jmcanterafonseca-iota that:

However, IMHO it'd be too disruptive to change the spec, all JSON examples and the JSON schema. So IMHO the syntactic goodness is not worth the effort to change.

PS: we already have Meta-properties to account for these non-idiomatic JSON keys (in EPCIS.ttl):

epcis:jsonldLabel a owl:DatatypeProperty , rdf:Property ;
      rdfs:comment      """JSONLD term (alias) used for this property.
The default is the property local name, which is captured in rdfs:label."""@en ;
      rdfs:domain       rdf:Property;
      schema:domainIncludes rdf:Property ;
      rdfs:isDefinedBy  epcis: ;
      rdfs:label        "jsonldLabel" ;
      rdfs:range        xsd:string ;
      schema:rangeIncludes xsd:string ;
      sw:term_status    "stable" .

rdf:type epcis:jsonldLabel "isA".

epcis:jsonldUriLabel a owl:DatatypeProperty , rdf:Property ;
      rdfs:comment      """JSONLD term (alias) used for the URI of nodes of this class.
There is no default: many EPCIS classes use blank nodes instead of the standard @id JSONLD term."""@en ;
      rdfs:domain       rdfs:Class;  <<<< mistake, was rdf:Property ;
      schema:domainIncludes rdfs:Class; <<<< mistake, was rdf:Property ;
      rdfs:isDefinedBy  epcis: ;
      rdfs:label        "jsonldUriLabel" ;  <<<< mistake, was "jsonldLabel"
      rdfs:range        xsd:string ;
      schema:rangeIncludes xsd:string ;
      sw:term_status    "stable" .

@mgh128 could you fix the <<<< mistakes above

jmcanterafonseca-iota commented 2 years ago

I think this can be closed. We are now using type instead of isA .

VladimirAlexiev commented 2 years ago

@mgh128 Ontology/EPCIS.ttl still has this bug: epcis:jsonldUriLabel rdfs:domain rdf:Property; should be rdfs:Class

mgh128 commented 2 years ago

Thanks - fixed now, also in Ontology/EPCIS.jsonld