# Copyright 2016 ITEA 12004 SEAS Project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
@prefix rdf: .
@prefix owl: .
@prefix rdfs: .
@prefix xsd: .
@prefix dc: .
@prefix vann: .
@prefix voaf: .
@prefix vs: .
@prefix foaf: .
@prefix rdfp: .
@base .
rdfp: rdf:type voaf:Vocabulary , owl:Ontology ;
dc:title "The RDF Presentation ontology"@en ;
dc:description """## RDF Presentation and RDF Presentation Negotiation
**To cite our work:**
> Maxime Lefrançois _Interopérabilité sémantique libérale pour les services et les objets_, Actes de la 17ème conférence Extraction et Gestion des Connaissances, EGC, Jan 2017, Grenoble, France - ([PDF](http://www.maxime-lefrancois.info/docs/Lefrancois-EGC2017-Interoperabilite.pdf) - [BibTeX](Lefrancois-EGC2017-Interoperabilite.bib))
An RDF graph can be presented in several ways, using different media types. Examples of RDF media types include `application/rdf+xml`, `text/turtle`, `application/json+ld`.
Today, most of the content consumed/produced/published, on the Web is not presented in RDF.
In the Web of Things, HTTP servers and clients would rather exchange lightweight documents, potentially binary.
Currently, most existing RDF Presentations generically apply to any RDF graph, at the cost of being heavy text-based documents.
Yet, lightweight HTTP servers/clients could be better satisfied with consuming/producing/publishing lightweight documents, may its structure be application-specific.
On the other hand, various formalisms have been developed:
- to lift documents to RDF. Examples include [RML mappings](http://rml.io), [XSPARQL](http://xsparql.deri.org/), [SPARQL-Generate](http://w3id.org/sparql-generate/);
- to lower RDF to documents. Examples include [XSPARQL](http://xsparql.deri.org/), [STTL, aka SPARQL-Template](https://ns.inria.fr/sparql-template/);
- to validate RDF graphs. Examples include simple [SPIN](http://spinrdf.org/), [ShEx](http://shexspec.github.io), [SHACL](https://www.w3.org/TR/shacl/).
For a given range of RDF graphs and a specific media types, an RDF Presentation is a combination of lifting, lowering, and validation rules. With these rules, one can coherently interpret a representation as RDF (lift), validate the RDF graph, and generate back the representation from the RDF graph (lower).
While sending any kind of document, potentially lightweight, an HTTP server/client may refer to the specific RDF Presentation that is used. Then, the HTTP client/server can lift the document to RDF, and validate it.
Similarly, while requesting for an RDF graph, an HTTP server/client may inform the client/server what representation it prefers. Then, the client/server can validate the RDF graph, then lower it into a document.
### RDF Presentation description
Following the Linked Data principles, RDF Presentations are given uniform identifiers (URIs), and an RDF description of these presentations can be retrieved at their URI.
The RDFP vocabulary can be used to describe RDF Presentations and the range of RDF graphs they apply to. It can be accessed at this URI: https://w3id.org/rdfp/ using content negotiation (i.e., set HTTP Header field `Accept` to one of the RDF syntaxes media types, or access it directly in [turtle](index.ttl), or in [RDF/XML](index.rdf).
For example, the RDF Presentation identified by https://w3id.org/rdfp/example/graph/xml 303 redirects to https://w3id.org/rdfp/example/description where it is described as follows:
```
@prefix rdfp: .
@base .
a rdfp:Presentation ;
rdfp:mediaType "application/xml" ;
rdfp:liftingRule ;
rdfp:loweringRule ;
rdfs:isDefinedBy .
```
A full example RDF graph that uses this vocabulary can be found at URI https://w3id.org/rdfp/example/description. Use content negotiation, or access it directly in [turtle](https://w3id.org/rdfp/example/description.ttl), or in [RDF/XML](https://w3id.org/rdfp/example/description.rdf).
The RDFP vocabulary describes web resources, RDF graphs, ontologies, and their representations.
The URI of a named graph is the identification of that graph in the sense of the W3C Architecture of the World Wide Web, Volume One.
The graph is the content, and that graph can be represented by many different documents that can then be exchanged on the Web.
## Referring to an RDF Presentation
The RDF Presentation qualifies the representation type. Following the general architecture principles defined in [W3C Architecture of the World Wide Web, Volume One](https://www.w3.org/TR/2004/REC-webarch-20041215/), we keep orthogonal the identification and representation concepts. Arguably, the representation type (the media type) should be annotated with a link to the RDF Presentation used.
Although new media types could have a parameter that refers to its presentation, such as: `application/seas;p="https://w3id.org/rdfp/example/graph/xml"`.
This link cannot be set by a global media type parameter, as per [RFC 2045, Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies](https://tools.ietf.org/html/rfc2045):
> There are NO globally-meaningful parameters that apply to all media types. Truly global mechanisms are best addressed, in the MIME model, by the definition of additional Content-* header fields.
We hence introduce HTTP header field `Content-Presentation` for this purpose. The value of this field is any absolute URI, that identifies the RDF Presentation of the represented RDF graph.
Using this header properly, any existing server can be adapted to behave "as if" it was producing RDF: the client simply needs to dereference the presentation link, and use the associated lifting rule to interpret the retrieved document as RDF.
Equally important, a lightweight client/server can send lightweight binary messages, while still letting its server/client the chance to interpret the message body as RDF.
## RDF Presentation Negotiation
RDF Presentation Negotiation is a way for the client to state its presentation preferences for the response message body.
To achieve this, we introduce HTTP header field `Accept-Presentation`. The value of this field is any (absolute) URI, that identifies the RDF Presentation the clients would like the server to use to encode the response RDF graph.
Using this header properly, a lightweight client can request a compliant server to encode its responses in a specific format, hence transferring all the computation cost on the server.
## Directly referring to the lowering rule, validation rule, or lifting rule
In some situations, it may seem unreasonable to expect the client/server to:
1. dereference the RDF Presentation URI,
1. parse the RDF document,
1. navigate to the lifting, validation, or lowering rule of the RDF Presentation.
Hence, in a future version of RDFP, we may introduce additional HTTP header fields to directly refer to these rules. For example:
- HTTP header field `Content-Lifting-Rule` would mean that the receiver may use this lifting to generate RDF from the content;
- HTTP header field `Accept-Lowering-Rule` would mean that the client expects the server to use this lowering rule to generate a content it can process.
## Implementation over Jersey
[`rdfp-jersey-server`](get-started.html) is an extension of Jersey that eases the development of RESTful services that produce and consume RDF. It hides the RDF Presentation description and RDF Presentation Negotiation parts, and lets the end developer focus on manipulating RDF graphs as [Apache Jena](http://jena.apache.org/) models.
## Related projects
The RDFP vocabulary is used in the following related projects:
- [ONTOP - Ontology Platform](https://w3id.org/ontop/);
`rdfp-jersey-server` is used in the following related projects:
- [PEP - Process Execution Platform](https://w3id.org/pep/);
- [CNR Smart Charging Provider SEAS pilot platform](http://cnr-seas.cloudapp.net/scp/).
## Contact
maxime.lefrancois.86@gmail.com
http://maxime-lefrancois.info/
"""@en ;
dc:creator ;
dc:issued "2016-08-31"^^xsd:date ;
dc:modified "2016-09-08"^^xsd:date ;
dc:license ;
vann:preferredNamespacePrefix "rdfp" ;
vann:preferredNamespaceUri rdfp: ;
owl:versionIRI ;
owl:versionInfo "v1.0" .
rdfp:Resource a owl:Class ;
rdfs:label "Resource"@en ;
rdfs:comment """The class of web resources, that have one or several representations."""@en ;
vs:term_status "testing" ;
rdfs:isDefinedBy .
rdfp:Representation a owl:Class ;
rdfs:label "Representation"@en ;
rdfs:comment """The class of web representations. A representation is also a resource."""@en ;
rdfs:subClassOf rdfp:Resource ;
vs:term_status "testing" ;
rdfs:isDefinedBy .
rdfp:representedBy a owl:ObjectProperty ;
rdfs:label "represented by"@en ;
rdfs:comment """Links a resource to one of its representations. It is expected that the representation has a media type."""@en ;
vs:term_status "testing" ;
rdfs:isDefinedBy .
rdfp:mediaType a owl:DatatypeProperty ;
rdfs:label "media type"@en ;
rdfs:comment """Links a representation to its media type."""@en ;
vs:term_status "testing" ;
rdfs:isDefinedBy .
rdfp:alias a owl:ObjectProperty ;
rdfs:label "alias"@en ;
rdfs:comment """Links a representation to one of its aliases.
According to the Web architecture design principles, there should never be two following rdfp:alias links."""@en ;
vs:term_status "testing" ;
rdfs:isDefinedBy .
rdfp:GraphDescription a owl:Class ;
rdfs:label "Graph Description"@en ;
rdfs:comment """Instances of rdfp:GraphDescription describe RDF Graphs in terms of validation and presentation.
A rdfp:GraphDescription may be linked to one or more validation rules.
A rdfp:GraphDescription may be linked to one or more instances or rdfp:Presentation.
For example,
```
a rdfp:GraphDescription ;
rdfp:validationRule ;
rdfp:presentedBy .
```
We propose an alignment of this resource with sd:Graph, but this is part of [another document](https://w3id.org/rdfp/align/sd).
"""@en ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:Graph a owl:Class ;
rdfs:label "Graph"@en ;
rdfs:comment """Instances of rdfp:Graph are RDF graph resources that may have several representations.
For example,
```
a rdfp:Graph ;
rdfp:describedBy ;
rdfp:representedBy .
```
We propose an alignment of this resource with rdfg:Graph, but this is part of [another document](https://w3id.org/rdfp/align/rdfg).
"""@en ;
rdfs:subClassOf rdfp:Resource ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:GraphPresentation a owl:Class ;
rdfs:label "Presentation"@en ;
rdfs:comment """Instances of rdfp:GraphPresentation describe RDF Graph presentations in terms of lifting, lowering, and validation rules.
- lifting rules can be used to generate a RDF graph from a document, using for instance a RML mapping, a XSPARQL rule, or SPARQL-Generate rule;
- lowering rules can be used to generate a document from a RDF graph, using for instance a STTL rule (aka. SPARQL-Template).
- validation rules can be used to validate a document, using for instance a regular expression, a XSD Schema, or a JSON Schema
For example,
https://w3id.org/rdfp/example/graph/xml> a rdfp:GraphPresentation ;
rdfp:mediaType "application/xml" ;
rdfp:liftingRule ;
rdfp:loweringRule ."""@en ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:describedBy a owl:ObjectProperty ;
rdfs:label "described by"@en ;
rdfs:comment """Links a RDF graph to its description."""@en ;
rdfs:domain rdfp:Graph ;
rdfs:range rdfp:GraphDescription ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:presentedBy a owl:ObjectProperty ;
rdfs:label "presented by"@en ;
rdfs:comment """Links a RDF graph description to one of its presentation means."""@en ;
rdfs:domain rdfp:GraphDescription ;
rdfs:range rdfp:GraphPresentation ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:presentationFor a owl:ObjectProperty ;
rdfs:label "presentation for"@en ;
rdfs:comment """Links a RDF graph presentation to the description of RDF graphs it may present."""@en ;
rdfs:domain rdfp:GraphPresentation ;
rdfs:range rdfp:GraphDescription ;
owl:inverseOf rdfp:presentedBy ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:validationRule a owl:ObjectProperty ;
rdfs:label "validation rule"@en ;
rdfs:comment """Links a graph description (resp. a presentation) to a validation rule against which graphs conforming to this description (resp. representations conforming to this presentation) should validate. Such resources may have various representations.
For example, resource identified by `` may have a representation as a [SPARQL ASK query](https://www.w3.org/TR/sparql11-query/#ask), as a [ShEx expression](http://shexspec.github.io/), or as a [SHACL shape](https://www.w3.org/TR/shacl/)."""@en ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:GraphValidationRule a owl:Class ;
rdfs:label "Graph Validation Rule"@en ;
rdfs:comment """The class of graph validation rules resources.
Such resources may have various representations:
- a RDF Graph representation that contains SHACL instances;
- a ShEx document;
- a SPARQL ASK rule.
For example,
```
a rdfp:GraphDescription ;
rdfp:validationRule .
```
An RDFP engine willing to validate the conformance of a graph G described by `` with SPARQL ASK queries should follow these steps:
- operate a GET request at URI `` with accepted media type "application/sparql-query"
- run the retrieved SPARQL ASK query against G.
- If the result is true, then G validates against ``."""@en ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:RepresentationValidationRule a owl:Class ;
rdfs:label "Representation Validation Rule"@en ;
rdfs:comment """The class of representation validation rules resources. Such resources may have various representations:
- a JSON Schema for JSON representations;
- a XML Schema for XML representations;
- a XPath query that must retrieve an element to validate."""@en ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:liftingRule a owl:ObjectProperty ;
rdfs:label "lifting rule"@en ;
rdfs:comment """Links a graph presentation to a resource that enables to lift documents to RDF."""@en ;
rdfs:domain rdfp:GraphRepresentation ;
rdfs:range rdfp:LiftingRule ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:LiftingRule a owl:Class ;
rdfs:label "Lifting Rule"@en ;
rdfs:comment """The class of rules that enable RDF lifting.
Such rules may have various representations, such as a [RML mapping](http://rml.io), a [SPARQL-Generate](https://w3id.org/sparql-generate) or a [XSPARQL query](http://xsparql.deri.org/)."""@en ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:loweringRule a owl:ObjectProperty ;
rdfs:label "lowering rule"@en ;
rdfs:comment """Links a graph description to a resource that enables to lower a RDF Graph to a document."""@en ;
rdfs:domain rdfp:GraphRepresentation ;
rdfs:range rdfp:LoweringRule ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .
rdfp:LoweringRule a owl:Class ;
rdfs:label "Lowering Rule"@en ;
rdfs:comment """The class of rules that enable RDF lowering. Such rules may have various representations, such as a [STTL rule](https://ns.inria.fr/sparql-template/)."""@en ;
vs:term_status "testing" ;
rdfs:isDefinedBy rdfp: .