Skip to content
This repository has been archived by the owner on Oct 21, 2021. It is now read-only.

EPCIS Transformation

Josh Horton edited this page Feb 21, 2020 · 2 revisions

EPCIS Transformation (Transformation Event)

This page describes the XML to JSON mappings for a transformation (Transformation Event).

Note: ILMD (Instance/Lot Master Data) also generates (layer: 'object', label: 'lotILMD')

GS1 to JSON mapping

This section shows the GS1 XML to JSON mappings. JSON keys are on the left, and the XPaths to the corresponding tag in GS1 XML are on the right, separated by a colon character (:).

// Context Node: epcis:EPCISDocument
{

"assetIdUri": "urn:ibm:provenance:asset:transaction:order:<string>:default:default:<string>",
"organization": "<string>",
"layer": "event",
"label": "transformation",
"data":

{
  "eventID" : "baseExtension/eventID",
  "eventTime" : "eventTime",
  "generationInfo" : {
    "isConnectorGenerated" : "true | false",
    "generatedFromEventID" : ""
  },
  "recordTime" : "",
  "eventTimeZoneOffset": "eventTimeZoneOffset",
  // Context Node: epcList
  "inputEpcList" : [
    "epc": "epc",
    ...
  ],
  // Context Node: inputQuantityList/quantityElement
  "inputQuantityList" : [
    {
      "epcClass" : "epcClass",
      "quantity" : "quantity",
      "uom" : "uom",
    },
    ...
  ],
    "inputGTINList": [
        ""
    ],
  // Context Node: outputQuantityList/quantityElement
  "outputQuantityList" : [
    {
      "epcClass" : "epcClass",
      "quantity" : "quantity",
      "uom" : "uom",
    },
    ...
  ],
    "outputGTINList": [
        ""
    ],
  // Context Node: Flat list of all epcs in event. Union of epcList and quantityList.epcClass.
  "flatEPCList" : [
    ":epcClass",
    ...
  ],
  "flatGTINList" : [
    "",
    ...
  ],
  "action" : "ADD",
  "bizStep" : "bizStep",
  "disposition" : "disposition",
  "readPoint" : "readpoint/id",
  "bizLocation" : "bizLocation/id",
  // Context Node: extension/sourceList
  "sourceList" : [
    {
      "type" : "source/@type",
      "source" : "source"
    },
    ...
  ],
  // Context Node: extension/destinationList
  "destinationList" : [
    {
      "type" : "destination/@type",
      "destination" : "destination",
    },
    ...
  ],
  // Context Node: bizTransactionList
  "bizTransactionList" : [
    {
      "type" : "bizTransaction/@type",
      "bizTransaction" : "bizTransaction"
    },
    ...
  ]
}

Input

The following example shows a valid GS1 XML file for input. The JSON output follows.

Note: The following fields have been removed for GDPR compliance:

  1. StandardBusinessDocumentHeader.Sender.ContactInformation (all sub-elements)
  2. StandardBusinessDocumentHeader.Receiver.ContactInformation (all sub-elements)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><epcis:EPCISDocument xmlns:epcis="urn:epcglobal:epcis:xsd:1" xmlns:cbvmda="urn:epcglobal:cbv:mda" xmlns:example="http://ns.example.com/epcis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" creationDate="2005-07-11T11:30:47.0Z" schemaVersion="1.2">

<EPCISBody>
  <EventList>
    <extension>
      <TransformationEvent>
        <eventTime>2015-03-15T00:00:00.000-04:00</eventTime>
        <eventTimeZoneOffset>-04:00</eventTimeZoneOffset>
        <baseExtension>
          <eventID>xyz</eventID>
        </baseExtension>
        <inputEPCList />
        <inputQuantityList>
          <quantityElement>
            <epcClass>urn:epc:class:lgtin:string.string.string</epcClass>
            <quantity>300.0</quantity>
            <uom>KGM</uom>
          </quantityElement>
        </inputQuantityList>

        <outputQuantityList>
          <quantityElement>
            <epcClass>urn:epc:class:lgtin:string.string.string</epcClass>
            <quantity>100.0</quantity>
            <uom>KGM</uom>
          </quantityElement>
        </outputQuantityList>
        <bizStep>urn:epcglobal:cbv:bizstep:commissioning</bizStep>
        <disposition>urn:epcglobal:cbv:disp:active</disposition>
        <readPoint>
          <id>  urn:epc:id:sgln:string.string.string</id>
        </readPoint>
        <bizLocation>
          <id>  urn:epc:id:sgln:string.string.integer</id>
        </bizLocation>
        <bizTransactionList>
          <bizTransaction type="urn:epcglobal:cbv:btt:prodorder">urn:epcglobal:cbv:bt:string:string
          </bizTransaction>
        </bizTransactionList>
        <extension>
          <ilmd>
            <cbvmda:itemExpirationDate>2015-03-15</cbvmda:itemExpirationDate>
            <cbvmda:bestBeforeDate>2015-03-15</cbvmda:bestBeforeDate >
            <cbvmda:sellByDate>2015-03-15</cbvmda:sellByDate>
          </ilmd>
          <sourceList>
        <source type="urn:epcglobal:cbv:sdt:owning_party">urn:epc:id:sgln:string.string.integer</source>
          </sourceList>
          <destinationList>
        <destination type="urn:epcglobal:cbv:sdt:owning_party">urn:epc:id:sgln:string.string.integer</destination>
          </destinationList>
        </extension>
      </TransformationEvent>
    </extension>
  </EventList>
</EPCISBody></epcis:EPCISDocument>

Output

The following example shows the JSON output from the input GS1 XML file above.

This is the generated URN:

{
  "urn": "urn:ibm:provenance:asset:event:transformation:security_disabled:default:default:dXJuOmVwYzppZDpzZ2xuOjA2MTQxNDEuMDAwMDEuMA=="
}

This is the generated JSON:

{
    "eventTime": "2015-03-15T00:00:00.000-04:00",
    "eventTimeZoneOffset": "-04:00",
    "eventID": "xyz",
    "inputEPCList": [],
    "inputQuantityList": [
        {
            "epcClass": "urn:epc:class:lgtin:string.string.string",
            "quantity": "300.0",
            "quantity_uom": "KGM"
        }
    ],
    "inputGTINList": [
        "0614141.02222"
    ],
    "outputQuantityList": [
        {
            "epcClass": "urn:epc:class:lgtin:string.string.string",
            "quantity": "100.0",
            "quantity_uom": "KGM"
        }
    ],
    "outputGTINList": [
        "0614141.04444"
    ],
    "bizStep": "urn:epåçcglobal:cbv:bizstep:commissioning",
    "disposition": "urn:epcglobal:cbv:disp:active",
    "readPoint": "  urn:epc:id:sgln:string.string.string",
    "bizLocation": "  urn:epc:id:sgln:string.string.integer",
    "bizTransactionList": [
        {
            "bizTransaction": "urn:epcglobal:cbv:bt:string:string",
            "type": "urn:epcglobal:cbv:btt:prodorder"
        }
    ],
    "sourceList": [
        {
            "source": "urn:epc:id:sgln:string.string.integer",
            "type": "urn:epcglobal:cbv:sdt:owning_party"
        }
    ],
    "destinationList": [
        {
            "destination": "urn:epc:id:sgln:string.string.integer",
            "type": "urn:epcglobal:cbv:sdt:owning_party"
        }
    ],
    "flatEPCList": [
        "string.string.string",
        "string.string.string"
    ],
    "flatGTINList": [
        "string.string",
        "string.string"
    ]
}
}
Clone this wiki locally