Skip to content

Expressing actions (#154) within ApiDocumentation #160

@tpluscode

Description

@tpluscode

On today's call we discussed that the premise of PR #154 is to allow, as the title states, performing requests on a different target. That is, as opposed to hydra:Operation which always assumes that the target will be the object of a ?s hydra:operation ?o triple.

Taking advantage of supportedProperty and supportedOperation combined should make it also possible.

Let's have a car resource, linked to a steering wheel:

{
  "@type": [ "ex:Car" ],
  "@id": "/the/car",
  "ex:steeringWheel": {
    "@id": "/the/wheel"
  }
}

We can currently define the ApiDocumentation so that any occurrence of ex:steeringWheel implies that its subject will support given operations:

{
  "supportedClass": {
    "@id": "ex:Car",
    "supportedProperty": {
      "@id": "ex:steeringWheel",
      "supportedOperation": [ {
        "@type": "ex:TurnLeftOperation"
      }, {
        "@type": "ex:TurnRightOperation"
      } ]
    }
  }
}

This way any subject of ?car ex:steeringWheel ?subject will be a assumed a valid for the turn operations, regardless of it's precise class. I think it should be also allowed to have an IriTemplate in place of /the/wheel

{
  "@type": [ "ex:Car" ],
  "@id": "/the/car",
  "ex:steeringWheel": {
    "@type": "IriTemplate"
  }
}

@lanthaler please confirm I'm not inventing my own Hydra here.
@elf-pavlik how would similar be expressed with ApiDocumentation and the actions being discussed in #154

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions