playground icon indicating copy to clipboard operation
playground copied to clipboard

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

Open danhlephuoc opened this issue 7 years ago • 3 comments

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":{} }

danhlephuoc avatar Jun 30 '18 08:06 danhlephuoc

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

egekorkan avatar Oct 12 '18 16:10 egekorkan

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!

vcharpenay avatar Oct 13 '18 00:10 vcharpenay

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

egekorkan avatar Oct 14 '18 11:10 egekorkan