Skip to content

Commit

Permalink
Feature/new graph structure (#107)
Browse files Browse the repository at this point in the history
* New Importer implementation

* Packing of verteces

* Added event vertices and storing to db

* Edges (#105)

* add AT and CHILD_BUSINESS_LOCATION edges

* Added new XML files

* Edgeing

* fix event edges

* fix event categories

* add source and destination edges

* ignore location patterns

* add keys to edges

* ZK

* Added initialization of DB

* fix source/destination

* update importId, edge keys

* Added identifiers

* Removed unused code

* Importer unblocked after import

* add ZK to importer

* IDs trimmed

* Lint fixes

* fix zk

* Removed ignore pattern

* fix typo

* fix various importer related stuff

* Async mumbo jumbo fix

* fix zk

* fix update import

* Added import_id

* Import ID fix

* Lint fixes

* add batch->product edges

* added class edges

* methods removed

* Final fix

* test revision

* version correction
  • Loading branch information
Nebojša Obradović authored and schrink committed May 7, 2018
1 parent bfc09c8 commit f197b11
Show file tree
Hide file tree
Showing 13 changed files with 1,355 additions and 1,628 deletions.
143 changes: 143 additions & 0 deletions importers/Transformation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file for GS1 OriginTrail importer with Header with master data and ObjectEvent-->
<epcis:EPCISDocument xmlns:epcis="urn:epcglobal:epcis:xsd:1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sbdh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader" schemaVersion="0" creationDate="2001-12-17T09:30:47Z" xsi:schemaLocation="urn:epcglobal:epcis-masterdata:xsd:1 EPCglobal-epcis-masterdata-1_2.xsd">
<EPCISHeader>
<sbdh:StandardBusinessDocumentHeader>
<sbdh:HeaderVersion>1.0</sbdh:HeaderVersion>
<sbdh:Sender><!-- Mandatory -->
<!-- <sbdh:Identifier Authority="EAN.UCC">2203148000007</sbdh:Identifier> -->
<sbdh:Identifier Authority="OriginTrail">CARENGINES_PROVIDER_ID</sbdh:Identifier> <!-- Mandatory --> <!-- Creator PROVIDER_ID-->
<sbdh:ContactInformation> <!-- Mandatory-->
<sbdh:Contact>Mary Smith</sbdh:Contact> <!-- Mandatory -->
<sbdh:EmailAddress>[email protected]</sbdh:EmailAddress> <!-- Optional -->
</sbdh:ContactInformation>
</sbdh:Sender>
<sbdh:Receiver> <!-- Mandatory -->
<sbdh:Identifier Authority="OriginTrail">AIRTRANSPORT_PROVIDER_ID</sbdh:Identifier> <!-- Mandatory-->
<sbdh:ContactInformation> <!-- Mandatory-->
<sbdh:Contact>John Doe</sbdh:Contact> <!-- Mandatory -->
<sbdh:EmailAddress>[email protected]</sbdh:EmailAddress> <!-- Optional -->
</sbdh:ContactInformation>
</sbdh:Receiver>
<sbdh:DocumentIdentification> <!-- Mandatory-->
<sbdh:Standard>GS1</sbdh:Standard> <!-- WE CAN PUT OUR IMPORTER VERSION -->
<sbdh:TypeVersion>V1.3</sbdh:TypeVersion> <!-- Document version-->
<sbdh:InstanceIdentifier>100003</sbdh:InstanceIdentifier> <!-- UNIQUE IDENTIFIER OF DOCUMENT - PRIMARY KEY IN ERP -->
<sbdh:Type>Order</sbdh:Type> <!-- DEFINED IN SCHEMA Example; order, invoice, debitCreditAdvice -->
<sbdh:CreationDateAndTime>2003-05-09T00:31:52Z</sbdh:CreationDateAndTime> <!-- Optional -->
</sbdh:DocumentIdentification>
<sbdh:BusinessScope> <!-- Optional -->
<sbdh:Scope>
<sbdh:Type>BusinessProcess</sbdh:Type>
<sbdh:InstanceIdentifier>Order-Sell/version2-251</sbdh:InstanceIdentifier>
<sbdh:Identifier>EDI-Order-Sell</sbdh:Identifier>
</sbdh:Scope>
</sbdh:BusinessScope>
</sbdh:StandardBusinessDocumentHeader>
<extension>
<EPCISMasterData>
<VocabularyList>
<Vocabulary type="urn:ot:mda:actor">
<VocabularyElementList>
<VocabularyElement id="urn:ot:actor:id:Employee.Bob">
<attribute id="urn:ot:actor:person:id:name">Bob Johnson</attribute>
<attribute id="urn:ot:actor:category">Person</attribute>
</VocabularyElement>
</VocabularyElementList>
</Vocabulary>
<Vocabulary type="urn:ot:mda:product">
<VocabularyElementList>
<VocabularyElement id="urn:ot:mda:product:id:123AB">
<attribute id="urn:ot:mda:product:category">Engine</attribute>
<attribute id="urn:ot:mda:product:description">Airplane Engine for Boing</attribute>
</VocabularyElement>
<VocabularyElement id="urn:ot:mda:product:id:#1A">
<attribute id="urn:ot:mda:product:category">Transport Pallet</attribute>
<attribute id="urn:ot:mda:product:description">Pallet</attribute>
</VocabularyElement>
</VocabularyElementList>
</Vocabulary>
<Vocabulary type="urn:ot:mda:batch">
<VocabularyElementList>
<VocabularyElement id="urn:epc:id:sgtin:8635411.000333.00001">
<attribute id="urn:ot:mda:batch:productid">8635411.000333</attribute>
<attribute id="urn:ot:mda:batch:productiondate">2018-03-03T00:01:54Z</attribute>
<attribute id="urn:ot:mda:batch:expirationdate">2018-04-03T00:01:54Z</attribute>
</VocabularyElement>
<VocabularyElement id="urn:epc:id:sgtin:8635411.000333.00002">
<attribute id="urn:ot:mda:batch:productid">8635411.000333</attribute>
<attribute id="urn:ot:mda:batch:productiondate">2018-03-03T00:02:54Z</attribute>
<attribute id="urn:ot:mda:batch:expirationdate">2018-04-03T00:02:54Z</attribute>
</VocabularyElement>
<VocabularyElement id="urn:epc:id:sgtin:8635411.000333.00003">
<attribute id="urn:ot:mda:batch:productid">8635411.000333</attribute>
<attribute id="urn:ot:mda:batch:productiondate">2018-03-03T00:03:54Z</attribute>
<attribute id="urn:ot:mda:batch:expirationdate">2018-04-03T00:03:54Z</attribute>
</VocabularyElement>
<VocabularyElement id="urn:epc:id:sgtin:8635.737">
<attribute id="urn:ot:mda:batch:productid">8635</attribute>
<attribute id="urn:ot:mda:batch:productiondate">2018-03-03T00:03:54Z</attribute>
</VocabularyElement>
</VocabularyElementList>
</Vocabulary>
<Vocabulary type="urn:ot:mda:location">
<VocabularyElementList>
<VocabularyElement id="urn:ot:mda:location:Storage.F12">
<attribute id="urn:ot:mda:location:category">Physical location</attribute>
<attribute id="urn:ot:mda:location:description">Storage F12</attribute>
</VocabularyElement>
</VocabularyElementList>
</Vocabulary>
</VocabularyList>
</EPCISMasterData>
</extension>
</EPCISHeader>
<EPCISBody>
<EventList>
<extension>
<TransformationEvent>
<eventTime>2015-03-15T00:00:00.000-04:00</eventTime> <!-- Mandatory-->
<eventTimeZoneOffset>-04:00</eventTimeZoneOffset> <!-- Mandatory-->
<inputEPCList>
<epc>urn:epc:id:sgtin:8635411.000333.00001</epc>
<epc>urn:epc:id:sgtin:8635411.000333.00002</epc>
<epc>urn:epc:id:sgtin:8635411.000333.00003</epc>
</inputEPCList>
<inputQuantityList>
<quantityElement>
<epcClass>urn:epc:id:sgtin:8635411.000333.00001</epcClass>
<quantity>1.0</quantity>
<uom>PCS</uom>
</quantityElement>
<quantityElement>
<epcClass>urn:epc:id:sgtin:8635411.000333.00002</epcClass>
<quantity>1.0</quantity>
<uom>PCS</uom>
</quantityElement>
<quantityElement>
<epcClass>urn:epc:id:sgtin:8635411.000333.00001</epcClass>
<quantity>1.0</quantity>
<uom>PCS</uom>
</quantityElement>
</inputQuantityList>
<outputEPCList>
<epc>urn:epc:id:sgtin:8635.737</epc>
</outputEPCList>
<outputQuantityList>
<quantityElement>
<epcClass>urn:epc:id:sgtin:8635.737</epcClass>
<quantity>1</quantity>
<uom>PCS</uom>
</quantityElement>
</outputQuantityList>
<transformationID>BOM12345PO987</transformationID> <!-- Mandatory-->
<bizStep>urn:epcglobal:cbv:bizstep:creating_class_instance</bizStep> <!-- Optional -->
<extension>
<OTEventClass>ot:event:Transformation</OTEventClass>
<OTEventType>Packaging</OTEventType>
</extension>
</TransformationEvent>
</extension>
</EventList>
</EPCISBody>
</epcis:EPCISDocument>
251 changes: 251 additions & 0 deletions importers/Transport Ownership Observation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file for GS1 OriginTrail importer with Header with master data and ObjectEvent-->
<epcis:EPCISDocument xmlns:epcis="urn:epcglobal:epcis:xsd:1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sbdh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader" schemaVersion="0" creationDate="2001-12-17T09:30:47Z" xsi:schemaLocation="urn:epcglobal:epcis-masterdata:xsd:1 EPCglobal-epcis-masterdata-1_2.xsd">
<EPCISHeader>
<sbdh:StandardBusinessDocumentHeader>
<sbdh:HeaderVersion>1.0</sbdh:HeaderVersion>
<sbdh:Sender><!-- Mandatory -->
<!-- <sbdh:Identifier Authority="EAN.UCC">2203148000007</sbdh:Identifier> -->
<sbdh:Identifier Authority="OriginTrail">CARENGINES_PROVIDER_ID</sbdh:Identifier> <!-- Mandatory --> <!-- Creator PROVIDER_ID-->
<sbdh:ContactInformation> <!-- Mandatory-->
<sbdh:Contact>Mary Smith</sbdh:Contact> <!-- Mandatory -->
<sbdh:EmailAddress>[email protected]</sbdh:EmailAddress> <!-- Optional -->
</sbdh:ContactInformation>
</sbdh:Sender>
<sbdh:Receiver> <!-- Mandatory -->
<sbdh:Identifier Authority="OriginTrail">AIRTRANSPORT_PROVIDER_ID</sbdh:Identifier> <!-- Mandatory-->
<sbdh:ContactInformation> <!-- Mandatory-->
<sbdh:Contact>John Doe</sbdh:Contact> <!-- Mandatory -->
<sbdh:EmailAddress>[email protected]</sbdh:EmailAddress> <!-- Optional -->
</sbdh:ContactInformation>
</sbdh:Receiver>
<sbdh:DocumentIdentification> <!-- Mandatory-->
<sbdh:Standard>GS1</sbdh:Standard> <!-- WE CAN PUT OUR IMPORTER VERSION -->
<sbdh:TypeVersion>V1.3</sbdh:TypeVersion> <!-- Document version-->
<sbdh:InstanceIdentifier>100003</sbdh:InstanceIdentifier> <!-- UNIQUE IDENTIFIER OF DOCUMENT - PRIMARY KEY IN ERP -->
<sbdh:Type>Shipment</sbdh:Type> <!-- DEFINED IN SCHEMA Example; order, invoice, debitCreditAdvice -->
<sbdh:CreationDateAndTime>2003-07-09T00:31:52Z</sbdh:CreationDateAndTime> <!-- Optional -->
</sbdh:DocumentIdentification>
<sbdh:BusinessScope> <!-- Optional -->
<sbdh:Scope>
<sbdh:Type>BusinessProcess</sbdh:Type>
<sbdh:InstanceIdentifier>Shipment/version2-251</sbdh:InstanceIdentifier>
<sbdh:Identifier>EDI-Shipment</sbdh:Identifier>
</sbdh:Scope>
</sbdh:BusinessScope>
</sbdh:StandardBusinessDocumentHeader>
<extension>
<EPCISMasterData>
<VocabularyList>
<Vocabulary type="urn:ot:mda:actor">
<VocabularyElementList>
<VocabularyElement id="urn:ot:actor:id:AirplaneAB123">
<attribute id="urn:ot:actor:person:id:name">Boing AB-123</attribute>
<attribute id="urn:ot:actor:category">Machine</attribute>
</VocabularyElement>
</VocabularyElementList>
</Vocabulary>
<Vocabulary type="urn:ot:mda:product">
<VocabularyElementList>
<VocabularyElement id="urn:ot:mda:product:id:#1A">
<attribute id="urn:ot:mda:product:category">Transport Pallet</attribute>
<attribute id="urn:ot:mda:product:description">Pallet</attribute>
</VocabularyElement>
</VocabularyElementList>
</Vocabulary>
<Vocabulary type="urn:ot:mda:batch">
<VocabularyElementList>
<VocabularyElement id="urn:epc:id:sgtin:8635411.000333.00001">
<attribute id="urn:ot:mda:batch:productid">urn:ot:mda:product:id:#1A</attribute>
<attribute id="urn:ot:mda:batch:productiondate">2018-03-03T00:01:54Z</attribute>
<attribute id="urn:ot:mda:batch:expirationdate">2018-04-03T00:01:54Z</attribute>
</VocabularyElement>
<VocabularyElement id="urn:epc:id:sgtin:8635411.000333.00002">
<attribute id="urn:ot:mda:batch:productid">urn:ot:mda:product:id:#1A</attribute>
<attribute id="urn:ot:mda:batch:productiondate">2018-03-03T00:02:54Z</attribute>
<attribute id="urn:ot:mda:batch:expirationdate">2018-04-03T00:02:54Z</attribute>
</VocabularyElement>
<VocabularyElement id="urn:epc:id:sgtin:8635411.000333.00003">
<attribute id="urn:ot:mda:batch:productid">urn:ot:mda:product:id:#1A</attribute>
<attribute id="urn:ot:mda:batch:productiondate">2018-03-03T00:03:54Z</attribute>
<attribute id="urn:ot:mda:batch:expirationdate">2018-04-03T00:03:54Z</attribute>
</VocabularyElement>
<VocabularyElement id="urn:epc:id:sgtin:8635.737">
<attribute id="urn:ot:mda:batch:productid">urn:ot:mda:product:id:#1A</attribute>
<attribute id="urn:ot:mda:batch:productiondate">2018-03-03T00:03:54Z</attribute>
</VocabularyElement>
</VocabularyElementList>
</Vocabulary>
<Vocabulary type="urn:ot:mda:location">
<VocabularyElementList>
<VocabularyElement id="urn:ot:mda:location:Storage.F12">
<attribute id="urn:ot:mda:location:category">Physical location</attribute>
<attribute id="urn:ot:mda:location:description">Storage F12</attribute>
<children>
<id>urn:epc:id:sgln:6104898.16234.1</id>
<id>urn:epc:id:sgln:6104898.16234.2</id>
<id>urn:epc:id:sgln:6104898.16234.3</id>
</children>
</VocabularyElement>
<VocabularyElement id="urn:ot:mda:location:Storage.F13">
<attribute id="urn:ot:mda:location:category">Physical location</attribute>
<attribute id="urn:ot:mda:location:description">Storage F13</attribute>
<children>
<id>urn:epc:id:sgln:6104898.55555.1</id>
<id>urn:epc:id:sgln:6104898.55555.2</id>
<id>urn:epc:id:sgln:6104898.55555.3</id>
</children>
</VocabularyElement>
</VocabularyElementList>
</Vocabulary>
</VocabularyList>
</EPCISMasterData>
</extension>
</EPCISHeader>
<EPCISBody>
<EventList>
<ObjectEvent>
<!-- Transfer and Ownership -->
<eventTime>2015-04-16T00:00:00.000-04:00</eventTime> <!-- Mandatory-->
<eventTimeZoneOffset>-04:00</eventTimeZoneOffset> <!-- Mandatory-->
<epcList>
<epc>urn:epc:id:sgtin:8635411.000333.00001</epc>
</epcList>
<action>OBSERVE</action> <!-- Mandatory-->
<bizStep>urn:epcglobal:cbv:bizstep:shipping</bizStep> <!-- Optional -->
<disposition>urn:epcglobal:cbv:disp:active</disposition> <!-- Optional -->
<readPoint> <!-- Optional -->
<id>urn:ot:mda:location:Storage.F13</id>
</readPoint>
<bizLocation> <!-- Optional -->
<id>urn:ot:mda:location:Storage.F13</id>
</bizLocation>
<extension>
<quantityList> <!-- Optional -->
<quantityElement>
<epcClass>urn:epc:id:sgtin:8635411.000333.00001</epcClass>
<quantity>1.0</quantity>
<uom>PCS</uom>
</quantityElement>
</quantityList>
<extension>
<OTEventClass>ot:events:Transport</OTEventClass>
<OTEventClass>ot:events:Ownership</OTEventClass>
<OTEventType>Shipment</OTEventType>
<sourceList>
<source type="urn:epcglobal:cbv:sdt:owning_party">urn:epc:id:sgln:6104898.16234.1</source>
</sourceList>
<destinationList>
<destination type="urn:epcglobal:cbv:sdt:owning_party">urn:epc:id:sgln:6104898.55555.1</destination>
</destinationList>
</extension>
</extension>
</ObjectEvent>
<ObjectEvent>
<!-- Transport -->
<eventTime>2015-04-17T00:00:00.000-04:00</eventTime> <!-- Mandatory-->
<eventTimeZoneOffset>-04:00</eventTimeZoneOffset> <!-- Mandatory-->
<epcList>
<epc>urn:epc:id:sgtin:8635411.000333.00001</epc>
</epcList>
<action>OBSERVE</action> <!-- Mandatory-->
<bizStep>urn:epcglobal:cbv:bizstep:shipping</bizStep> <!-- Optional -->
<disposition>urn:epcglobal:cbv:disp:active</disposition> <!-- Optional -->
<readPoint> <!-- Optional -->
<id>urn:ot:mda:location:Storage.F13</id>
</readPoint>
<bizLocation> <!-- Optional -->
<id>urn:ot:mda:location:Storage.F13</id>
</bizLocation>
<extension>
<quantityList> <!-- Optional -->
<quantityElement>
<epcClass>urn:epc:id:sgtin:8635411.000333.00001</epcClass>
<quantity>1.0</quantity>
<uom>PCS</uom>
</quantityElement>
</quantityList>
<extension>
<OTEventClass>Transport</OTEventClass>
<OTEventType>Receipt</OTEventType>
<sourceList>
<source type="urn:epcglobal:cbv:sdt:owning_party">urn:epc:id:sgln:6104898.16234.1</source>
</sourceList>
<destinationList>
<destination type="urn:epcglobal:cbv:sdt:owning_party">urn:epc:id:sgln:6104898.55555.1</destination>
</destinationList>
</extension>
</extension>
</ObjectEvent>
<ObjectEvent>
<!-- Transport -->
<eventTime>2015-04-17T00:00:00.000-04:00</eventTime> <!-- Mandatory-->
<eventTimeZoneOffset>-04:00</eventTimeZoneOffset> <!-- Mandatory-->
<epcList>
<epc>urn:epc:id:sgtin:8635411.000333.00001</epc>
</epcList>
<action>OBSERVE</action> <!-- Mandatory-->
<bizStep>urn:epcglobal:cbv:bizstep:shipping</bizStep> <!-- Optional -->
<disposition>urn:epcglobal:cbv:disp:active</disposition> <!-- Optional -->
<readPoint> <!-- Optional -->
<id>urn:epc:id:sgln:6104898.55555.1</id>
</readPoint>
<bizLocation> <!-- Optional -->
<id>urn:ot:mda:location:Storage.F13</id>
</bizLocation>
<extension>
<quantityList> <!-- Optional -->
<quantityElement>
<epcClass>urn:epc:id:sgtin:8635411.000333.00001</epcClass>
<quantity>1.0</quantity>
<uom>PCS</uom>
</quantityElement>
</quantityList>
<extension>
<OTEventClass>ot:events:Ownership</OTEventClass>
<OTEventType>Receipt</OTEventType>
<sourceList>
<source type="urn:epcglobal:cbv:sdt:owning_party">urn:epc:id:sgln:6104898.16234.1</source>
</sourceList>
<destinationList>
<destination type="urn:epcglobal:cbv:sdt:owning_party">urn:epc:id:sgln:6104898.55555.1</destination>
</destinationList>
</extension>
</extension>
</ObjectEvent>
<ObjectEvent>
<!-- Observation -->
<eventTime>2015-04-16T00:00:00.000-04:00</eventTime> <!-- Mandatory-->
<eventTimeZoneOffset>-04:00</eventTimeZoneOffset> <!-- Mandatory-->
<epcList>
<epc>urn:epc:id:sgtin:8635411.000333.00001</epc>
</epcList>
<action>OBSERVE</action> <!-- Mandatory-->
<bizStep>urn:epcglobal:cbv:bizstep:shipping</bizStep> <!-- Optional -->
<disposition>urn:epcglobal:cbv:disp:active</disposition> <!-- Optional -->
<readPoint> <!-- Optional -->
<id>urn:epc:id:sgln:6104898.16234.3</id>
</readPoint>
<bizLocation> <!-- Optional -->
<id>urn:ot:mda:location:Storage.F13</id>
</bizLocation>
<extension>
<quantityList> <!-- Optional -->
<quantityElement>
<epcClass>urn:epc:id:sgtin:8635411.000333.00001</epcClass>
<quantity>1.0</quantity>
<uom>PCS</uom>
</quantityElement>
</quantityList>
<extension>
<OTEventClass>ot:events:Observation</OTEventClass>
<OTEventType>Measurment</OTEventType>
<!-- Custom Non-GS1 types -->
<Temperature> 12</Temperature>
<Humidity> 12</Humidity>
</extension>
</extension>
</ObjectEvent>
</EventList>
</EPCISBody>
</epcis:EPCISDocument>
Loading

0 comments on commit f197b11

Please sign in to comment.