thingweb / thingweb-directory

W3C WoT Thing Directory implementation
Other
19 stars 11 forks source link

SPARQL graph pattern examples/hints/docs missing #21

Open mkovatsc opened 6 years ago

mkovatsc commented 6 years ago

The semantic look-up query uses graph patterns, but there are no good examples on how to achieve intended results.

Please provide examples and links on how to use.

The lack of documentation renders the feature unusable for many, hence bug level issue.

mmccool commented 6 years ago

I agree. Even a single simple example (eg find all TDs that include "Light" in the @type) to understand the basic syntax (eg do I need a PREFIX clause, or is the TD vocabulary pre-loaded? Is the full syntax used or a short form? Etc.) Also, please provide examples for the two other search forms (eg /td-lookup/ep and /td-lookup/res). For example, a keyword search for "Light".

ToruKawaguchi commented 6 years ago

I agree the need of documentation.
For immediate reference, following Victor's e-mail might help:

https://lists.w3.org/Archives/Public/public-wot-ig/2017Nov/0005.html

karaleina commented 5 years ago

Could you provide one simple example of registration of 2 things (e.g. with different names) and filtering one of them (e.g. filtering names that contains "2"), please?

I am using version 9 of Thing Directory. I registered a Thing:

{
  "name":"My Lamp2",
  "type": "thing",
  "description": "A web connected lamp",
  "properties": {
    "on": {
      "type": "boolean",
      "description": "Whether the lamp is turned on",
      "href": "/things/lamp/properties/on"
    },
    "brightness" : {
      "type": "number",
      "description": "The level of light from 0-100",
      "minimum" : 0,
      "maximum" : 100,
      "href": "/things/lamp/properties/brightness"
    }
  },
  "actions": {
    "toggle": {
      "description": "Toggle the lamp on and off"
    }
  },
  "events": {
    "overheating": {
      "description": "The lamp has exceeded its safe operating temperature"
    }
  },
  "links": {
    "properties": "/thing/lamp/properties",
    "actions": "/things/lamp/actions",
    "events": "/things/lamp/events"
  }
}

I was trying to filter by name according to the guideline from the comment above, but I am receiving empty list. I am using Postman and my SPARQL query is here:

?prop <http://www.w3.org/ns/td#Thing> ?name . FILTER contains(?name, "2")

Url encoded:

%3Fprop%20%3Chttp%3A%2F%2Fwww.w3.org%2Fns%2Ftd%23Thing%3E%20%3Fname%20.%20FILTER%20contains%28%3Fname%2C%20%222%22%29