w3c / wot-scripting-api

Web of Things (WoT) Scripting API
http://w3c.github.io/wot-scripting-api/
Other
42 stars 28 forks source link

Discovery filtering #115

Closed zolkis closed 6 years ago

zolkis commented 6 years ago

I would like to ask for input for typical discovery scenarios in WoT scripts. I have the hunch most scripts simply use wot.discover() which defaults the discovery method to "any", or by specifying a directory: wot.discover({ url: ... }); (where method also defaults to "any").

Currently we (theoretically) support constraints and queries which are flexible, but if defined, must be standardized. That takes considerable effort. Also the runtime size might be considerably increased by including for instance JSONiq or JMESPath implementations.

I am not sure how much of this is needed.

Note that for generic standardized filtering support, this should be done in the receiving (local to the script) WoT runtime. For filtering at source (directory or endpoints), we'd need protocol support in order to transmit the filters, and we'd need translation of the filters. Filtering at source (e.g. in directories) should be defined by the specific WoT interface level, probably defining specific actions for discovery.

At the moment I am inclined to drop filtering support, since scripts could use local filtering libraries. Alternatively we could label filtering as "next version" feature, or restrict to a simple subset of JSON query language that is summarized in the Scripting spec in a non-normative section (like e.g. Observable).

For that we need input on what typical searches will look like.

FanoRamparany commented 6 years ago

Hi, In order to take advantage of the TD RDF underlying data encoding and to benefit from the SPARQL language which is natively a filtering language, I would use a filter syntax close to SPARQL, if not SPARQL.

danielpeintner commented 6 years ago

[...] I would use a filter syntax close to SPARQL, if not SPARQL.

Related: The thingweb directory also supports SPARQL queries

zolkis commented 6 years ago

Looks like we could at least support SPARQL when method is "directory", and url is the URL of a Thing Directory that support querying "at source". Then, we should specify the error handling, i.e. what happens if a query has been submitted, but cannot be respected (not supported, invalid, processing error, security error etc).

FanoRamparany commented 6 years ago

Great ! reusing SPARQL syntax for the script API’s filters could ease its adoption, if expressive enough.

De : danielpeintner [mailto:notifications@github.com] Envoyé : lundi 7 mai 2018 10:25 À : w3c/wot-scripting-api Cc : RAMPARANY Fano IMT/OLS; Comment Objet : Re: [w3c/wot-scripting-api] Discovery filtering (#115)

[...] I would use a filter syntax close to SPARQL, if not SPARQL.

Related: The thingweb directoryhttps://github.com/thingweb/thingweb-directory#interacting-with-the-directory also supports SPARQL queries

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/w3c/wot-scripting-api/issues/115#issuecomment-386995190, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AP06oLoi56hKNNvCRrXImk-JRIMJuParks5twATqgaJpZM4TyRp-.


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.

zolkis commented 6 years ago

Theory is fine, but still the initial request stands: based on past WoT plugfests, could anyone please provide concrete (most frequent) discovery requests used in WoT scripts :).

FanoRamparany commented 6 years ago

Hi Zoltan, I haven’t got the opportunity to participate to the WoT plugfest yet, but from my experience in IoT use cases here are some discovery requests commonly involved in IoT applications:

De : Zoltan Kis [mailto:notifications@github.com] Envoyé : lundi 7 mai 2018 15:35 À : w3c/wot-scripting-api Cc : RAMPARANY Fano IMT/OLS; Comment Objet : Re: [w3c/wot-scripting-api] Discovery filtering (#115)

Theory is fine, but still the initial request stands: based on past WoT plugfests, could anyone please provide concrete (most frequent) discovery requests used in WoT scripts :).

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/w3c/wot-scripting-api/issues/115#issuecomment-387066472, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AP06oO0TvsbtFPNL6LKzuf8egFocvvbkks5twE2EgaJpZM4TyRp-.


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.

danielpeintner commented 6 years ago

FYI: some more input from @vcharpenay on the mailing list (see)

Essentially the proposal is to use partial TDs (as a template?) that should be matched, e.g.,

{
  „@context“: { „iot“: „http://iotshema.org/“ },
  „properties“: {
    “@type”: „iot:Illuminance“
  }
}

On the one side I think this is rather easy to implement, which is good. On the other side I wonder whether this is sufficient. According to my understanding with such a solution you can't filter TDs with constructs such as value > 123 but do we really need that?

zolkis commented 6 years ago

Fixed in #113. It supports queries and templates.