Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/doriantaylor/owl-transformation

Transformation Functions Ontology
https://github.com/doriantaylor/owl-transformation

Last synced: 24 days ago
JSON representation

Transformation Functions Ontology

Awesome Lists containing this project

README

        

Author
Dorian
Taylor

Created
June 4, 2014

Updated
January 20, 2020

April 10, 2020

June 10, 2020

July 2, 2020

August 27, 2023

September 6, 2023

October 9, 2023

January 30, 2024

October 16, 2024

November 25, 2024

December 3, 2024

Namespace URI
[`https://vocab.methodandstructure.com/transformation#`](https://vocab.methodandstructure.com/transformation#)

Preferred Namespace Prefix
`tfo`

Imported Vocabularies
W3C XML
Schema Definition Language (XSD) 1.1 Part 2: Datatypes

W3C
PROVenance Interchange Ontology (PROV-O)

This document describes functions which transform HTTP
representations, i.e., the actual literal
payloads of HTTP messages.

Many, if not most Web content manipulation tasks are concerned
exclusively with *representations*: the literal *contents* of HTTP
*messages*, rather than abstract or internal representations. Such
manipulations may include excerpting and rearranging files, compressing
and decompressing, cropping and resizing images, and converting between
data formats. If we separate these operations from other *development*
tasks, we can reuse them.

The purpose of this vocabulary is to provide a mechanism for identifying
pure functions that transform opaque data
segments (like HTTP response bodies) and perhaps take additional scalar
parameters (and specify both *named* and *sequential* calling
conventions), and relate a function definition to a concrete
implementation. The vocabulary also provides a mechanism for
[memoizing](https://en.wikipedia.org/wiki/Memoization)
the application of a function to a particular data object, i.e.,
relating a particular input (plus any additional parameters) to a
particular output.

Consider the following example:

@prefix tfo: .
@prefix rdfs: .
@prefix owl: .
@prefix xsd: .
@prefix skos: .
@prefix dct: .
@prefix prov: .
@prefix ex: .

ex:range a tfo:Function ;
skos:prefLabel "Byte Range"@en ;
skos:description "Select a subset of bytes from a given segment."@en ;
tfo:accepts "*/*"^^tfo:content-type ;
tfo:returns "*/*"^^tfo:content-type ;
tfo:parameter ex:start, ex:end ;
tfo:parameter-list ( ex:start ex:end ) ;
tfo:implementation .

ex:start a tfo:Parameter ;
dct:identifier "start"^^xsd:token ;
rdfs:comment "The beginning offset (omission interpreted as zero)."@en ;
owl:maxCardinality 1 ;
rdfs:range xsd:nonNegativeInteger .

ex:end a tfo:Parameter ;
dct:identifier "end"^^xsd:token ;
rdfs:comment "The ending offset (omission interpreted as the end of the input)."@en ;
owl:maxCardinality 1 ;
rdfs:range xsd:nonNegativeInteger .

a tfo:Invocation ;
prov:startedAtTime "2020-01-20T16:46:27.043Z"^^xsd:dateTime ;
prov:endedAtTime "2020-01-20T16:46:27.051Z"^^xsd:dateTime ;
tfo:transform ex:range ;
tfo:input ;
ex:start 1234 ;
ex:end 31337 ;
tfo:output .

The preceding example defines a transformation function, along with its
parameters, and relates it to a fictional implementation embedded in a
JAR somewhere (the exact way a transform's implementation is resolved is
out of scope for this vocabulary). At the bottom is an imaginary
application of the transformation function, along with values for
supplied parameters. The input and output are designated by digest URIs,
which can be resolved to their corresponding representations.

This vocabulary extends the
Data Catalog Vocabulary by making
`tfo:Function` a subclass of
[`dcat:DataService`](https://www.w3.org/TR/vocab-dcat-2/#Class:Data_Service)
and
the
Provenance Ontology
, by way of refining the
[`prov:Activity`](https://www.w3.org/TR/prov-o/#Activity) class and
related properties. For instance, a record can use its inherited PROV
properties to store metrics on the time it took to execute the function
over the input.

## Classes

### Bundles

The Transformation Functions Ontology includes a basic bundling class
that affords the reuse of parameters, e.g. for configuration.

#### `Bundle`

This class provides a basic mechanism to yoke a set of transformation
functions together.

Subclass of:
dcat:Catalog

prov:SoftwareAgent

Properties:
[`tfo:implementation`](https://vocab.methodandstructure.com/transformation#implementation)

Back to Top

### Transforms

A `tfo:Function` is essentially a function definition, specifying input
and output constraints, and parameters in both named and positional
representations.

#### `Function`

This class provides a specification for a transformation function.

Subclass of:
dcat:DataService

prov:Entity

Properties:
[*`tfo:parameter`*](https://vocab.methodandstructure.com/transformation#parameter)

[*`tfo:parameter-list`*](https://vocab.methodandstructure.com/transformation#parameter-list)

[*`tfo:accepts`*](https://vocab.methodandstructure.com/transformation#accepts)

[*`tfo:returns`*](https://vocab.methodandstructure.com/transformation#returns)

[`tfo:prefers`](https://vocab.methodandstructure.com/transformation#prefers)

[`tfo:precedes`](https://vocab.methodandstructure.com/transformation#precedes)

[`tfo:follows`](https://vocab.methodandstructure.com/transformation#follows)

[`tfo:triggers`](https://vocab.methodandstructure.com/transformation#triggers)

[`tfo:by-uri`](https://vocab.methodandstructure.com/transformation#by-uri)

[`tfo:not-by-uri`](https://vocab.methodandstructure.com/transformation#not-by-uri)

Back to Top

#### ~~`MarkupTransform`~~

This class represents the set of transformation functions that operate
exclusively over (HTML/XML) markup.

This class has been deprecated since it only made sense in 2020 when
this vocabulary was being used in a different context.

Subclass of:
tfo:Function

Properties:
[~~`tfo:by-xpath`~~](https://vocab.methodandstructure.com/transformation#by-xpath)

[~~`tfo:not-by-xpath`~~](https://vocab.methodandstructure.com/transformation#not-by-xpath)

Back to Top

### Parameters

`tfo:Parameter` entities encapsulate name, type, and cardinality of a
given function parameter, while `tfo:ParameterList` entities specify
position.

#### `Parameter`

This class provides a specification for a parameter in a given function.

Subclass of:
rdf:Property

Property restrictions:
rdfs:domain

(tfo:Partial

tfo:Bundle)

Properties:
tfo:default

tfo:empty

tfo:shift

tfo:universe

Back to Top

#### `Composite`

A composite parameter has a multi-valued value like a list, tuple, set
or range.

Subclass of:
tfo:Parameter

Properties:
tfo:element

See also:
rdf:Bag

rdf:List

tfo:Range

Back to Top

#### `ParameterList`

This class represents a list with the restriction that its members be
tfo:Parameter nodes.

Subclass of:
rdf:List

Property restrictions:
rdf:first
tfo:Parameter

rdf:resttfo:ParameterList

Back to Top

#### `Range`

A span of numbers or sequence-able objects, like dates.

Subclass of:
rdfs:Container

Properties:
tfo:low

tfo:high

tfo:infimum

tfo:supremum

Back to Top

### Queues

Queues are how we bundle sequences of `tfo:Function` (or `tfo:Partial`)
for execution. “Queue” is something of a misnomer, as the sequence of
transforms need not be explicitly asserted, but rather negotiated on the
fly.

#### `Queue`

A queue is a collection of `tfo:Function` (and/or `tfo:Partial`)
elements, organized either by explicit sequence (via `tfo:member-list`),
or by dynamic sorting at runtime.

An inference rule that cannot be described in RDFS or OWL is that
`?q tfo:member-list ( ?a ?b ) .` implies `?q tfo:member ?a, ?b .`

Given that `tfo:Invocation` is a subclass of `tfo:Partial`, there is
nothing *in principle* preventing the former from being introduced into
a queue. If this happens, we ignore any `tfo:input` or `tfo:output`
statemments associated with the application of the function.

Subclass of:
prov:Activity

Properties:
tfo:member

tfo:member-list

tfo:first

tfo:last

tfo:next

Back to Top

#### `StrictQueue`

A *strict* queue is one for which *all* its elements *must* be executed,
unlike an ordinary queue which only has to *attempt* to run its
contents.

Subclass of:
tfo:Queue

#### `AddressableQueue`

An *addressable* queue is a strict queue intended to hold transforms
that have been invoked through the URL.

Subclass of:
tfo:StrictQueue

Back to Top

#### `FunctionList`

A function list is a list that only holds `tfo:Function` or
`tfo:Partial` entities.

Subclass of:
rdf:List

Property restrictions:
rdf:first

tfo:Function

tfo:Partial

rdf:resttfo:FunctionList

#### `Insertion`

An insertion is a pre-packaged event that manipulates a per-request
instance of a transformation queue. When the result of the transform
being run matches the condition, the contents of the `tfo:Insertion` are
inserted into the target queue.

Subclass of:
tfo:Queue

Properties:
tfo:condition

tfo:target

Back to Top

### Function Invocation

Recording partial and full function invocations is important for
*memoizing* computations.

#### `Invocation`

This class represents an invocation of a transformation function,
connecting a specific input and scalar parameters with its output.

This class supersedes `tfo:Application`, which has been deprecated due
to being too easily confused with a software application versus the
application of a function.

Subclass of:
tfo:Partial

Equivalent to:
~~`tfo:Application`~~

Properties:
tfo:completes

tfo:input

tfo:output

#### `Partial`

This class represents a *partial* application of a transformation
function, affording the encapsulation and re-use of existing parameters.

Subclass of:
prov:Activity

Properties:
tfo:transform

Back to Top

## Properties

### Specifying Transforms

These properties have to do with specifying `tfo:Function` entities and
their parameters.

#### `accepts`

Specifies the list of content-types, in order of preference, that the
function can process.

Domain:
dcat:DataService

Range:
tfo:content-type

rdf:List

Back to Top

#### `returns`

Specifies the list of content-types, in order of preference, that the
function is capable of returning.

Domain:
dcat:DataService

Range:
tfo:content-type

rdf:List

Back to Top

#### `prefers`

Specifies the `tfo:content-type` the transform *prefers* to emit in lieu
of a preference specified by the request. May be a list.

Subproperty of:
tfo:returns

Domain:
tfo:Function

Range:
tfo:content-type

rdf:List

Back to Top

#### `implementation`

URI to the implementation of the function.

The URI is meant to be dereferenced by an internal implementation, e.g.
`file:`, `jar:`, or an idiosyncratic scheme like `urn:x-python:`.

Domain:
tfo:Bundle

Range:
rdfs:Resource

Back to Top

#### `parameter`

Binds a parameter object to its function.

Parameters can either be supplied to the function as key-value pairs or
sequentially.

Domain:
dcat:Resource

Range:
tfo:Parameter

Back to Top

#### `parameter-list`

Specifies the sequence of parameters when the invocation method of the
function is sequential.

Domain:
dcat:Resource

Range:
tfo:ParameterList

Back to Top

#### `element`

This property designates an elementary type to go into the composite
type.

Domain:
tfo:Composite

Range:
rdfs:Datatype

Back to Top

#### `default`

Specifies one or more default values for a parameter.

Domain:
tfo:Parameter

Back to Top

#### `universe`

Specifies the container that contains the “universe” of values that a
paramter can take.

Domain:
tfo:Parameter

Range:
rdfs:Container

Back to Top

#### `empty`

Flags whether an empty parameter value should be treated as input rather
than ignored.

Domain:
tfo:Parameter

Range:
xsd:boolean

Back to Top

#### `shift`

Flags whether a parameter with multiple values but a fixed cardinality
shift off the front of the list rather than truncate off the back.

Domain:
tfo:Parameter

Range:
xsd:boolean

Back to Top

#### `low`

Specifies the *lower* bound of a `tfo:Range`.

Domain:
tfo:Range

Range:
rdfs:Literal

Back to Top

#### `high`

Specifies the *upper* bound of a `tfo:Range`.

Domain:
tfo:Range

Range:
rdfs:Literal

Back to Top

#### `infimum`

Flags whether a `tfo:Range` will be open on the *low* side.

Domain:
tfo:Range

Range:
xsd:boolean

Back to Top

#### `supremum`

Flags whether a `tfo:Range` will be open on the *high* side.

Domain:
tfo:Range

Range:
xsd:boolean

Back to Top

### Specifying Queues

These properties all have to do with providing hints to topological
sorts of transforms within queues, or otherwise explicit sequences.

#### `member`

Denotes a member of a queue.

Domain:
tfo:Queue

Range:

tfo:Function

tfo:Partial

Back to Top

#### `member-list`

Denotes an explicit member list for a queue.

Domain:
tfo:Queue

Range:
tfo:FunctionList

Back to Top

#### `precedes`

Specifies one or more `tfo:Function` that the subject must *precede* in
a queue.

Domain:
tfo:Function

Range:
tfo:Function

Inverse of:
tfo:follows

Back to Top

#### `follows`

Specifies one or more `tfo:Function` that the subject must *follow* in a
queue.

Domain:
tfo:Function

Range:
tfo:Function

Inverse of:
tfo:precedes

Back to Top

#### `next`

Specifies the next queue to run after this one.

Domain:
tfo:Queue

Range:
tfo:Queue

Back to Top

#### `first`

Explicitly specifies a transform that must go *first*.

Sub-property of:
tfo:member

Domain:
tfo:Queue

Range:

tfo:Function

tfo:Partial

Back to Top

#### `last`

Explicitly specifies a transform that must go *last*.

Sub-property of:
tfo:member

Domain:
tfo:Queue

Range:

tfo:Function

tfo:Partial

Back to Top

### Manipulating Queues at Runtime

These properties relate trnasforms to queue insertion events.

#### `triggers`

A `tfo:Function` can trigger an `tfo:Insertion` event on a certain
condition (e.g., successful completion).

Domain:
tfo:Function

Range:
tfo:Insertion

Back to Top

#### `target`

A target queue for the insertion.

Domain:
tfo:Insertion

Range:
tfo:Queue

Back to Top

#### `condition`

An HTTP status code for which the insertion is triggered.

Domain:
tfo:Insertion

Range:
ht:StatusCode

Back to Top

### Applying Transformations

This group of properties is responsible for relating `tfo:Function` to
the actual data objects they transform.

#### `completes`

Identifies a `tfo:Partial` function that this `tfo:Invocation`
completes.

Domain:
tfo:Invocation

Range:
tfo:Partial

Back to Top

#### `transform`

Specifies the transform associated with this particular invocation.

Subproperty of:
prov:used

Domain:
tfo:Partial

Range:
tfo:Function

Back to Top

#### `input`

Specifies the resource that was the input of the transformation
function.

Subproperty of:
prov:used

Domain:
tfo:Invocation

Range:
rdfs:Resource

Back to Top

#### `output`

Specifies the resource that was the output of the transformation
function.

Domain:
tfo:Invocation

Range:
rdfs:Resource

Back to Top

### Constraints

In certain contexts it is useful to pre-declare constraints on what
constitutes valid input for a transform. We can do this either by URI or
by XPath.

#### `by-uri`

Specifies a regular expression for matching against URIs.

Domain:
tfo:Function

Range:
tfo:regexp

Back to Top

#### `not-by-uri`

Specifies a regular expression for *anti*-matching against URIs.

Domain:
tfo:Function

Range:
tfo:regexp

Back to Top

#### `prefix`

Specifies a SHACL prefix declaration for complementing any associated
XPath expression.

Note that the existing `sh:declare` property has a domain of
`owl:Ontology` so we can't use it for this.

Domain:
tfo:MarkupTransform

Range:
sh:PrefixDeclaration

Back to Top

#### ~~`by-xpath`~~

Specifies an XPath expression for matching against markup (HTML/XML)
content.

Domain:
tfo:MarkupTransform

Range:
tfo:xpath

Back to Top

#### ~~`not-by-xpath`~~

Specifies an XPath expression for *anti*-matching against markup
(HTML/XML) content.

Domain:
tfo:MarkupTransform

Range:
tfo:xpath

Back to Top

## Datatypes

Currently there is only the datatype for designating [content
types](https://www.iana.org/assignments/media-types/media-types.xhtml),
and those for regular expressions and XPath.

### `content-type`

A literal that represents a content-type such as that which is found in
the HTTP `Accept:` or `Content-Type:` header.

Restriction of:
xsd:token
matching
`` ^([!#$%&'\*\+\-.^_`|~0-9-A-Za-z]+)(?:/[!#$%&'\*\+\-.^_`|~0-9-A-Za-z]+)?)$ ``

See also:
RFC 7230 — Hypertext Transfer Protocol (HTTP/1.1):
Message Syntax and Routing § 3.2.6: Field Value Components

RFC 7231 — Hypertext Transfer Protocol (HTTP/1.1):
Semantics and Content § 5.3.2: Accept

Back to Top

### `regexp`

A regular expression.

We do not specify a flavour, but in practice we should assume PCRE or
ECMA-262.

Restriction of:
xsd:string

Back to Top

### `iregexp`

A case-insensitive regular expression.

Note that we do not intend to provide the full complement of flags for
regular expressions like `m`, `s`, or `x`.

Subclass of:
tfo:regexp

Restriction of:
xsd:string

Back to Top

### `term`

An RDF term represented as either a CURIE (prefixed term) or IRI.

Union of:
(xsd:QName
xsd:anyURI)

Back to Top

### ~~`xpath`~~

An XPath expression.

Restriction of:
xsd:string

Back to Top