This document introduces an ontology for links and forms, the main hypermedia controls in use on the Web. This ontology offers, among others, a means to reify RDF statements interpreted as links between Web resources. It also provides a versatile exchange format for links and forms in RESTful Web applications.

Hypermedia controls are of importance in the fields of the Web of Things and the Embedded Web, in particular in the W3C Thing Description model and the IETF Constrained RESTful Application Language.

Validation of the document by the Working Group is expected by the end of June 2019.

Introduction

The concept of Representational State Transfer (REST) [[rest]] is at the core of most modern Web applications. The state of a Web resources, exposed via a collection of Web resources, can be browsed by clients by following links and acted upon by submitting forms to servers.

Links and forms have always be present in Web technologies, including HTML [[html]]. Web linking [[rfc8288]] is a fundamental principle of the Web architecture that can be leveraged to drive applications, e.g. when a server returns a link to a newly created resource as the result of a client's request. Conversely, forms, are request templates that servers can expose to clients for them to fill in with client-specific information and send back to servers. Forms are similar in spirit to operation desriptions as defined by the Open API Specification [[openapis]] or by the Hydra RDF vocabulary [[hydra]].

Links and forms are generically referred to as hypermedia controls. They are of increasing importance in the fields of the Web of Things and the Embedded Web, which respectively led to the standardization of the Thing Description (TD) model [[wot-thing-description]] and the Constrained RESTful Application Language (CoRAL) [[coral]]. The present hypermedia controls ontology is an attempt to formalize the concepts these two standards specify.

Axiomatization

Classes

ExpectedResponse

IRI: https://www.w3.org/2019/wot/hypermedia#ExpectedResponse

Communication metadata describing the expected response message.
In the range ofhctl:returns

Form

IRI: https://www.w3.org/2019/wot/hypermedia#Form

A form can be viewed as a statement of "To perform an operation type operation on form context, make a request method request to submission target" where the optional form fields may further describe the required request. In Thing Descriptions, the form context is the surrounding Object, such as Properties, Actions, and Events or the Thing itself for meta-interactions.
In the domainĀ ofhctl:forContentCoding
hctl:forContentType
hctl:forSubProtocol
hctl:hasOperationType
hctl:hasTarget
hctl:returns
In the range oftd:hasForm

Link

IRI: https://www.w3.org/2019/wot/hypermedia#Link

A link can be viewed as a statement of the form "link context has a relation type resource at link target", where the optional target attributes may further describe the resource.
In the domainĀ ofhctl:hasAnchor
hctl:hasRelationType
hctl:hasTarget
hctl:hintsAtMediaType
In the range oftd:hasLink

Object Properties

hasAnchor

IRI: https://www.w3.org/2019/wot/hypermedia#hasAnchor

By default, the context, or anchor, of a link conveyed in the Link header field is the URL of the representation it is associated with, as defined in RFC7231, Section 3.1.4.1, and is serialized as a URI.
Domain includeshctl:Link

hasOperationType

IRI: https://www.w3.org/2019/wot/hypermedia#hasOperationType

Indicates the semantic intention of performing the operation(s) described by the form.
Domain includeshctl:Form

hasRelationType

IRI: https://www.w3.org/2019/wot/hypermedia#hasRelationType

A link relation type identifies the semantics of a link.
Domain includeshctl:Link

hasTarget

IRI: https://www.w3.org/2019/wot/hypermedia#hasTarget

target IRI of a link or submission target of a form.
Domain includeshctl:Form
hctl:Link

returns

IRI: https://www.w3.org/2019/wot/hypermedia#returns

This optional term can be used if, e.g., the output communication metadata differ from input metdata (e.g., output contentType differ from the input contentType). The response name contains metadata that is only valid for the reponse messages.
Domain includeshctl:Form
Range includeshctl:ExpectedResponse

Datatype Properties

forContentCoding

IRI: https://www.w3.org/2019/wot/hypermedia#forContentCoding

Content coding values indicate an encoding transformation that has been or can be applied to a representation. Content codings are primarily used to allow a representation to be compressed or otherwise usefully transformed without losing the identity of its underlying media type and without loss of information. Examples of content coding include "gzip", "deflate", etc.
Domain includeshctl:Form
Range includesschema:Text

forContentType

IRI: https://www.w3.org/2019/wot/hypermedia#forContentType

Assign a content type based on a media type [[IANA-MEDIA-TYPES]] (e.g., 'text/plain') and potential parameters (e.g., 'charset=utf-8') for the media type.
Domain includeshctl:Form
Range includesschema:Text

forSubProtocol

IRI: https://www.w3.org/2019/wot/hypermedia#forSubProtocol

Indicates the exact mechanism by which an interaction will be accomplished for a given protocol when there are multiple options. For example, for HTTP and Events, it indicates which of several available mechanisms should be used for asynchronous notifications such as long polling, websub (also see https://www.w3.org/TR/websub/), or server sent events (also see https://www.w3.org/TR/eventsource/). Please note that there is no restriction on the sub-protocol selection and other mechanisms can also be announced by this subprotocol term.
Domain includeshctl:Form
Range includesschema:Text

hintsAtMediaType

IRI: https://www.w3.org/2019/wot/hypermedia#hintsAtMediaType

Target attribute providing a hint indicating what the media type [IANA-MEDIA-TYPES] of the result of dereferencing the link should be.
Domain includeshctl:Link
Range includesschema:Text

Alignments

Hydra

The following table gives alignment between the hypermedia controls ontology and Hydra, an alternative vocabulary for hypermedia-driven Web APIs. Each row represents a close match between two classes. These alignments are not to be understood as formal semantic equivalences but rather as hints to Hydra users.

hctl:Link hydra:Link
hctl:Form hydra:Operation

Usage Examples

JSON Representation of Links & Forms

Same terms as specified by JSON hyper-schema and the TD model.

OCF example (equivalent to an OpenAPI definition). HTTP in RDF vocabulary.

Reified Links

Either as RDF statements or as reified statements. Primarily for WoT compatibility but also e.g. to include validity metadata.