FIWARE / tutorials.Understanding-At-Context

:blue_book: FIWARE-LD 101: Understanding NGSI-LD `@context`
MIT License
8 stars 6 forks source link

Context Generator | FIWARE context URL does not work #10

Closed a39172 closed 1 year ago

a39172 commented 1 year ago

Possible issue

I think that the context URL associated with FIWARE - context.fiware = 'https://uri.fiware.org/ns/data-models#'; - in the file context-file-generator/bin/jsonld.js is outdated because it doesn't work.

Related question

Let me take this opportunity to ask this question: suppose I have a "Company" entity defined as follows in my OpenAPI specification:

Company:
      type: object
      allOf:
        - $ref: "https://smart-data-models.github.io/dataModel.Organization/Organization/model.yaml#/Organization"
        - $ref: "https://smart-data-models.github.io/data-models/schema.org.yaml#/ContactPoint"

In the context file generated with the above generator I end up with the following definition: "Company": "fiware:Company". In this case should I change the definition to "Company": "fiware:Organization" considering that the base model is called "Organization"?

jason-fox commented 1 year ago

I think that the context URL associated with FIWARE - context.fiware = 'https://uri.fiware.org/ns/data-models#'; - in the file context-file-generator/bin/jsonld.js is outdated because it doesn't work.

The reason behind that is because that is a URI, not a URL. Not all@context entries resolve to web-pages, and they don't have to, because primarily they are for machine readability not human readability. Sure https://schema.org/address gives a webpage, but https://purl.org/geojson/vocab#Point doesn't for example. As far as the @context is concerned both of these are valid. One is saying that this really is an address with sub-attributes like addressLocality and postalCode which have a well-defined semantic meaning, the other is saying this really is a well defined lump of GeoJSON which is defining a position on Earth using a specific coordinate system.

In the context file generated with the above generator I end up with the following definition: "Company": "fiware:Company". In this case should I change the definition to "Company": "fiware:Organization" considering that the base model is called "Organization"?

Probably yes. The question to answer is not what the simple tutorial tool generates, it is to define an agreed standard across your data-space saying "this attribute really means this" or "this entity really means this". If in your use case you have entities which hold the attributes from https://schema.org/Organization then use it - if you really mean the HI7 variant of https://github.com/smart-data-models/dataModel.Hl7/tree/master/Organization then use it. This allows inference across the dataspace with different data owners being able to do their own thing *internally whilst offering a common URI for attributes across the data space.

The prefix 'https://uri.fiware.org/ns/data-models#'; assumes that FIWARE are generating common data models for use across data spaces - we used to do that, but the initiative has been superseded by https://smartdatamodels.org/ which is a wider consortium. The tutorial @context generator generates a valid context, but you should always use the URIs and ontologies which are relevant for your use case (and share the definitions and @context across the organizations joining your data space of course)

a39172 commented 1 year ago

@jason-fox Out of curiosity, this URI works: https://uri.fiware.org/ns/dataModels. Thank you very much for the clarifications.