1

Beginning to read about R2RML I wonder if this language would also be suitable for mapping database tables that follow the entity-attribute-value model to RDF and how a simple example would look like.

A survey of RDB to RDF translation approaches and tools refers to a "1 table to n classes" feature as followed:

Ability to use the values of a column as a categorization pattern: tuples of the table will be translated into instances of different ontological classes based on the value of this attribute. This feature can be seen as an extension of the "select conditions" feature as it results in not only filtering out rows, but the filter helps selecting rows to be converted into instance of one class or another.

Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106
  • Would you not just use an RDF store for your EAV data. Would you still need your EAV tables? – Natan Cox Feb 24 '16 at 10:11
  • @NatanCox Indeed, I'd consider that in a green-field project, but in my case the EAV tables are already existing and used on data entry side. – Jens Piegsa Feb 24 '16 at 10:19

1 Answers1

0

A simple mapping could look like this:

[
  rr:logicalTable [ rr:tableName "eav_table" ] ;
  rr:subjectMap [ rr:template "http://example.com/ontology.rdf#Entity/{entity_column}/" ] ;
  rr:predicateObjectMap [
    rr:predicateMap [
      rr:template "http://example.com/ontology.rdf#{attribute_column}"
    ] ;
    rr:objectMap [
      rr:template "http://example.com/ontology.rdf#Value/{value_column}/"
    ]
  ]
] .

If a more sophisticated SQL statement is needed, one would use rr:sqlQuery instead of rr:tableName:

  rr:logicalTable [
    rr:sqlQuery "SELECT entity_column, attribute_column, value_column FROM eav_table;"
  ] ;

For the set of available attributes, the corresponding predicates may be further characterized by additional mappings.

Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106