eclipse-thingweb / playground

Browser or Node.js based tool for validating and playing with W3C Thing Descriptions
https://playground.thingweb.io/
Other
28 stars 22 forks source link

TD missing namespace but still passes the validations on JSON-LD and TD/OWL #14

Open danhlephuoc opened 6 years ago

danhlephuoc commented 6 years ago

Following TD from Fujitsu does not define the namespace {"iot": "http://iotschema.org/"} for iot:Temperature, iot:Humidity, etc, but it passes all validations in http://plugfest.thingweb.io/playground/

{ "@context": ["https://w3c.github.io/wot/w3c-wot-td-context.jsonld"], "@type": "Thing", "name": "Fujitsu-WiFiAgent240AC4114764", "id": "urn:dev:wot:com:fujitsu:wifiagent", "base" : "http://192.168.1.21/Things/Property/", "properties": { "Temperature": { "@type": "iot:Temperature", "type": "object", "properties": { "temperature":{"type":"number"}, "rssi":{"type":"number"} }, "writable": false, "observable": false, "forms": [{ "href" : "temperature", "mediaType": "application/json" }] }, "Humidity": { "@type": "iot:Humidity", "type": "object", "properties": { "humidity":{"type":"number"}, "rssi":{"type":"number"} }, "writable": false, "observable": false, "forms": [{ "href" : "humidity", "mediaType": "application/json" }] }, "AirPressure": { "@type": "iot:AirPressure", "type": "object", "properties": { "airPressure":{"type":"number"}, "rssi":{"type":"number"} }, "writable": false, "observable": false, "forms": [{ "href" : "airPressure", "mediaType": "application/json" }] }, "Dust": { "@type": "iot:Dust", "type": "object", "properties": { "dust":{"type":"number"}, "rssi":{"type":"number"} }, "writable": false, "observable": false, "forms": [{ "href" : "dust", "mediaType": "application/json" }] }, "AllSensorData": { "@type":"iot:AllSensor", "type": "object", "properties": { "temperature":{"type":"number"}, "humidity":{"type":"number"}, "airPressure":{"type":"number"}, "dust":{"type":"number"}, "rssi":{"type":"number"} }, "writable": false, "observable": false, "forms": [{ "href" : "allSensorData", "mediaType": "application/json" }] } }, "actions":{}, "events":{} }

egekorkan commented 5 years ago

I have checked this again and interestingly JSON-LD playground "validates" this as well. Triples are not generated but expansion and so on works. My feeling is to not allow this but I am up for discussions

vcharpenay commented 5 years ago

iot:Temperature and other terms are actually also valid URIs, which is why the JSON-LD playground does not throw any error. It is more a usage pitfall than a formal error and these are not easy to differentiate from intentional definitions. I started working on a small linting tool to detect common mistakes:

https://github.com/vcharpenay/jsonld-lint/

Please feel free to use it and extend it!

egekorkan commented 5 years ago

I will use it in the script version of the playground :) Thanks!