HydraCG / Specifications

Specifications created by the Hydra W3C Community Group
Other
139 stars 25 forks source link

Are we considering semantics for partial querying of objects #139

Open Mec-iS opened 7 years ago

Mec-iS commented 7 years ago

Has the group ever considered an implementation for querying partially a HydraClass or an HydraCollection? One of the feature that makes other frameworks attractive is that there is a way of querying only specified properties from big objects. This can be pretty useful in the case of requesting large collection in which the client needs only one relevant property from each member. I know Hydra is not meant to be a query language, can the use of filtering, through the use of a provided semantics in the documentation, be considered a violation of REST or Hydra principles?

tpluscode commented 7 years ago

Similar stuff was touched in the Filter as views thread on the mailing list but from a different angle.

Can't find the relevant massages on the spot but in general I proposed to generalise the Collection/View pair to Resource/View. That way you could define how to project a resource to e.g. a subset of it's properties. Not exactly what you ask about but it's the best I remember..

asbjornu commented 7 years ago

Isn't querying orthogonal to Hydra? If Hydra makes the query language pluggable, i.e. just defines it as any other operation, it can use whatever HTTP method and query syntax the developer wants to (and that the server supports, of course). I think SPARQL, OData, Falcor, GraphQL and any other query language you can think of, should be usable within Hydra.

asbjornu commented 7 years ago

For the select/include/expand/transclude part of the equation, I also think that should be pluggable; inadarei/draft-prefer-transclude#5 discusses one option based on the Prefer HTTP header, GraphQL has property selection, OData has $expand, Falcor has paths, SPARQL has select, etc. All of these transclusion methods should be possible to use within Hydra, imho.

tpluscode commented 7 years ago

Still, by evaluating these languages we may determine that some primitives are missing from Hydra. Like the ability to describe Headers which would be necessary for Prefer/Transclude

asbjornu commented 7 years ago

Good point! 👍

elf-pavlik commented 7 years ago

I've seen recently this GraphQL like experiment for RDF https://github.com/dan-f/twinql

tpluscode commented 7 years ago

Just surfaced today on my radar: https://medium.com/@dwalsh.sdlr/using-graphql-why-facebook-now-owns-you-3182751028c9

Wonder how it relates to the twing thing

alien-mcl commented 3 years ago

We can now express an operation may expect or return headers - based on your current experience, do we need any other constructs in hydra itself to make queries doable?