uncefact / spec-jsonld

Exposing the UN/CEFACT vocabulary as web semantics
https://service.unece.org/trade/uncefact/vocabulary/uncefact/
13 stars 5 forks source link

Consider a live case study to demonstrate #19

Open cmsdroff opened 2 years ago

cmsdroff commented 2 years ago

Potential to implement some of the outcomes in open projects or work, for example BIC (Bureau International des Containers) https://github.com/bic-org have containers, container facilities and also BIC Code registrations which could be used to demonstrate a working example of the projects outputs.

nissimsan commented 2 years ago

@onthebreeze the UN traceability project could also be added

nissimsan commented 2 years ago

@cmsdroff , please action.

cmsdroff commented 2 years ago

Welcome some comments or a steer on the below, I've looked at schema.org, IATA and the UNCEFACT vocab and made a start at defining a shipping container which could be used by BIC for their container database, but also for industry to define a shipping container in the context of BIC.

We would need to link this to the CEFACT vocab for TransportEquipment see https://tinyurl.com/y8hu7emc and below as a start.

{
   "@context":{
      "@vocab":"http://vocab.bic-code.org#",
      "schema":"http://schema.org/",
      "uncefact":"https://service.unece.org/trade/uncefact/trade/uncefact/vocabulary/uncefact#"
   },
   "@graph":[
      {
         "@id":"bic:Container",
         "@type":"rdfs:Class",
         "rdfs:comment":"A Container is a reusable transport and storage unit for moving products and raw materials between locations or countries",
         "rdfs:label":"Container"
      }
   ],
   "Container":{
      "ContainerNumber":{
         "description":"Unique identifier for the container to the BIC Code holder",
         "type":"text"
      },
      "BicCode":{
         "description":"Registered code used to identify the owner of the container",
         "type":"text"
      },
      "CubicCapacity":{
         "description":"The maximum capacity of a container in Cubic Meters",
         "type":"float"
      },
      "ISOType":{
         "description":"The type of container as defined by ISO under ISO XXXX",
         "type":"string"
      },
      "MaxGrossMass":{
         "description":"The maximum gross mass of a container in Kilograms when laden",
         "type":"float"
      },
      "MaxPayload":{
         "description":"The maximum payload a container can hold in Kilograms",
         "type":"float"
      },
      "TareWeight":{
         "description":"The weight of the container when empty",
         "type":"float"
      }
   }
}

To be used like below ?

{
    "@context": "http://vocab.bic-code.org#",
    "@type": "Container",
    "BicCode": "NNCU",
    "ContainerNumber": "NNCU1000180",
    "CubicCapacity": 33.0,
    "ISOType": "20G1",
    "MaxGrossMass": 30480,  
    "MaxPayload": 28130,
    "TareWeight": 2280
}
cmsdroff commented 2 years ago

@cmsdroff , please action.

@nissimsan made a start!

nissimsan commented 2 years ago

Awesome, @cmsdroff !

The one thing I would ask before PR'ing this example would be to also include an actual un/cefact definition. You define the context, but don't use it. To be clear: it's perfectly cool to have bic definitions also. It serves a good purpose to have both contexts in the example. but without using cefact, it's not really a cefact example. :)

Here is the parsed graph:

<bic:Container> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <rdfs:Class> _:b0 .
<bic:Container> <rdfs:comment> "A Container is a reusable transport and storage unit for moving products and raw materials between locations or countries" _:b0 .
<bic:Container> <rdfs:label> "Container" _:b0 .
_:b0 <http://vocab.bic-code.org#container> _:b1 .
_:b1 <http://vocab.bic-code.org#BicCode> _:b2 .
_:b1 <http://vocab.bic-code.org#ContainerNumber> _:b3 .
_:b1 <http://vocab.bic-code.org#TareWeight> _:b4 .
_:b2 <http://vocab.bic-code.org#description> "Registered code used to identify the owner of the container" .
_:b2 <http://vocab.bic-code.org#type> "text" .
_:b3 <http://vocab.bic-code.org#description> "Unique identifier for the container to the BIC Code holder" .
_:b3 <http://vocab.bic-code.org#type> "text" .
_:b4 <http://vocab.bic-code.org#description> "The weight of the container when empty" .
cmsdroff commented 2 years ago

I plan to relate it to the TransportEquipment https://service.unece.org/trade/uncefact/vocabulary/uncefact/#TransportEquipment

the UN is of course multimodal and this is a specification of the transport equipment in relation to a 'Container'.

So maybe some equivalent or reference to, as opposed to a a transport document that references the json-ld.

VladimirAlexiev commented 2 years ago

@cmsdroff reaching out into BIC is an awesome idea, however the JSONLD is wrong. Always convert to turtle (or trig) to check your work.

Some brief observations (there may be more)

I think you'd be better off defining the ontology in turtle then converting to JSONLD.

Eg see https://github.com/gs1/EPCIS/tree/master/Ontology: EPCIS.ttl is an example, and https://github.com/gs1/EPCIS/tree/master/Ontology#conversion-to-jsonld describes how it's converted to EPCIS.jsonld.

https://github.com/gs1/EPCIS/blob/master/Ontology/EPCIS-CBV-context.jsonld is used in the conversion to make the JSONLD as nice as possible

cmsdroff commented 2 years ago

