- From: Tomasz Pluskiewicz via GitHub <sysbot+gh@w3.org>
- Date: Tue, 17 Mar 2020 16:06:15 +0000
- To: public-hydra-logs@w3.org
tpluscode has just created a new issue for https://github.com/HydraCG/Specifications:
== Relative Template URIs ==
## Description
I would also clarify the intended behavior around relative IRI Templates.
Especially in the context of #207 it might be a neat trick to be able to reuse same template for multiple links.
Consider two collection resources:
```turtle
</people/>
a hydra:Collection ;
api:newPerson api:SubResourceTemplate .
</events/>
a hydra:Collection ;
api:newEvent api:SubResourceTemplate .
```
And an API Documentation
```turtle
api:SubResourceTemplate
a hydra:IriTemplate ;
hydra:template "{name}" ;
hydra:mapping [
a hydra: IriTemplateMapping ;
hydra:variable "name" ;
hydra:property schema:name ;
hydra:required true
] .
```
## What's missing
Notice that the template is reused for two completely unrelated properties. To make this work the client would construct the template and apply it to a base URI. I expect that URI to be the parent's identifier.
In the example above that would effectively mean `/people/{name}` and `/events/{name}` respectively
Does this make sense?
## Caveat
The above will not work as expected if the collection is identified like `/people` (no trailing slash). Will result in
```diff
-http://example.com/people/foo
+http://example.com/foo
```
which might be unexpected...
Please view or discuss this issue at https://github.com/HydraCG/Specifications/issues/208 using your GitHub account
Received on Tuesday, 17 March 2020 16:06:17 UTC