Informatievlaanderen / OSLOthema-airAndWater

OSLO thema repository die documenten bevat met betrekking tot de standaard Air & Water
1 stars 1 forks source link

ngsi-ld #9

Open gezever opened 3 years ago

gezever commented 3 years ago

Hello, I tried to transform the piece of ngsi-ld, presented in the workshop, to another type of rdf. I used jena riot, but there was an error. tmp$ /opt/apache-jena-3.14.0/bin/riot --output=TURTLE test.json 15:00:47 ERROR riot :: [line: 2, col: 11] Expected BNode or IRI: Got: [STRING:urn:ngsi-ld:AirQualityObserved:RZ:Obsv4567]

My question is now: is this file realy rdf or is my software not compatible yet? (since we use apache jena in java for production backend code)

tmp$ cat test.json { "id": "urn:ngsi-ld:AirQualityObserved:RZ:Obsv4567", "type": "AirQualityObserved", "dateObserved": { "type": "Property", "value": { "@type": "DateTime", "@value": "2018-08-07T12:00:00Z" } }, "NO2": { "type": "Property", "value": 22, "unitCode": "GP" }, "refPointOfInterest": { "type": "Relationship", "object": "urn:ngsi-ld:PointOfInterest:RZ:MainSquare" }, "@context": [ "https://schema.lab.fiware.org/ld/context", "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" ] }

Kind regards

bertvannuffelen commented 3 years ago

It seems that "https://schema.lab.fiware.org/ld/context" has not enabled CORS. When removing that the json-ld playground returns triples.

<urn:ngsi-ld:AirQualityObserved:RZ:Obsv4567> <https://uri.etsi.org/ngsi-ld/default-context/NO2> _:b0 .
<urn:ngsi-ld:AirQualityObserved:RZ:Obsv4567> <https://uri.etsi.org/ngsi-ld/default-context/dateObserved> _:b1 .
<urn:ngsi-ld:AirQualityObserved:RZ:Obsv4567> <https://uri.etsi.org/ngsi-ld/default-context/refPointOfInterest> _:b2 .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://uri.etsi.org/ngsi-ld/Property> .
_:b0 <https://uri.etsi.org/ngsi-ld/hasValue> "22"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b0 <https://uri.etsi.org/ngsi-ld/unitCode> "GP" .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://uri.etsi.org/ngsi-ld/Property> .
_:b1 <https://uri.etsi.org/ngsi-ld/hasValue> "2018-08-07T12:00:00Z"^^<https://uri.etsi.org/ngsi-ld/DateTime> .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://uri.etsi.org/ngsi-ld/Relationship> .
_:b2 <https://uri.etsi.org/ngsi-ld/hasObject> <urn:ngsi-ld:PointOfInterest:RZ:MainSquare> .

So I think you hit a json-ld bug in riot. Or the Firware context contains additional transformations which are not spotted by this simple test.

flopezag commented 3 years ago

I suggest to use the context: https://smartdatamodels.org/context.jsonld

We made the migration of the previous context to this new one and we resolved some issues regarding JSON-LD format.