From 6cdcefbf9cc0c93421c45bc8e74dcdfa315fada0 Mon Sep 17 00:00:00 2001 From: Ben Francis Date: Thu, 5 Aug 2021 12:59:08 +0100 Subject: [PATCH] Add queryaction and cancelaction operations - closes #302 --- context/hypermedia-context.jsonld | 2 + context/td-context-1.1.jsonld | 4 ++ context/td-context.ttl | 16 ++++++ index.html | 53 +++++++++++-------- index.template.html | 7 ++- ontology/td.html | 6 ++- ontology/td.ttl | 10 ++++ validation/ext-td-json-schema-validation.json | 8 ++- validation/td-json-schema-validation.json | 8 ++- validation/td-validation.ttl | 8 ++- 10 files changed, 91 insertions(+), 31 deletions(-) diff --git a/context/hypermedia-context.jsonld b/context/hypermedia-context.jsonld index 065d6cf13..256a6c4a4 100644 --- a/context/hypermedia-context.jsonld +++ b/context/hypermedia-context.jsonld @@ -32,6 +32,8 @@ "unobserveproperty": "td:unobserveProperty", "unobserveallproperties": "td:unobserveAllProperties", "invokeaction": "td:invokeAction", + "queryaction": "td:queryAction", + "cancelaction": "td:cancelAction", "subscribeevent": "td:subscribeEvent", "subscribeallevents": "td:subscribeAllEvents", "unsubscribeevent": "td:unsubscribeEvent", diff --git a/context/td-context-1.1.jsonld b/context/td-context-1.1.jsonld index ab18103c9..bfe09dccc 100644 --- a/context/td-context-1.1.jsonld +++ b/context/td-context-1.1.jsonld @@ -404,6 +404,8 @@ "unobserveproperty": "td:unobserveProperty", "unobserveallproperties": "td:unobserveAllProperties", "invokeaction": "td:invokeAction", + "queryaction": "td:queryAction", + "cancelaction": "td:cancelAction", "subscribeevent": "td:subscribeEvent", "subscribeallevents": "td:subscribeAllEvents", "unsubscribeevent": "td:unsubscribeEvent", @@ -496,6 +498,8 @@ "unobserveproperty": "td:unobserveProperty", "unobserveallproperties": "td:unobserveAllProperties", "invokeaction": "td:invokeAction", + "queryaction": "td:queryAction", + "cancelaction": "td:cancelAction", "subscribeevent": "td:subscribeEvent", "subscribeallevents": "td:subscribeAllEvents", "unsubscribeevent": "td:unsubscribeEvent", diff --git a/context/td-context.ttl b/context/td-context.ttl index af7c0fa07..1751d7914 100644 --- a/context/td-context.ttl +++ b/context/td-context.ttl @@ -688,6 +688,14 @@ _:hasForm-context _:hasForm-invokeacti _:hasForm-invokeaction . _:hasForm-invokeaction "invokeaction" . _:hasForm-invokeaction . +_:hasForm-context _:hasForm-queryaction . +_:hasForm-queryaction . +_:hasForm-queryaction "queryaction" . +_:hasForm-queryaction . +_:hasForm-context _:hasForm-cancelaction . +_:hasForm-cancelaction . +_:hasForm-cancelaction "cancelaction" . +_:hasForm-cancelaction . _:hasForm-context _:hasForm-subscribeevent . _:hasForm-subscribeevent . _:hasForm-subscribeevent "subscribeevent" . @@ -856,6 +864,14 @@ _:hasLink-context _:hasLink-invokeacti _:hasLink-invokeaction . _:hasLink-invokeaction "invokeaction" . _:hasLink-invokeaction . +_:hasLink-context _:hasLink-queryaction . +_:hasLink-queryaction . +_:hasLink-queryaction "queryaction" . +_:hasLink-queryaction . +_:hasLink-context _:hasLink-cancelaction . +_:hasLink-cancelaction . +_:hasLink-cancelaction "cancelaction" . +_:hasLink-cancelaction . _:hasLink-context _:hasLink-subscribeevent . _:hasLink-subscribeevent . _:hasLink-subscribeevent "subscribeevent" . diff --git a/index.html b/index.html index 95b7f9dcd..17c11126e 100644 --- a/index.html +++ b/index.html @@ -1415,7 +1415,11 @@

Core Vocabulary Definitions

When a Form instance is within an ActionAffordance instance, the value assigned to op MUST - be invokeaction.

+ either be invokeaction, queryaction, + cancelaction or an + Array + containing a combination of these terms. +

EventAffordance

