# mm2rdf - Meta-model to RDF
mm2rdf is a web-service which allows the transformation of meta-models to an RDF representation.
## Features
* Transformation of ADOxx meta-models to the RDF reprsentation developed in the ComVantage project.
- For more information see section "Recommended approach for Serialisation of models as Linked Data" of the public ComVantage deliverable "D3.1.2 - Specification of Modelling Method Including Conceptualisation Outline" available [through the OMiLAB page](https://austria.omilab.org/psm/content/comvantage/info?view=publications)
## Usage
To transform an ADOxx meta-model send an HTTP POST request to this endpoint (same URL) 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](#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](#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):
```xml
```
### 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 ``.
### 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
## Using with "m2rdf - Model to RDF"
One of the uses for the meta-model description as RDF is to improve the transformation of models to RDF through the "m2rdf - Model to RDF" service. For this the transformed meta-model can be enhanced 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:
- 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).
- The column of the table that denotes the subject has to be a subproperty of rdf:subject (Trig: `rdfs:subPropertyOf rdf:subject ;`).
- The column of the table that denotes the predicate has to be a subproperty of rdf:predicate (Trig: `rdfs:subPropertyOf rdf:predicate ;`).
- The column of the table that denotes the object has to be a subproperty of rdf:object (Trig: `rdfs:subPropertyOf rdf:object ;`).