RalphTro / epcis-event-hash-generator

ALGORITHM and SOFTWARE PROTOTYPE to uniquely identify/validate the integrity of any EPCIS event through a common, syntax-agnostic approach based on hashing. Takes an EPCIS Document (formatted in either XML or JSON-LD) and returns the corresponding hash value(s).
MIT License
8 stars 4 forks source link

Added XML/JSON-LD example with component #67

Closed RalphTro closed 1 year ago

Echsecutor commented 2 years ago
Echsecutor commented 1 year ago

reviewed together with @RalphTro

Echsecutor commented 1 year ago

blocked by https://github.com/RalphTro/epcis-event-hash-generator/issues/78

dakbhavesh commented 1 year ago

Hi @RalphTro, I have rebased this PRs branch onto the master to resolve merge conflicts. You now may be able to relook at your changes and failing test cases. Please let me know if they are caused by any recent changes merged to the master.

RalphTro commented 1 year ago

Bhavesh kindly having a look at unit tests (why they are failing right now).

dakbhavesh commented 1 year ago

Dear @RalphTro / @Echsecutor,

I checked the version of the GTIN module i.e. 0.1.13. I replaced it with the latest available version i.e. 1.3.1649173518 however it did not fix the issue. It is still generating the wrong canonicalized URL for sscc identifier.

Is it possible to reach out to David Belais the author of GTIN module for an investigation of the issue?

Module Link: https://pypi.org/project/gtin/0.1.13/

dakbhavesh commented 1 year ago

Dear @RalphTro , I see there are multiple independent changes in this PR so to make progress I am going to split this PR into parts so that we can keep the problematic part in isolation and debug it in better way.

Here is the PR for fixing JSON-LD context URLs. It is straight forward and all tests are passing so please review and merge if it looks good to you.

Thanks, Bhavesh

dakbhavesh commented 1 year ago

Dear @RalphTro ,

I studied the examples tests/examples/epcisDocWithSensorComponent.jsonld & tests/examples/epcisDocWithSensorComponent.xml to be able to raise a separate PR.

I have the following observations which I thought to confirm with you:

  1. Are we missing cbv and gs1 context declaration in jsonld example? If not, then how can we expland the following elements

"type": "Angle" -> to be expanded to https://gs1.org/voc/Angle "component": "Latitude" -> to be expanded to https://ref.gs1.org/cbv/Lattitude

I believe, the following entries will be needed in JSON-LD context

    {
      "cbv": "https://ref.gs1.org/cbv/"
    },
    {
      "gs1": "https://gs1.org/voc/"
    }
  1. The component values have slight differences in XML vs JSONLD examples

XML -> component="cbv:Comp-longitude" JSON-LD -> "component": "Latitude"

Is it safe to assume that we should make the case insensitive expansion to the above values (XML & JSONLD) as follows?

https://ref.gs1.org/cbv/lattitude

  1. It Looks like there is a typo in the prehash

as is: component=https://gs1.org/voc/Latitude to be: component=https://ref.gs1.org/cbv/latitude

Clarification of the above will help me prepare a separate PR for this example.

Thanks, Bhavesh

dakbhavesh commented 1 year ago

Dear @RalphTro, I have raised PR#92 as a reference for my previous comment.

Looking forward to your views, Bhavesh

RalphTro commented 1 year ago

Dear @dakbhavesh , Many thanks for looking into this!

As to 1: You are correct. In such a case, both entries need to become part of the JSON-LD context.

As to 2 and 3: I had a conversation about this with Mark some time ago, as there is a discrepancy between what is currently specified in the CBV and the EPCIC/CBV linked data model (-> was added to our to-do list).

In this sense, what is correct is how it is specified in the EPCIS/CBV linked data model, i.e. e.g. "https://ref.gs1.org/cbv/Comp-latitude"

Therefore, as to "Is it safe to assume that we should make the case insensitive expansion to the above values (XML & JSONLD) as follows? https://ref.gs1.org/cbv/lattitude" - it should be https://ref.gs1.org/cbv/Comp-latitude in both options.

Similarly, values such as gs1:Angle or Angle should be canonicalised to https://www.gs1.org/voc/Angle (similar to e.g. https://www.gs1.org/voc/Temperature)

dakbhavesh commented 1 year ago

Dear @RalphTro, Can we close this PR (no need to merge .. just close it ;) ) as the changes are already incorporated in PRs #91 & #92? Let me know if I have overlooked any changes to be incorporated in the main.

RalphTro commented 1 year ago

Sounds good, @dakbhavesh !

And once again - thanks a lot for your support!