-
Notifications
You must be signed in to change notification settings - Fork 27
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
Extend PartialCollectionView with template variables' values #148
Comments
Why do you expect server to provide the state the client produced? If the client initiated that filtering, it is it's stake to keep track of filters used. |
I knew that question would come 😁. Because bookmarks. The client may not have that information if it starts directly from a bookmarked resource URI. |
Hold your horses. I believe a bookmark would refer to some kind of client state (i.e. |
There would be the option to leverage |
Do you mean that an instance of Actually this in a way fits seeing |
Yes, a PartialCollectionView could have it's own manages block |
@tpluscode does the answer satisfies you and can this issue be closed? |
No, it is not the same. The template does not have to directly correspond the collection members. For example a query like |
Server may provide a As I wrote earlier - I'm against throwing this kind of concepts into the hydra (it's up to the client to maintain it's state), but I want to be sure hydra provides concepts for extensions. |
I don't mind this being an extension to Hydra Core. Although all it takes is a single property which would provide the exact values needed to reconstruct the template. Nothing substantial |
And I said that before, it is not about client maintaining its state. If you a client starts by dereferencing a collection with filters, they have no way for figuring out how to construct that same template |
Since Hydra has a way to define URI templates, I find it strange to not use Hydra's existing vocabulary to express how the currently requested URI was constructed and can be manipulated by the client. I see no reason why this should be delegated to an extension and not reside in Hydra Core. |
I'm not sure which existing vocabulary terms are you referring to @asbjornu, but let's try to bent our minds and mint some example: {
"@id": "/markus/friends",
"@type": "Collection",
"totalItems": 578,
"member": [...],
"view": [
{
"@id": "/markus/friends?first=Ruben",
"@type": "PartialCollectionView",
"totalItems": 15,
"template": "/markus/friends{?first}",
"mapping": [{
"variable": "first",
"object": "Ruben"
}]
}
]
} I did not make any analysis on possible range/domain violations in the example above. I aimed not to introduce any new terms. While I'm not convinced it is a server's concern to describe what client had in mind, let's imagine we can have a cheap yet working solution. Any ideas? @asbjornu - do you have any specific approach we could take into account? |
Ok, above I said that only a single property is required, because the actual template variables can also be expressed as RDF. That is how the mapping works, which I only realised quite recently Given a template as above {
"@type": "IriTemplate",
"template": "/markus/friends{?first}",
"mapping": [{
"variable": "first",
"property": "schema:givenName"
}]
} To construct the URI {
"schema:giveName": "Ruben"
} Thus, all I need is really just a property to attach this to the constructed view (or collection, or somewhere, I'm no 100% sure TBH). Now that I think about this, might actually add a second property to point to the actual Here' a complete representation, diffed from the initial snippet {
"@id": "/markus/friends",
"@type": "Collection",
"totalItems": 578,
"member": [ ],
"search": {
+ "@id": "_:template",
"template": "/markus/friends{?first,last}",
"mapping": [
{ "variable": "first", "property": "schema:givenName" },
{ "variable": "last", "property": "schema:familyName" }
]
},
"view": [
{
"@id": "/markus/friends?first=Ruben",
"@type": "PartialCollectionView",
"totalItems": 15,
+ "fromTemplate": "_:template",
+ "templateVariables": {
+ "schema:giveName": "Ruben"
+ }
}
]
} See what happened:
|
What I meant was that we already have the That being said, I'm not fluent enough in RDF to actually propose a solution. |
While I think that it is not a subject for the core, I'd love to have some gate opened for extensions here.
Maybe a general property, i.e. |
We have a way for defining collection filtering using template but when the partial representation comes back from the server it doesn't include the variables used on said template. To illustrate, here's a collection snippet from the wiki:
Currently we have no explicit way to determine that the template was constructed with values
{ "first": "Ruben" }
. Of course it is technically possible to reverse the IRI template expansion, some libraries do support that, but what if there are more than oneViewTemplate
?Why do I think it's important? Because without this importation the client has a a hard time to fill a filtering form in the UI.
What I'd see here is an optionally array of variables under the
PartialCollectionView
. Something likeThe text was updated successfully, but these errors were encountered: