RDF Transformation: Documentation

USE: RDF Transformation Services for Conceptual Models

(Details Use)

The services as well as some basic help can be accessed at https://www.adoxx.org/rdf-transformation/
 
The endpoint provides two services:
  • mm2rdf - for transformation of meta-models to an RDF representation.
  • m2rdf - for transformation of models to an RDF representation.
Additional information can be found at the respective service endpoints.
 

mm2rdf - Meta-model to RDF

To transform an ADOxx meta-model send an HTTP POST request to the endpoint which contains the relevant inputs in its body.
 
Relevant inputs:
  • The meta-model that should be transformed. Currently only the ADOxx XML library format is supported (see [Supported source types]). Can be provided directly or through a link, with the link taking precedence. This is pretty much mandatory.
  • The desired target RDF format to be returned (see [Supported target types]). If none is provided then TriG (`text/trig`) will be used.
  • A URL specifying the graphname to be used for the resulting meta-model graph. If none is provided then one will be generated. Note that this is not relevant if a triple based target RDF format is used.
  • Specify whether the URLs should be "beautified" (default: false). It replaces often used characters with simpler alternatives (removing `(` and `)`, replacing single spaces and `.` with `_` and replacing `&` with `+`) to create nicer looking URLs, but could lead in some cases to two elements getting the same URL (e.g. "A&B" and "A+B" would both be encoded into "A+B" or "C D" and "C_D" would both be encoded into "C_D").
 
The inputs should be provided through valid XML (`application/xml`) in the following structure (order irrelevant):
 
<mm2rdf>
  <targettype><!-- the media type of the desired target RDF format for the meta-model --></targettype>
  <graphname><!-- the URL to use for the meta-model graph --></graphname>
  <beautifyurls><!-- either true or false to specify whether URLs should be "beautified" by replacing certain characters with more common ones --></beautifyurls>
  <metamodel>
    <!-- containing the XML content of the meta-model description. For ADOxx this should contain the root element <library ...> ... </library> -->
    <!-- alternatively the "meteamodel" element can contain an attribute "location" that contains a URL where the meta-model data can be retrieved -->
  </metamodel>
</mm2rdf>
 
 

Supported source types

Only the XML format as generated through the ADOxx 1.5 XML Export of a library is supported right now. The root element in that case should be `<library>`.
 

Supported target types

 
The following target media types are supported (Triple and Quad based):
  • text/turtle - Turtle (.ttl) - Triples
  • application/rdf+xml - RDF XML (.rdf) - Triples
  • application/n-triples - N-Triples (.nt) - Triples
  • application/ld+json - Linked Data JSON (.jsonld) - Quads
  • text/trig - TriG (.trig) - Quads
  • application/n-quads - N-Quads (.nq) - Quads
  • application/trix+xml - TriX (.trix) - Quads
  • application/rdf+thrift - Apache Thrift (.trdf) - Quads
 

m2rdf - Model to RDF

To transform an ADOxx model send an HTTP POST request to the endpoint which contains the relevant inputs in its body.
 
Relevant inputs:
  • The model(s) that should be transformed. Currently only models in the ADOxx XML format are supported (see [Supported source types]). Can be either provided directly or through a link, with the link taking precedence. This is pretty much mandatory.
  • The desired target RDF format to be returned (see [Supported target types]). If none is provided then TriG (`text/trig`) will be used.
  • A base URL to be used for identifiers for the elements of a model. If none is provided then one will be generated (but it might not be pretty).
  • A description of the meta-model the models correspond to. If none is provided then the models will still be transformed, however the quality of the result might not be as good. See [Supported meta-model types] and [Using m2rdf and mm2rdf together] for more information.
  • A URL specifying the graphname of the meta-model graph. This is only relevant if a meta-model description is provided. If this input is missing then the graphname will be guessed based on the provided meta-model RDF description.
  • Specify whether the URLs should be "beautified" (default: false). It replaces often used characters with simpler alternatives (removing `(` and `)`, replacing single spaces and `.` with `_` and replacing `&` with `+`) to create nicer looking URLs, but could lead in some cases to two elements getting the same URL (e.g. "A&B" and "A+B" would both be encoded into "A+B" or "C D" and "C_D" would both be encoded into "C_D"). **Important:** this setting has to be the same as the one used for the transformation of the used meta-model! If the identifiers used in the meta-model RDF don't contain parts like `%20` (escape sequence for a space) then it most likely used the "beautified" URLs.
 