Great feedback @VladimirAlexiev is done the above by hand as I was learning but now looking at these suggestions and hope to have something revised inline for next meeting 👍

cmsdroff commented 2 years ago

Now I have looked into the suggestions from @VladimirAlexiev on how to approach this and we are about to close #105 imminently I think I can create some examples for facilities and link the the unlocode outputs from #105, aim to do this for next meeting

cmsdroff commented 2 years ago

DRAFT for discussion during tomorrows call @nissimsan tried to use the committed work on unlocodes #105 for a container facility and ocean terminal. I've based this on a Facility rather than container as in initial example.

Copy the below code into https://issemantic.net/rdf-visualizer

Not perfect by any means and im yet to convert to turtle for checking etc that's next 🤣

I linked to the UNLOCODE, Function, Subdivision and Country as below.

{
    "@context": [
        "https://schema.org",
        {"unlcdc": "https://service.unece.org/trade/uncefact/vocabulary/unlocode-countries/"},
        {"unlcds": "https://service.unece.org/trade/uncefact/vocabulary/unlocode-subdivisions/"},
        {"unlcd": "https://service.unece.org/trade/uncefact/vocabulary/unlocode/"},
        {"unlcdf": "https://service.unece.org/trade/uncefact/vocabulary/unlocode-functions/"}
    ],
    "@type": "ContainerFacility",
    "name": "HHLA CONTAINER TERMINAL ALTENWERDER (CTA)",
    "unlcdc":"DE",
    "unlcds":"HH",
    "unlcd":"DEHAM",
    "unlcdf": [1,2,3,4,5],
    "address": {
    "@type": "PostalAddress",
    "streetAddress": "Am Ballinkai 1",
    "addressLocality": "Hamburg",
    "postalCode": "21129",
    "addressCountry": "DE"
    },
    "geo": {
    "@type": "GeoCoordinates",
    "latitude": 53.509241285961544, 
    "longitude": 9.927578892050956
    },
    "url": "https://www.bic-code.org/facility-codes/GBLIVJMDA"     
}
cmsdroff commented 2 years ago

I’d probably omit the function and subdivision if publishing as the link to the unlocode would expose these but in think value in sharing county and maybe subdivision

cmsdroff commented 2 years ago

Revised but still WIP storing here for coming back to ahead of next call.

{
    "@context": [
        {"unlcd": "https://dmvc7xzscpizo.cloudfront.net/unlocode"},
        {"unlcdc": "https://dmvc7xzscpizo.cloudfront.net/unlocode-countries"},
        {"unlcds": "https://dmvc7xzscpizo.cloudfront.net/unlocode-subdivisions"},
        {"unlcdf": "https://dmvc7xzscpizo.cloudfront.net/unlocode-functions"},
        "https://schema.org"
    ],
    "@type": ["Place"],
    "name": "HHLA CONTAINER TERMINAL ALTENWERDER (CTA)",
    "unlcdc": "DE",
    "unlcd": {
        "@type": "unlcdv:UNLOCODE",
        "unlocode": "DEHAM",
        "countryCode":"DE"
        },
    "address": {
      "@type": "PostalAddress",
      "streetAddress": "Am Ballinkai 1",
      "addressCountry": "DE",
      "addressRegion": "Hamburg",
      "postalCode": "2119"
    },
    "geo": {
      "@type": "GeoCoordinates",
      "latitude": 53.509241285961544, 
      "longitude": 9.927578892050956
    },
    "url": "https://www.bic-code.org/facility-codes/GBLIVJMDA"     
}

Passes on schema validator where the old did not https://validator.schema.org

Points to resolve:

  1. The vocab url doesn't currently work and im looking for the property names in the unlcoode for example but calling via postman seems to time out for unlocode (https://dmvc7xzscpizo.cloudfront.net/unlocode-vocab) @kshychko is this me or is it a bug?
  2. Not sure if referencing the unlocode or country in the right way, moved schema.org to the bottom to resolve last Screenshot 2022-10-28 at 12 01 45
  3. look into custom type, its a container facility might be good to add a new type for terminal and container depot for example to the official types instead of defaulting to place - not related to this vocab, more linked data generally as shipping locations maybe useful.
kshychko commented 1 year ago

@cmsdroff , if you need to use the context files, we've got the following contexts published: https://dmvc7xzscpizo.cloudfront.net/unece-context.jsonld https://dmvc7xzscpizo.cloudfront.net/unlocode-vocab-context.jsonld

cmsdroff commented 1 year ago

Thanks to @nissimsan here's a working version which I'll put something in place for

{
    "@context": [
        "https://vocabulary.uncefact.org/unlocode-vocab-context.jsonld",
        "https://schema.org"
    ],
    "@type": ["Place"],
    "name": "HHLA CONTAINER TERMINAL ALTENWERDER (CTA)",
    "countryCode": "DE",
    "UNLOCODE": "DEHAM",
    "countryCode":"DE",
    "address": {
      "@type": "PostalAddress",
      "streetAddress": "Am Ballinkai 1",
      "addressCountry": "Germany",
      "addressRegion": "Hamburg",
      "postalCode": "2119"
    },
    "geo": {
      "@type": "GeoCoordinates",
      "latitude": 53.509241285961544, 
      "longitude": 9.927578892050956
    },
    "url": "https://www.bic-code.org/facility-codes/GBLIVJMDA"     
}