Writing the RDFme mappings is about connecting the Drupal content type fields with ontology classes and properties.
The feature allows to specify a RDF property per each field and map the value directly or define some simple trasformations (e.g. adding node url, node id etc.) The module is based on the Drupal RDF API but gives more flexibility in defining the mappins and also provides a different interface that gathers all possible mappings on a single screen.
For both cases before starting with the mappings its needed to tell RDFme about the namespaces that shall be used. The namespaces added in RDFme settings are exported together with the data and only in that case the RDF/XML file shall be valid (rdf vocabulary is present by default).
Use Case #1: Mappings for the standard Drupal installation.
Namespaces used:
- rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
- foaf: http://xmlns.com/foaf/0.1/
- sioc: http://rdfs.org/sioc/ns#
- dcterms: http://purl.org/dc/terms/
- skos: http://www.w3.org/2004/02/skos/core#
Example resources: [ Get Mappings File ] [ Get Sample RDF/XML ]
The table below presents mappings for Drupal Page content type and related data to RDF.
Content Type:
Page
|
||||
RDF Class:
foaf:Document
|
||||
URI Pattern:
@@@url@@@node/@@@nid@@@/tordf
|
||||
Field Name | RDF Property | rdf:resource | Pattern | External Property |
Creator ID | sioc:has_creator | rdf:resource | @@@url@@@user/@@@value@@@/tordf | – |
Creator name | dcterms:creator | – | – | – |
Created | dcterms:created | – | – | – |
Comment | sioc:has_reply | rdf:resource | @@@url@@@node/@@@nid@@@/@@@value@@@/tordf | – |
Title | dcterms:title | – | – | – |
Body | sioc:content | – | – | – |
Taxonomy | rdfs:seeAlso | rdf:resource | – | external |
Source URL | foaf:page | rdf:resource | – | – |
Content Type:
– (subclass of Page)
|
||||
RDF Class:
skos:Concept
|
||||
URI Pattern:
@@@url@@@node/@@@nid@@@/class/@@@id@@@/tordf
|
||||
Field Name | RDF Property | rdf:resource | Pattern | External Property |
taxonomy | skos:prefLabel | – | – | n/a |
Content Type:
User
|
||||
RDF Class:
foaf:OnlineAccount
|
||||
URI Pattern:
@@@url@@@user/@@@uid@@@/tordf
|
||||
Field Name | RDF Property | rdf:resource | Pattern | External Property |
Name | foaf:accountName | – | – | – |
Content Type:
Comment
|
||||
RDF Class:
sioc:Post
|
||||
URI Pattern:
@@@url@@@node/@@@nid@@@/@@@cid@@@/tordf
|
||||
Field Name | RDF Property | rdf:resource | Pattern | External Property |
Parent | sioc:reply_of | rdf:resource | @@@url@@@node/@@@value@@@/tordf | – |
Creator ID | sioc:has_creator | rdf:resource | @@@url@@@user/@@@value@@@/tordf | – |
Creator name | dcterms:creator | – | – | – |
Title | dcterms:title | – | – | – |
Body | sioc:content | – | – | – |
Created | dcterms:created | – | – | – |
Use Case #2: Mappings for Idea Management System.
The second case is definition of mappings for the content types that we used in our Gi2MO Idea Stream instance.
On top of the regular Drupal content, the instance has following Content Types specific for Idea Management Systems:
- Idea
- Idea Review
- Idea Contest
Namespaces used in this example are:
- rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
- foaf: http://xmlns.com/foaf/0.1/
- dcterms: http://purl.org/dc/terms/
- gi2mo: http://purl.org/gi2mo/ns#
Example resources: [ Get Mappings File ] [ Get Sample RDF/XML ]
Similar as in the first example we present a full mappings table that matches each content type with Gi2MO class and then every data field with respectable ontology property.
Content Type:
Idea
|
||||
RDF Class:
gi2mo:Idea
|
||||
URI Pattern:
@@@url@@@node/@@@nid@@@/tordf
|
||||
Field Name | RDF Property | rdf:resource | Pattern | External Property |
Creator ID | gi2mo:hasCreator | rdf:resource | @@@url@@@user/@@@value@@@/tordf | – |
Created | dcterms:created | – | – | – |
Comment | gi2mo:hasComment | rdf:resource | @@@url@@@node/@@@nid@@@/@@@value@@@/tordf | – |
Title | dcterms:title | – | – | – |
Body | gi2mo:content | – | – | – |
Taxonomy | gi2mo:hasCategory | – | – | – |
Source URL | foaf:page | rdf:resource | – | – |
Workflow | gi2mo:hasStatus | – | – | – |
Rating (Voting API) | gi2mo:hasReview | rdf:resource | – | external |
Idea Contest | gi2mo:hasIdeaContest | rdf:resource | @@@url@@@node/@@@value@@@/tordf | – |
Idea Review | gi2mo:hasReview | rdf:resource | @@@url@@@node/@@@value@@@/tordf | – |
Content Type:
– (subclass of Idea, describes Rating in detail)
|
||||
RDF Class:
gi2mo:UpDownRating
|
||||
URI Pattern:
@@@url@@@node/@@@nid@@@/class/@@@id@@@/tordf
|
||||
Field Name | RDF Property | rdf:resource | Pattern | External Property |
votingapi_rating | gi2mo:ratingValue | – | – | n/a |
rdfme_literal_value | dcterms:description | – | “User up/down voting value” | n/a |
Content Type:
Idea Review
|
||||
RDF Class:
gi2mo:Review
|
||||
URI Pattern:
@@@url@@@node/@@@nid@@@/tordf
|
||||
Field Name | RDF Property | rdf:resource | Pattern | External Property |
Creator ID | gi2mo:hasCreator | rdf:resource | @@@url@@@user/@@@value@@@/tordf | – |
Created | dcterms:created | – | – | – |
Comment | gi2mo:hasComment | rdf:resource | @@@url@@@node/@@@nid@@@/@@@value@@@/tordf | – |
Title | dcterms:title | – | – | – |
Body | gi2mo:content | – | – | – |
Taxonomy | dcterms:description | – | – | – |
Source URL | foaf:page | rdf:resource | – | – |
Rating | gi2mo:hasSupplement | rdf:resource | – | external |
Content Type:
– (subclass of Idea Review, describes Rating in detail)
|
||||
RDF Class:
gi2mo:MinMaxRating
|
||||
URI Pattern:
@@@url@@@node/@@@nid@@@/class/@@@id@@@/tordf
|
||||
Field Name | RDF Property | rdf:resource | Pattern | External Property |
field_review_rating | gi2mo:ratingValue | – | – | n/a |
rdfme_literal_value | dcterms:description | – | “Rating from 1..10 assigned by the reviewer” | n/a |
Content Type:
Idea Contest
|
||||
RDF Class:
gi2mo:IdeaContest
|
||||
URI Pattern:
@@@url@@@node/@@@nid@@@/tordf
|
||||
Field Name | RDF Property | rdf:resource | Pattern | External Property |
Creator ID | gi2mo:hasCreator | rdf:resource | @@@url@@@user/@@@value@@@/tordf | – |
Created | dcterms:created | – | – | – |
Title | dcterms:title | – | – | – |
Body | gi2mo:content | – | – | – |
Source URL | foaf:page | rdf:resource | – | – |
Content Type:
User
|
||||
RDF Class:
gi2mo:User
|
||||
URI Pattern:
@@@url@@@user/@@@uid@@@/tordf
|
||||
Field Name | RDF Property | rdf:resource | Pattern | External Property |
Name | foaf:accountName | – | – | – |
Created | dcterms:created | – | – | – |
Content Type:
Comment
|
||||
RDF Class:
gi2mo:Comment
|
||||
URI Pattern:
@@@url@@@node/@@@nid@@@/@@@cid@@@/tordf
|
||||
Field Name | RDF Property | rdf:resource | Pattern | External Property |
Parent | sioc:reply_of | rdf:resource | @@@url@@@node/@@@value@@@/tordf | – |
Creator ID | sioc:has_creator | rdf:resource | @@@url@@@user/@@@value@@@/tordf | – |
Creator name | dcterms:creator | – | – | – |
Title | dcterms:title | – | – | – |
Body | gi2mo:content | – | – | – |
Created | dcterms:created | – | – | – |
Known Limitations
- Taxonomies are not fully supported yet, RDFme does not make a distinction between tags and other categories. In practice this makes currently impossible to do the mappings according to Gi2MO specification (tags and categories mapped with different classes)
- It is not possible to define a mapping table that will convert literals into another set of literals (e.g. “I like plums” to “I like peaches”). In case of Gi2MO ontology this impacts mappings of workflows to class instances representing Idea Status.