-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Basic Query entry point #231
Comments
Use case scenarios:
|
In the Node-RED and directory search integration we created last year, we filtered out Things that did not have HTTP binding in their form. This is because the nodes generated by Node Generator do not support protocols other than HTTP. I'm not sure whether this is a basic query or not, but it is one of the use cases. |
I've just found that there was already this issue trying to define a good set of requirements of this basic query language. Please read my considerations about JSONPath reported in #232 : In the last F2F, we have discussed how to narrow the scope of TDDs to allow simpler implementations (see #208). This issue wants to explore how to reduce the feature set of JSONPath to support minimal query support for Read-only TDDs as asked in #156 (comment). RequirementsWe didn't really define a good set of requirements for this minimal query language. Here's a list of what I recall:
I am aware that those requirements are a little bit fuzzy, maybe we should work on this in this issue. Limit JSONPathA possible approach to define this minimal query language is to restrict JSONPath features to be less computational heavy and handier to our use case. I would start by limiting the root sintax to this rule: json-path = root-selector *( dot-selector / index-selector / filter-selector) This basically allows users to select subsets of TDs (similar to a json pointer implementation) plus filtering. We can limit this even more: json-path = root-selector *( filter-selector) Which means that users are only allowed to filter the TDD collection of TDs. In principle, this would simplify a little bit the implementation cause it will not need to support the selection and manipulation of the query result set. However, this is my conjecture and it might be actually tested/proofed with concrete data. About supported features, we could support free text searches with JSONPath through RegEx support. However, RegEx syntax is sadly marked as TBD (it is marked as a possible future consensus in the feature matrix). Without it we can only have exact text matches in the filter selector, which might be still ok for searches like: "look for TDs with Another decision point is if we want to limit also the filter-selector, but it depends on what we want to achieve:
Reference: https://www.ietf.org/archive/id/draft-ietf-jsonpath-base-02.html |
Although search is obviously useful, I'd like to propose that none of the search APIs should be mandatory. For some use cases (like a smart home hub) where there's usually a small number of devices (e.g. 10) it may not actually be necessary. Anecdotally, I'm also mindful that retrofitting any of these search APIs to a simple SQL database storing whole JSON resources (as is the case with the local SQLite database used by WebThings Gateway) could be quite challenging and it would be a shame for this to block us from being compliant with the rest of the Directory Service API. |
Even though I presented the above results about JSON Path, I have to agree with @benfrancis to not have any search API mandatory. For two reasons:
|
I agree. IMO, a basic but mandatory query endpoint is only appropriate if it solves the necessary requirements of all use cases. The use cases need to be formally defined and reviewed as every other WoT use case. I insist on what was proposed above:
And to remove XPath, since it was added as a fallback for if JSONPath doesn't make it into a standard. In fact it hasn't, but a no-syntactic search fallback seems more plausible. Once JSONPath does become a standard, we can make it an optional search feature along with the existing optional SPARQL. |
Discussion (Nov 15):
Options are:
Notes:
Consensus: |
Upon re-reading the comments above, I noticed one other suggestion made by @benfrancis - dropping XPath. It's optional, and we agreed to make all query mechanisms optional, so I'm not sure what dropping it would accomplish other than making the spec simpler (and reducing testing). IMO only having SPARQL would be annoying for simple use cases, XPath 3.0 is basically equivalent to JSONPath but is an actual standard (and has substring search). But let's discuss and come to a consensus on this... we do only have one implementation so at minimum we need to mark it as "at risk". Also we need to look into some details around available implementations (see for instance this discussion), whether we should specify XPath 3.1, etc. |
@mmccool wrote:
For the record I didn't suggest that, I suggested making all search mechanisms optional which seems to be what has been agreed. You may be referring to the comment by @farshidtz. |
Propose closing: Consensus is NOT to create a separate "basic" query language, which was the original point of this issue. Let's spin off other points, e.g. the XPath discussion, into their own issues. |
As discussed in the F2F, we have a problem with JSONPath not being a standard in time for our expected date of REC transition. Therefore we are planning the following:
Please comment below on modifications or improvements to this proposal.
The text was updated successfully, but these errors were encountered: