openepcis / openepcis-models

EPCIS 2.0 Java Models
https://openepcis.io
Apache License 2.0
0 stars 2 forks source link

EPCISEvent is not processing contextInfo ("@context") #41

Closed ricardosardinha closed 3 months ago

ricardosardinha commented 5 months ago

If we have a json EPCISEvent with property "@context" the instance of EPCISEvent will have contextInfo=null

json

 {
        "@context": [
             "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld"
        ],
        "eventID": "ni:///sha-256;1f7c472bc4905de27a19b2efc8e4a9c6dc195139669b80b515f12218ff07cf65?ver=CBV2.0",
        "type": "AssociationEvent",
        "eventTime": "2019-11-06T14:00:00.000+01:00",
        "recordTime": "2019-11-06T14:05:00.000+01:00",
        "eventTimeZoneOffset": "+01:00",
        "parentID": "urn:epc:id:grai:4012345.55555.98765",
        "childEPCs": [
          "urn:epc:id:giai:4000001.12345",
          "urn:epc:id:giai:4000001.12346"
        ],
        "childQuantityList": [
          {
            "epcClass": "urn:epc:class:lgtin:4023333.002000.998877",
            "quantity": 4
          }
        ],
        "action": "ADD",
        "bizStep": "installing",
        "disposition": "in_progress",
        "readPoint": {
          "id": "urn:epc:id:sgln:4012345.00001.0"
        },
        "bizLocation": {
          "id": "urn:epc:id:sgln:4012345.00002.0"
        },
        "bizTransactionList": [
          {
            "type": "inv",
            "bizTransaction": "urn:epcglobal:cbv:bt:4023333000000:54545"
          }
        ],
        "sourceList": [
          {
            "type": "possessing_party",
            "source": "urn:epc:id:pgln:4000001.00012"
          }
        ],
        "destinationList": [
          {
            "type": "possessing_party",
            "destination": "urn:epc:id:pgln:4012345.00000"
          }
        ],
        "sensorElementList": [
          {
            "sensorMetadata": {
              "startTime": "2019-11-06T13:55:00.000+01:00",
              "endTime": "2019-11-06T13:57:00.000+01:00"
            },
            "sensorReport": [
              {
                "type": "AbsoluteHumidity",
                "minValue": 12.1,
                "maxValue": 12.2,
                "uom": "A93"
              }
            ]
          }
        ]
      }
Aravinda93 commented 4 months ago

@ricardosardinha

Thanks a lot for reaching out to us regarding the clarification. Since you have just the default EPCIS @context https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld, we do not store them in the contextInfo as a result you are getting it as contextInfo=null. However, if you have a document with additional contexts such as:

{
  "@context": [
    "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld",
    {
      "ex3": "https://ex3.com"
    },
    {
      "ex1": "https://ex1.com"
    }
  ],
  "type": "ObjectEvent",
  "eventTime": "2024-05-24T16:58:56+02:00",
  "eventTimeZoneOffset": "+02:00",
  "epcList": [
    "https://id.gs1.org/01/09526512345671/21/100",
    "https://id.gs1.org/01/09526512345671/21/101"
  ],
  "action": "ADD",
  "bizStep": "commissioning",
  "disposition": "active",
  "ex1:propOne": "value-1",
  "ex3:propTwo": "Value-2"
}

In this case, we do store the additional context information as a Map {https://ex3.com=ex3, https://ex1.com=ex1} but we store them within our DefaultJsonSchemaNamespaceURIResolver.class where we can differentiate between the event and document level namespaces.