[Fiware-iot] NGSI v2 and JSON-LD

gilles.privat at orange.com gilles.privat at orange.com
Mon Nov 30 12:58:34 CET 2015


FYI if you don't follow this thread  this is a new comment I posted under
https://github.com/telefonicaid/fiware-orion/issues/1053

Backward compatibility of JSON-NGSIv1 with JSON-LD  could be ensured in a very minimal way by aliasing the @id and @type JSON-LD keywords
{
"@context"
{
     "id"="@id"
     "type"="@type"
  }

In the JSON-LD data model an NGSI entity  is  basically a JSON "node object" , restricted  however to having only  properties with value objects
if we use JSON-LD syntax, it is not necessary to define these properties as attributes, which adds an additional level of indirection. For backward compatibility, the levels of attributes and attribute domains could be kept but they would be ignored when parsing a legacy NGSI description to transform it in to JSON-LJ , attaching the individual attributes directly  to the entity as properties  with the corresponding types
taking an example form the Cepheus docs, this NGSI description

{ {

     "id": "Room31", // Room 1 on floor 3 (could be anything else)

     "type":"Room",  // all sensors must use the same "Room" type

     "attributes": [

        { "name":"temperature", "type":"double", "value":"21" }, // this is the value of the sensors

        { "name":"floor", "type":"string", "value":"3" } // the room is on the third foor

     ]

 }







could be interpreted directly as JSON-LD with a minimal  @context as defined above,







but it could be replaced by this generic JSON-LD description by removing the unnecessary "attribute" layer



{

     "@id": "Room31", // this local identifier must be mapped to an IRI in an context

     "@type":"Room",  // this node type must be defined in a domain specific @context





        { "temperature" : "21" }, // the temperature property must refer to a transversal  @context where it would be defined with an xsd numeric value type

        { "floor":"3" } // the floor property may be attached to the room node type and defined in a the same @context, with a string value type as its default



 }

What is, however,  much more important is the possibility to describe relationships between entities : this where we definitely have to go beyond the NGSIv1data model which is entity-centric and strictly hierarchical, to adopt a graph model, basically the RDF model that underlies JSON-LD : in this model we can describe node to node relationships as properties, and not only node to value relationships



From: PRIVAT Gilles IMT/OLPS
Sent: Wednesday, November 25, 2015 11:21 AM
To: 'fiware-iot at lists.fiware.org'
Subject: NGSI v2 and JSON-LD

Hello
There are ongoing discussions under orion on github about this important topic

https://github.com/telefonicaid/fiware-orion/issues/1516

https://github.com/telefonicaid/fiware-orion/issues/1053

This is of course important to all of us and not only to orion, I suggest you read these threads and intervene!

Personally I believe that JSON-LD is THE solution, not only to provide  semantic references and unique URIs for existing NGSI identifiers , but also to support extension of  the current NGSI data model, which is sorely limited : basically it is an entity-centric  arborescence  and we would need more of a graph-based model (à la RDF)  : this is what JSON-LD provides, making it possible to describe inter-entity links, which are needed to, among others, support  truly RESTful (HATEOAS) APIs


[http://www.francetelecom.com/sirius/logos_mail/orange_logo.gif]
Gilles Privat
Senior Scientist
Orange Labs, Grenoble
M2M, Internet of Things, Smart Cities
gilles.privat at orange.com<mailto:gilles.privat at orange.com>
office +33 4 38 42 86 16
mobile +33 6 71 17 64 60
http://research.orange.com/en/page-author/gilles-privat/
http://www.linkedin.com/in/gillesprivat
http://www.researchgate.net/profile/Gilles_Privat/

28 Chemin du Vieux Chêne
BP 98 38243 Meylan, France



_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.fiware.org/private/fiware-iot/attachments/20151130/accb4841/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 1264 bytes
Desc: image001.gif
URL: <https://lists.fiware.org/private/fiware-iot/attachments/20151130/accb4841/attachment.gif>


More information about the Fiware-iot mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy