Re: [Specifications] hydra:search with HTTP POST

Good catch, I think we would have search directly on the collection
```json
{
  "@context": { ... },
  "@id": "http://api.example.com/issues",
  "@type": "hydra:Collection",
  "search": {
    "@type": "IriTemplate",
    "template": "http://api.example.com/issues{?q}",
    "variableRepresentation": "BasicRepresentation",
    "mapping": [{
      "@type": "IriTemplateMapping",
      "variable": "q",
      "property": "hydra:freetextQuery",
      "required": true
    }]
  },
  "operation": [{
    "@type": ["Operation", "schema:SearchAction"],
    "method": "POST",
    "???:contentType": "application/sparql-query"
    }, {
    "@type": ["Operation", "schema:CreateAction"],
    "method": "POST",
    "expects": "foo:Issue",
    "???:contentType": "application/ld+json"
  }]
}
```

Or collection would 'delegate' it to different resource via `hydra:search`

```json
{
  "@context": { ... },
  "@id": "http://api.example.com/issues",
  "@type": "hydra:Collection",
  "search": [{
    "@type": "IriTemplate",
    "template": "http://api.example.com/issues/search{?q}",
    "variableRepresentation": "BasicRepresentation",
    "mapping": [{
      "@type": "IriTemplateMapping",
      "variable": "q",
      "property": "hydra:freetextQuery",
      "required": true
    }]
  }, {
    "@id": "http://api.example.com/issues/search",
    "operation": {
      "@type": ["Operation", "schema:SearchAction"],
      "method": "POST",
      "???:contentType": "application/sparql-query"
    }
  }],
  "operation": {
    "@type": ["Operation", "schema:CreateAction"],
    "method": "POST",
    "expects": "foo:Issue",
    "???:contentType": "application/ld+json"
  }
}
```

So client needs to check collection for:
* direct `schema:SearchAction` operation
* delegation to another `hydra:Resource` via `hydra:search` and `schema:SearchAction` on that resource
* delegation to `hydra:IriTemplate` via `hydra:search` which has 'a default operation` (HTTP GET)

I think with just added in #143 `hydra:memberTemplate` #16 and `schema:AddAction` we may head in similar direction, or at list for now:
* direct `schema:CreateAction` operation
* delegation to `hydra:IriTemplate` via `hydra:memberTemplate` which has `schema:CreateAction` operation
And #134 might bring need for something like `schema:AddAction` into the game and don't really work with `hydra:memberTemplate`.

I think in this issue we can focus on `hydra:search` and `schema:SearchAction` with direct `GET` & `POST` as well as delegating to other resources and templates. Once we get better picture of that we can see how it works with other links and templated links like `hydra:memberTemplate`.

-- 
GitHub Notification of comment by elf-pavlik
Please view or discuss this issue at https://github.com/HydraCG/Specifications/issues/149#issuecomment-341987051 using your GitHub account

Received on Sunday, 5 November 2017 16:47:26 UTC