org.d2rq.mapgen
Interface MappingStyle

All Known Implementing Classes:
D2RQMappingStyle, DirectMappingStyle

public interface MappingStyle

A style of default mapping. Allows customizing the mapping generator to generate different default mappings. Encapsulates the differences between W3C's Direct Mapping and the old D2RQ-style default mapping.


Method Summary
 String getBaseIRI()
           
 Property getColumnProperty(TableName tableName, Identifier column)
          Creates a property for a table column.
 TemplateValueMaker getEntityIRITemplate(TableDef table, Key columns)
          Returns an IRI template to be used to uniquely identify the records in a table.
 TemplateValueMaker getEntityLabelTemplate(TableName tableName, Key columns)
          Creates a best-effort template for human-readable labels for the records in a table, based on a given list of columns.
 List<Identifier> getEntityPseudoKeyColumns(List<ColumnDef> columns)
          Returns a list of columns to be used to form blank node identifiers for the records in a table that has no suitable unique/primary key
 Property getForeignKeyProperty(TableName tableName, ForeignKey foreignKey)
          Creates a property for a foreign key relationship between two tables.
 Resource getGeneratedOntologyResource()
          Creates a resource that represents the ontology that defines all generated classes and properties.
 Property getLinkProperty(TableName linkTable)
          Creates a property for an N:M link table.
 MappingGenerator getMappingGenerator()
           
 PrefixMapping getPrefixes()
          Returns a prefix mapping with convenient prefix declarations for this style of mapping.
 Resource getTableClass(TableName tableName)
          Creates a class for a table.
 

Method Detail

getMappingGenerator

MappingGenerator getMappingGenerator()
Returns:
A mapping generator that creates a mapping according to this style

getBaseIRI

String getBaseIRI()
Returns:
An absolute IRI that will be used as a base for instance and vocabulary namespaces

getPrefixes

PrefixMapping getPrefixes()
Returns a prefix mapping with convenient prefix declarations for this style of mapping. This could be mappings for the instance and vocabulary namespace(s) used by the style, and any vocabulary namespaces used.

Returns:
A prefix mapping

getEntityIRITemplate

TemplateValueMaker getEntityIRITemplate(TableDef table,
                                        Key columns)
Returns an IRI template to be used to uniquely identify the records in a table. Can be invoked with a null argument to indicate that all records should receive the same IRI. Note: The pattern may produce relative IRIs, assuming the base IRI from getBaseIRI().

Parameters:
table - The table definition
columns - The primary or unique key to be used, or null
Returns:
An IRI template

getEntityPseudoKeyColumns

List<Identifier> getEntityPseudoKeyColumns(List<ColumnDef> columns)
Returns a list of columns to be used to form blank node identifiers for the records in a table that has no suitable unique/primary key

Parameters:
columns - The column definition
Returns:
A column list

getGeneratedOntologyResource

Resource getGeneratedOntologyResource()
Creates a resource that represents the ontology that defines all generated classes and properties.

Returns:
An ontology resource representing the generated terms

getTableClass

Resource getTableClass(TableName tableName)
Creates a class for a table.

Parameters:
tableName - The table
Returns:
A class resource representing the table

getColumnProperty

Property getColumnProperty(TableName tableName,
                           Identifier column)
Creates a property for a table column.

Parameters:
tableName - The table
column - A column on the table
Returns:
A property representing the column

getForeignKeyProperty

Property getForeignKeyProperty(TableName tableName,
                               ForeignKey foreignKey)
Creates a property for a foreign key relationship between two tables.

Parameters:
tableName - The source table
foreignKey - A foreign key defines on the source table
Returns:
A property representing the relationship

getLinkProperty

Property getLinkProperty(TableName linkTable)
Creates a property for an N:M link table.

Parameters:
linkTable - A relationship table
Returns:
A property representing the table

getEntityLabelTemplate

TemplateValueMaker getEntityLabelTemplate(TableName tableName,
                                          Key columns)
Creates a best-effort template for human-readable labels for the records in a table, based on a given list of columns.

Parameters:
tableName - The table
columns - A list of columns in the table
Returns:
A template for generating labels for the records