w3c / wot-discovery

Repository for WoT discovery discussion
https://w3c.github.io/wot-discovery/
Other
20 stars 17 forks source link

XPath response data model #247

Closed farshidtz closed 2 years ago

farshidtz commented 2 years ago

This splits from #156

The current spec has the following assertion for both XPath responses:

... in the body a set of complete TDs or a set of TD fragments.

How to model the response when a single attribute is selected? What about functions (e.g. count) calls?

Raised in #153

mmccool commented 2 years ago

Since there can be responses (e.g. counts) that don't actually come from TDs removing this restriction makes sense. There is a general problem with defining the data model of query responses, but I don't see any good solution.

mmccool commented 2 years ago

I did make the suggestion on the PR to add a sentence saying the data schema is implied by the query and the XPath specification. In the TM we would have to omit the data schema or just use "object" (with no members). Is the returned JSON always enclosed in an object, at least? Or could there be raw JSON fragments, like numbers or strings with no enclosing object? Can there be a top-level array? In which case we might need a more complex schema in the TM using "oneOf", etc.

mmccool commented 2 years ago

For now we can just add the sentence "schema is implied" as I suggested in the PR. When we get around to doing the TM we can worry about defining a concrete schema (but should at least document requirements for it, here is good).

mmccool commented 2 years ago

I did try scanning the XPath3.1 spec to see if there was an obvious section defining the output schema. It's not obvious, anyway: https://www.w3.org/TR/xpath-31/. XQuery 3.1 spec seems similar: https://www.w3.org/TR/xquery-31/