org.d2rq.mapgen
Class R2RMLTarget

java.lang.Object
  extended by org.d2rq.mapgen.R2RMLTarget
All Implemented Interfaces:
Target

public class R2RMLTarget
extends Object
implements Target


Constructor Summary
R2RMLTarget()
           
 
Method Summary
 void addPrefix(String prefix, String uri)
          Adds a prefix mapping.
 void close()
          Will be called when generation is complete.
 void generateColumnProperty(Property property, TableName tableName, Identifier column, DataType datatype)
          Generates a mapping from one column to a property.
 void generateDatabase(SQLConnection connection, String startupSQLScript)
          Generates a database connection.
 void generateEntities(Resource class_, TableName tableName, TemplateValueMaker iriTemplate, List<Identifier> blankNodeColumns)
          Generates a mapping from one table to a set of entities.
 void generateEntityLabels(TemplateValueMaker labelTemplate, TableName tableName)
          Generates a label template for the entities of one table, as part of that table's mapping.
 void generateLinkProperty(Property property, TableName tableName, ForeignKey fk1, ForeignKey fk2)
          Generates a mapping from one N:M table to a property.
 void generateRefProperty(Property property, TableName tableName, ForeignKey foreignKey)
          Generates a mapping from a foreign key to a property.
 Mapping getMapping()
           
 void init(String baseIRI, Resource generatedOntology, boolean serveVocabulary, boolean generateDefinitionLabels)
          Called before generation starts.
 void skipColumn(TableName table, Identifier column, String reason)
          Informs the Target instance that a certain column has been skipped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

R2RMLTarget

public R2RMLTarget()
Method Detail

getMapping

public Mapping getMapping()

init

public void init(String baseIRI,
                 Resource generatedOntology,
                 boolean serveVocabulary,
                 boolean generateDefinitionLabels)
Description copied from interface: Target
Called before generation starts.

Specified by:
init in interface Target
Parameters:
baseIRI - A base IRI for absolutizing relative IRI templates
generatedOntology - A URI that identifies the generated vocabulary
serveVocabulary - true iff the generated mapping is supposed to include vocabulary definitions
generateDefinitionLabels - true iff the generated mapping is supposed to include labels for generated classes and properties

addPrefix

public void addPrefix(String prefix,
                      String uri)
Description copied from interface: Target
Adds a prefix mapping.

Specified by:
addPrefix in interface Target

generateDatabase

public void generateDatabase(SQLConnection connection,
                             String startupSQLScript)
Description copied from interface: Target
Generates a database connection.

Specified by:
generateDatabase in interface Target
Parameters:
connection - Connection information to the database
startupSQLScript - A SQL file that was used to populate/initialize the database connection; may be null

generateEntities

public void generateEntities(Resource class_,
                             TableName tableName,
                             TemplateValueMaker iriTemplate,
                             List<Identifier> blankNodeColumns)
Description copied from interface: Target
Generates a mapping from one table to a set of entities. Either the IRI template or the list of blank node columns will be given, the other will be null.

Specified by:
generateEntities in interface Target
Parameters:
class_ - RDFS/OWL class of the entities; may be null
tableName - Name of the table
iriTemplate - IRI template for generating entity IRIs, possibly relative
blankNodeColumns - List of columns for generating unique blank nodes

generateEntityLabels

public void generateEntityLabels(TemplateValueMaker labelTemplate,
                                 TableName tableName)
Description copied from interface: Target
Generates a label template for the entities of one table, as part of that table's mapping.

Specified by:
generateEntityLabels in interface Target
Parameters:
labelTemplate - Template for the labels
tableName - Name of the table

generateColumnProperty

public void generateColumnProperty(Property property,
                                   TableName tableName,
                                   Identifier column,
                                   DataType datatype)
Description copied from interface: Target
Generates a mapping from one column to a property.

Specified by:
generateColumnProperty in interface Target
Parameters:
property - The target property
tableName - The source table
column - The source column
datatype - The column's datatype; guaranteed to be non-null

generateRefProperty

public void generateRefProperty(Property property,
                                TableName tableName,
                                ForeignKey foreignKey)
Description copied from interface: Target
Generates a mapping from a foreign key to a property.

Specified by:
generateRefProperty in interface Target
Parameters:
property - The target property
tableName - The table on which the foreign key constraint is defined
foreignKey - The foreign key

generateLinkProperty

public void generateLinkProperty(Property property,
                                 TableName tableName,
                                 ForeignKey fk1,
                                 ForeignKey fk2)
Description copied from interface: Target
Generates a mapping from one N:M table to a property.

Specified by:
generateLinkProperty in interface Target
Parameters:
property - The target property
tableName - Name of the N:M table
fk1 - The foreign key constraint on the N:M table that points to the table containing subjects
fk2 - The foreign key constraint on the N:M table that points to the table containing objects

skipColumn

public void skipColumn(TableName table,
                       Identifier column,
                       String reason)
Description copied from interface: Target
Informs the Target instance that a certain column has been skipped. May be useful for logging etc.

Specified by:
skipColumn in interface Target

close

public void close()
Description copied from interface: Target
Will be called when generation is complete.

Specified by:
close in interface Target