The inputs should be provided through valid XML (`application/xml`) in the following structure (order irrelevant):
 
<m2rdf>
  <targettype><!-- the media type of the desired target RDF format for the model(s) --></targettype>
  <baseurl><!-- the base URL to be used when generating identifiers for the elements of a model --></baseurl>
  <beautifyurls><!-- either true or false to specify whether URLs should be "beautified" by replacing certain characters with more common ones --></beautifyurls>
  <models>
    <!-- containing the model description in one of the supported types -->
    <!-- alternatively the "model" element can contain an attribute "location" that contains a URL where the model data can be retrieved -->
  </models>
  <graphname><!-- the URL of the meta-model graph to be used --></graphname>
  <metamodel>
    <!-- containing the meta-model description in one of the supported types. If the description is a non-XML type (Turtle, TriG etc.) then it is recommended to provide the content as <![CDATA[ ... ]]> and the correct media type must be provided through the "type" attribute in the "metamodel" element -->
    <!-- alternatively the "meteamodel" element can contain an attribute "location" that contains a URL where the meta-model data can be retrieved. It is recommended to also provide the correct media type through a "type" attribute in the "metamodel" element, so that it is loaded properly -->
  </metamodel>
</m2rdf>
 
 
 

Supported source types

 
Only the XML format as generated through the ADOxx 1.5 XML Export of one or several models is supported right now. Either the style from the tool with `<ADOXML>` as the root element or from the AdoScript documentation component with `<adoxml>` as the root element.
 

Supported target types

The following target media types are supported (Triple and Quad based):
  • text/turtle - Turtle (.ttl) - Triples
  • application/rdf+xml - RDF XML (.rdf) - Triples
  • application/n-triples - N-Triples (.nt) - Triples
  • application/ld+json - Linked Data JSON (.jsonld) - Quads
  • text/trig - TriG (.trig) - Quads
  • application/n-quads - N-Quads (.nq) - Quads
  • application/trix+xml - TriX (.trix) - Quads
  • application/rdf+thrift - Apache Thrift (.trdf) - Quads
Note that the transformation puts evey model in a separate graph. If a Triple based approach is used then the statements are no longer assigned to a specific graph, so the distinction between different graphs (and thus models) will be lost.
 
 

Supported meta-model types

 
The following meta-model media types are supported:
  • application/x.adolib15+xml - ADOxx 1.5 Library XML - will be transformed
  • text/turtle - Turtle (.ttl) - Triples
  • application/rdf+xml - RDF XML (.rdf) - Triples
  • application/n-triples - N-Triples (.nt) - Triples
  • application/ld+json - Linked Data JSON (.jsonld) - Quads
  • text/trig - TriG (.trig) - Quads
  • application/n-quads - N-Quads (.nq) - Quads
  • application/trix+xml - TriX (.trix) - Quads
  • application/rdf+thrift - Apache Thrift (.trdf) - Quads
 
 

Using m2rdf and mm2rdf together

One of the uses for the meta-model description as RDF (e.g. from the "mm2rdf - Metamodel to RDF" service) is to improve the transformation of models to RDF using the m2rdf service. For this the meta-model that is provided can be enhanced beforehand by removing statements or adding new statements:
  • Ignore certain elements - Remove statements (most notably their rdf:type from the ComVantage namespace) about classes, relations or attributes that should not be transformed in models.
  • Attribute defining URL - Specify an attribute to be used to set the URL of model elements in RDF. For this the attribute should be described a subproperty of owl:sameAs in the meta-model (Trig: `rdfs:subPropertyOf owl:sameAs ;`).
  • Reference specifying type - Specify an Interref type attribute to be used to denote the rdf:type of model elements in RDF. For this the Interref type attribute should be described as a subproperty of rdf:type (Trig: `rdfs:subPropertyOf rdf:type ;`).
  • Direct definition of triples - A table type attribute to be used for specifying explicit RDF triples in the model.
 
For this several changes are necessary:
  1. State that the specific table attribute is also of type cv:direct_transformation (Trig: `a cv:direct_transformation ;`, note: this in addition to any other rdf:types).
  2. The column of the table that denotes the subject has to be a subproperty of rdf:subject (Trig: `rdfs:subPropertyOf rdf:subject ;`).
  3. The column of the table that denotes the predicate has to be a subproperty of rdf:predicate (Trig: `rdfs:subPropertyOf rdf:predicate ;`).
  4. The column of the table that denotes the object has to be a subproperty of rdf:object (Trig: `rdfs:subPropertyOf rdf:object ;`).