org.d2rq.mapgen
Interface Target

All Known Implementing Classes:
D2RQTarget, OntologyTarget, R2RMLTarget

public interface Target

A target that receives information from the MappingGenerator and represents that information in some other form. This allows us to use the same mapping generator code to output in different formats.


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 table, 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 table, TemplateValueMaker iriTemplate, List<Identifier> blankNodeColumns)
          Generates a mapping from one table to a set of entities.
 void generateEntityLabels(TemplateValueMaker labelTemplate, TableName table)
          Generates a label template for the entities of one table, as part of that table's mapping.
 void generateLinkProperty(Property property, TableName table, ForeignKey fk1, ForeignKey fk2)
          Generates a mapping from one N:M table to a property.
 void generateRefProperty(Property property, TableName table, ForeignKey foreignKey)
          Generates a mapping from a foreign key to a property.
 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.
 

Method Detail

init

void init(String baseIRI,
          Resource generatedOntology,
          boolean serveVocabulary,
          boolean generateDefinitionLabels)
Called before generation starts.

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

void addPrefix(String prefix,
               String uri)
Adds a prefix mapping.


generateDatabase

void generateDatabase(SQLConnection connection,
                      String startupSQLScript)
Generates a database connection.

Parameters:
connection - Connection information to the database
startupSQLScript - A SQL file that was used to populate/initialize the database connection; may be null

generateEntities

void generateEntities(Resource class_,
                      TableName table,
                      TemplateValueMaker iriTemplate,
                      List<Identifier> blankNodeColumns)
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.

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

generateEntityLabels

void generateEntityLabels(TemplateValueMaker labelTemplate,
                          TableName table)
Generates a label template for the entities of one table, as part of that table's mapping.

Parameters:
labelTemplate - Template for the labels
table - Name of the table

generateColumnProperty

void generateColumnProperty(Property property,
                            TableName table,
                            Identifier column,
                            DataType datatype)
Generates a mapping from one column to a property.

Parameters:
property - The target property
table - The source table
column - The source column
datatype - The column's datatype; guaranteed to be non-null

generateRefProperty

void generateRefProperty(Property property,
                         TableName table,
                         ForeignKey foreignKey)
Generates a mapping from a foreign key to a property.

Parameters:
property - The target property
table - The table on which the foreign key constraint is defined
foreignKey - The foreign key

generateLinkProperty

void generateLinkProperty(Property property,
                          TableName table,
                          ForeignKey fk1,
                          ForeignKey fk2)
Generates a mapping from one N:M table to a property.

Parameters:
property - The target property
table - 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

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


close

void close()
Will be called when generation is complete.