[Specifications] Usage of IriTemplate

tpluscode has just created a new issue for https://github.com/HydraCG/Specifications:

== Usage of IriTemplate ==
I've started implementing `IriTemplate` in Alcaeus, the old Heracles.

My API is simple:

``` js
const iriTemplate = new IriTemplate(); // part of representation/docs
const variables = {};

const expanded = iriTemplate.expand(variables);
```

Taking the example from specs:

``` json
{
  "@context": "http://www.w3.org/ns/hydra/context.jsonld",
  "@type": "IriTemplate",
  "template": "http://api.example.com/issues{?q}",
  "variableRepresentation": "BasicRepresentation",
  "mapping": [
    {
      "@type": "IriTemplateMapping",
      "variable": "q",
      "property": "hydra:freetextQuery",
      "required": true
    }
  ]
}
```

My question is about the actual contents of the `variables` dictionary.

I understand it should use `property` URIs as keys, which are they placed in the template variables?

``` json
{
  "http://www.w3.org/ns/hydra/core#freetextQuery": "search criteria"
}
```

To produce `http://api.example.com/issues?q=search%20criteria`?

Please view or discuss this issue at https://github.com/HydraCG/Specifications/issues/152 using your GitHub account

Received on Monday, 20 November 2017 21:01:11 UTC