An Interaction Affordance that describes an event source, which asynchronously pushes event data to Consumers (e.g., overheating @@ -2136,7 +2140,7 @@

Hypermedia Controls Vocabulary Definitions

the correct form for the operation required. op can be assigned one or more interaction verb(s) each representing a semantic intention of an - operation.optionalstring or Array of string (one of readproperty, writeproperty, observeproperty, unobserveproperty, invokeaction, subscribeevent, unsubscribeevent, readallproperties, writeallproperties, readmultipleproperties, writemultipleproperties, observeallproperties, unobserveallproperties, subscribeallevents, or unsubscribeallevents)

Possible values for the contentCoding + operation.optionalstring or Array of string (one of readproperty, writeproperty, observeproperty, unobserveproperty, invokeaction, queryaction, cancelaction, subscribeevent, unsubscribeevent, readallproperties, writeallproperties, readmultipleproperties, writemultipleproperties, observeallproperties, unobserveallproperties, subscribeallevents, or unsubscribeallevents)

Possible values for the contentCoding property can be found, e.g., in the IANA HTTP content coding registry.

@@ -6776,14 +6780,7 @@

JSON Schema for TD Instance Validation

"minimum": 0 }, "multipleOf": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "number" - } - ] + "$ref": "#/definitions/multipleOfDefinition" }, "properties": { "additionalProperties": { @@ -6815,6 +6812,18 @@

JSON Schema for TD Instance Validation

} } }, + "multipleOfDefinition": { + "anyOf": [ + { + "type": "integer", + "exclusiveMinimum": 0 + }, + { + "type": "number", + "exclusiveMinimum": 0 + } + ] + }, "form_element_property": { "type": "object", "properties": { @@ -6886,7 +6895,9 @@

JSON Schema for TD Instance Validation

{ "type": "string", "enum": [ - "invokeaction" + "invokeaction", + "queryaction", + "cancelaction" ] }, { @@ -6894,7 +6905,9 @@

JSON Schema for TD Instance Validation

"items": { "type": "string", "enum": [ - "invokeaction" + "invokeaction", + "queryaction", + "cancelaction" ] } } @@ -7171,14 +7184,7 @@

JSON Schema for TD Instance Validation

"minimum": 0 }, "multipleOf": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "number" - } - ] + "$ref": "#/definitions/multipleOfDefinition" }, "properties": { "additionalProperties": { @@ -7966,7 +7972,10 @@

Changes from First Public Working Draft 24 November 2
  • In section , the description for uriVariables was clarified.
  • -
  • In section , the description for observable was clarified.
  • +
  • In section , the description for observable was clarified.
  • + +
  • In section , the allowed values of the op member of a Form were expanded to include queryaction and cancelaction.
  • +
  • In section , a new term model was added.
  • In section : @@ -8005,7 +8014,7 @@

    Changes from First Public Working Draft 24 November 2
  • In section :
    • A new term additionalResponses was added. It can be used to define error responses.
    • -
    • observeallproperties, unobserveallproperties, subscribeallevents and unsubscribeallevents were added to the definition of op.
    • +
    • queryaction, cancelaction, observeallproperties, unobserveallproperties, subscribeallevents and unsubscribeallevents were added to the definition of op.
    • Type definitions for terms contentType, contentCoding, security, op were changed.
    • A paragraph was added to describe how a Consumer can behave given multiple form choices.
    diff --git a/index.template.html b/index.template.html index f6297f844..0daee84db 100644 --- a/index.template.html +++ b/index.template.html @@ -5671,7 +5671,10 @@

    Changes from First Public Working Draft 24 November 2
  • In section , the description for uriVariables was clarified.
  • -
  • In section , the description for observable was clarified.
  • +
  • In section , the description for observable was clarified.
  • + +
  • In section , the allowed values of the op member of a Form were expanded to include queryaction and cancelaction.
  • +
  • In section , a new term model was added.
  • In section : @@ -5710,7 +5713,7 @@

    Changes from First Public Working Draft 24 November 2
  • In section :
    • A new term additionalResponses was added. It can be used to define error responses.
    • -
    • observeallproperties, unobserveallproperties, subscribeallevents and unsubscribeallevents were added to the definition of op.
    • +
    • queryaction, cancelaction, observeallproperties, unobserveallproperties, subscribeallevents and unsubscribeallevents were added to the definition of op.
    • Type definitions for terms contentType, contentCoding, security, op were changed.
    • A paragraph was added to describe how a Consumer can behave given multiple form choices.
    diff --git a/ontology/td.html b/ontology/td.html index 0c4af6115..dd71526e2 100644 --- a/ontology/td.html +++ b/ontology/td.html @@ -101,7 +101,7 @@

    Terminology

    Axiomatization

    Classes

    ActionAffordance

    IRI: https://www.w3.org/2019/wot/td#ActionAffordance

    An Interaction Affordance that allows to invoke a function of the Thing, which manipulates state (e.g., toggling a lamp on or off) or triggers a process on the Thing (e.g., dim a lamp over time).
    Sub-class oftd:InteractionAffordance
    In the domain oftd:hasInputSchema
    td:hasOutputSchema
    td:isIdempotent
    td:isSafe
    In the range oftd:hasActionAffordance

    EventAffordance

    IRI: https://www.w3.org/2019/wot/td#EventAffordance

    An Interaction Affordance that describes an event source, which asynchronously pushes event data to Consumers (e.g., overheating alerts).
    Sub-class oftd:InteractionAffordance
    In the domain oftd:hasCancellationSchema
    td:hasNotificationSchema
    td:hasSubscriptionSchema
    In the range oftd:hasEventAffordance

    InteractionAffordance

    IRI: https://www.w3.org/2019/wot/td#InteractionAffordance

    Metadata of a Thing that shows the possible choices to Consumers, thereby suggesting how Consumers may interact with the Thing. There are many types of potential affordances, but W3C WoT defines three types of Interaction Affordances: Properties, Actions, and Events.
    Super-class oftd:ActionAffordance
    td:EventAffordance
    td:PropertyAffordance
    In the domain oftd:hasForm
    td:hasUriTemplateSchema
    td:name
    In the range oftd:hasInteractionAffordance
    -

    OperationType

    IRI: https://www.w3.org/2019/wot/td#OperationType

    Enumeration of well-known operation types necessary to implement the WoT interaction model
    Enumeration memberstd:invokeAction
    td:observeAllProperties
    td:observeProperty
    td:readAllProperties
    td:readMultipleProperties
    td:readProperty
    td:subscribeAllEvents
    td:subscribeEvent
    td:unobserveAllProperties
    td:unobserveProperty
    td:unsubscribeAllEvents
    td:unsubscribeEvent
    td:writeAllProperties
    td:writeMultipleProperties
    td:writeProperty
    +

    OperationType

    IRI: https://www.w3.org/2019/wot/td#OperationType

    Enumeration of well-known operation types necessary to implement the WoT interaction model
    Enumeration memberstd:cancelAction
    td:invokeAction
    td:observeAllProperties
    td:observeProperty
    td:queryAction
    td:readAllProperties
    td:readMultipleProperties
    td:readProperty
    td:subscribeAllEvents
    td:subscribeEvent
    td:unobserveAllProperties
    td:unobserveProperty
    td:unsubscribeAllEvents
    td:unsubscribeEvent
    td:writeAllProperties
    td:writeMultipleProperties
    td:writeProperty

    PropertyAffordance

    IRI: https://www.w3.org/2019/wot/td#PropertyAffordance

    An Interaction Affordance that exposes state of the Thing. This state can then be retrieved (read) and optionally updated (write). Things can also choose to make Properties observable by pushing the new state after a change.
    Sub-class oftd:InteractionAffordance
    In the domain oftd:isObservable
    In the range oftd:hasPropertyAffordance

    Thing

    IRI: https://www.w3.org/2019/wot/td#Thing

    An abstraction of a physical or a virtual entity whose metadata and interfaces are described by a WoT Thing Description, whereas a virtual entity is the composition of one or more Things.
    In the domain oftd:hasForm
    td:hasInteractionAffordance
    td:hasSecurityConfiguration

    Object Properties

    hasActionAffordance

    IRI: https://www.w3.org/2019/wot/td#hasActionAffordance

    All Action-based interaction affordance of the Thing.
    Range includestd:ActionAffordance

    hasCancellationSchema

    IRI: https://www.w3.org/2019/wot/td#hasCancellationSchema

    Defines any data that needs to be passed to cancel a subscription, e.g., a specific message to remove a Webhook
    Domain includestd:EventAffordance
    @@ -118,9 +118,11 @@

    Terminology

    hasUriTemplateSchema

    IRI: https://www.w3.org/2019/wot/td#hasUriTemplateSchema

    Define URI query template variables as collection based on schema specifications. The individual variables DataSchema cannot be an ObjectSchema or an ArraySchema.
    Domain includestd:InteractionAffordance

    Datatype Properties

    isIdempotent

    IRI: https://www.w3.org/2019/wot/td#isIdempotent

    Indicates whether the action is idempotent (=true) or not. Informs whether the action can be called repeatedly with the same result, if present, based on the same input.
    Domain includestd:ActionAffordance
    Range includesschema:Boolean

    isObservable

    IRI: https://www.w3.org/2019/wot/td#isObservable

    A hint that indicates whether Servients hosting the Thing and Intermediaries should provide a Protocol Binding that supports the observeproperty and unobserveproperty operations for this Property.
    Domain includestd:PropertyAffordance
    Range includesschema:Boolean

    isSafe

    IRI: https://www.w3.org/2019/wot/td#isSafe

    Signals if the action is safe (=true) or not. Used to signal if there is no internal state (cf. resource state) is changed when invoking an Action. In that case responses can be cached as example.
    Domain includestd:ActionAffordance
    Range includesschema:Boolean
    -

    name

    IRI: https://www.w3.org/2019/wot/td#name

    Indexing property to store entity names when serializing them in a JSON-LD @index container.
    Domain includestd:InteractionAffordance
    Range includesschema:Text

    Named Individuals

    invokeAction

    IRI: https://www.w3.org/2019/wot/td#invokeAction

    Operation type of forms used to read a property value
    Instance oftd:OperationType
    +

    name

    IRI: https://www.w3.org/2019/wot/td#name

    Indexing property to store entity names when serializing them in a JSON-LD @index container.
    Domain includestd:InteractionAffordance
    Range includesschema:Text

    Named Individuals

    cancelAction

    IRI: https://www.w3.org/2019/wot/td#cancelAction

    Operation type of forms used to cancel an action
    Instance oftd:OperationType
    +

    invokeAction

    IRI: https://www.w3.org/2019/wot/td#invokeAction

    Operation type of forms used to read a property value
    Instance oftd:OperationType

    observeAllProperties

    IRI: https://www.w3.org/2019/wot/td#observeAllProperties

    Operation type of forms used to observe all property values
    Instance oftd:OperationType

    observeProperty

    IRI: https://www.w3.org/2019/wot/td#observeProperty

    Operation type of forms used to observe a property value
    Instance oftd:OperationType
    +

    queryAction

    IRI: https://www.w3.org/2019/wot/td#queryAction

    Operation type of forms used to query the status of an action
    Instance oftd:OperationType

    readAllProperties

    IRI: https://www.w3.org/2019/wot/td#readAllProperties

    Operation type of forms used to read all property values
    Instance oftd:OperationType

    readMultipleProperties

    IRI: https://www.w3.org/2019/wot/td#readMultipleProperties

    Operation type of forms used to read a property value
    Instance oftd:OperationType

    readProperty

    IRI: https://www.w3.org/2019/wot/td#readProperty

    Operation type of forms used to read a property value
    Instance oftd:OperationType
    diff --git a/ontology/td.ttl b/ontology/td.ttl index 788990c08..028578a9d 100644 --- a/ontology/td.ttl +++ b/ontology/td.ttl @@ -255,6 +255,16 @@ rdfs:comment """Operation type of forms used to read a property value"""@en ; rdfs:isDefinedBy : . +:queryAction rdf:type :OperationType ; + rdfs:label "queryAction" ; + rdfs:comment """Operation type of forms used to query the status of an action"""@en ; + rdfs:isDefinedBy : . + +:cancelAction rdf:type :OperationType ; + rdfs:label "cancelAction" ; + rdfs:comment """Operation type of forms used to cancel an action"""@en ; + rdfs:isDefinedBy : . + :subscribeEvent rdf:type :OperationType ; rdfs:label "subscribeEvent" ; rdfs:comment """Operation type of forms used to read a property value"""@en ; diff --git a/validation/ext-td-json-schema-validation.json b/validation/ext-td-json-schema-validation.json index 1c2394d93..05e821ccf 100644 --- a/validation/ext-td-json-schema-validation.json +++ b/validation/ext-td-json-schema-validation.json @@ -353,7 +353,9 @@ "oneOf": [{ "type": "string", "enum": [ - "invokeaction" + "invokeaction", + "queryaction", + "cancelaction" ] }, { @@ -361,7 +363,9 @@ "items": { "type": "string", "enum": [ - "invokeaction" + "invokeaction", + "queryaction", + "cancelaction" ] } } diff --git a/validation/td-json-schema-validation.json b/validation/td-json-schema-validation.json index 6c2d0e4bc..faca346ef 100644 --- a/validation/td-json-schema-validation.json +++ b/validation/td-json-schema-validation.json @@ -322,7 +322,9 @@ { "type": "string", "enum": [ - "invokeaction" + "invokeaction", + "queryaction", + "cancelaction" ] }, { @@ -330,7 +332,9 @@ "items": { "type": "string", "enum": [ - "invokeaction" + "invokeaction", + "queryaction", + "cancelaction" ] } } diff --git a/validation/td-validation.ttl b/validation/td-validation.ttl index a6023ed3b..b8308be6a 100644 --- a/validation/td-validation.ttl +++ b/validation/td-validation.ttl @@ -463,7 +463,11 @@ When a Form instance is within an ActionAffordance instance, the value assigned to op MUST - be invokeaction.

    """^^rdf:HTML . + either be invokeaction, queryaction, + cancelaction or an + Array + containing a combination of these terms. +

    """^^rdf:HTML . :EventAffordanceShape a sh:NodeShape ; sh:targetClass td:EventAffordance ; @@ -633,6 +637,8 @@ td:observeProperty td:unobserveProperty td:invokeAction + td:queryAction + td:cancelAction td:subscribeEvent td:unsubscribeEvent td:readAllProperties