- From: Tomasz Pluskiewicz via GitHub <sysbot+gh@w3.org>
- Date: Tue, 08 Dec 2020 09:53:26 +0000
- To: public-hydra-logs@w3.org
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
```JSON
{
"@type": "IriTemplate",
"template": "/markus/friends{?first}",
"mapping": [{
"variable": "first",
"property": "schema:givenName"
}]
}
```
To construct the URI `/markus/friends?first=Ruben` I would use a blank resource using the mapped property:
```JSON
{
"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 `IriTemplate` in case there were multiple.
Here' a complete representation, diffed from the initial snippet
```diff
{
"@id": "/markus/friends",
"@type": "Collection",
"totalItems": 578,
"member": [ ],
"view": [
{
"@id": "/markus/friends?first=Ruben",
"@type": "PartialCollectionView",
"totalItems": 15,
+ "fromTemplate": "_:template",
+ "templateVariables": {
+ "schema:giveName": "Ruben"
+ }
},
{
+ "@id": "_:template",
"@type": "ViewTemplate",
"template": "/markus/friends{?first,last}",
"mapping": [
{ "variable": "first", "property": "schema:givenName" },
{ "variable": "last", "property": "schema:familyName" }
]
}
]
}
```
See what happened:
1. The view references the template used to construct the URI
2. The `templateVariables` is a simple RDF resource with properties which map to resource variables
--
GitHub Notification of comment by tpluscode
Please view or discuss this issue at https://github.com/HydraCG/Specifications/issues/148#issuecomment-740513833 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 8 December 2020 09:53:28 UTC