public class MappingGenerator extends Object
Modifier and Type | Field and Description |
---|---|
protected ConnectedDB |
database |
protected String |
instanceNamespaceURI |
protected PrintWriter |
out |
protected DatabaseSchemaInspector |
schema |
Constructor and Description |
---|
MappingGenerator(ConnectedDB database) |
Modifier and Type | Method and Description |
---|---|
protected List<Attribute> |
filter(List<Attribute> columns,
boolean requireDistinct,
String reason) |
boolean |
isLinkTable(RelationName tableName)
A table T is considered to be a link table if it has exactly two
foreign key constraints, and the constraints reference other
tables (not T), and the constraints cover all columns of T,
and there are no foreign keys from other tables pointing to this table
|
Model |
mappingModel(String baseURI)
Returns an in-memory Jena model containing the D2RQ mapping.
|
void |
setFilter(Filter filter) |
void |
setGenerateClasses(boolean flag) |
void |
setGenerateDefinitionLabels(boolean flag) |
void |
setGenerateLabelBridges(boolean flag) |
void |
setHandleLinkTables(boolean flag) |
void |
setInstanceNamespaceURI(String uri) |
void |
setJDBCDriverClass(String driverClassName) |
void |
setMapNamespaceURI(String uri) |
void |
setServeVocabulary(boolean flag) |
void |
setSkipForeignKeyTargetColumns(boolean flag) |
void |
setStartupSQLScript(URI uri) |
void |
setVocabNamespaceURI(String uri) |
protected String |
vocabularyIRITurtle(Attribute attribute) |
protected String |
vocabularyIRITurtle(List<Attribute> attributes) |
protected String |
vocabularyIRITurtle(RelationName tableName) |
Model |
vocabularyModel() |
void |
writeColumn(Attribute column) |
protected void |
writeEntityIdentifier(RelationName tableName,
List<Attribute> identifierColumns) |
void |
writeForeignKey(Join foreignKey) |
void |
writeLabelBridge(RelationName tableName,
List<Attribute> labelColumns) |
void |
writeMapping(OutputStream out) |
void |
writeMapping(Writer out)
Writes the D2RQ mapping to a writer.
|
protected void |
writePseudoEntityIdentifier(RelationName tableName) |
void |
writeTable(RelationName tableName) |
protected final ConnectedDB database
protected final DatabaseSchemaInspector schema
protected String instanceNamespaceURI
protected PrintWriter out
public MappingGenerator(ConnectedDB database)
public void setMapNamespaceURI(String uri)
public void setInstanceNamespaceURI(String uri)
public void setVocabNamespaceURI(String uri)
public void setFilter(Filter filter)
public void setJDBCDriverClass(String driverClassName)
public void setStartupSQLScript(URI uri)
public void setGenerateLabelBridges(boolean flag)
flag
- Generate an rdfs:label property bridge based on the PK?public void setGenerateClasses(boolean flag)
flag
- Generate a d2rq:class for every class map?public void setHandleLinkTables(boolean flag)
flag
- Handle Link Tables as properties (true) or normal tables (false)public void setGenerateDefinitionLabels(boolean flag)
flag
- Generate ClassDefinitionLabels and PropertyDefinitionLabels?public void setServeVocabulary(boolean flag)
flag
- Value for d2rq:serveVocabulary in map:Configurationpublic void setSkipForeignKeyTargetColumns(boolean flag)
public Model vocabularyModel()
public Model mappingModel(String baseURI)
baseURI
- Base URI for resolving relative URIs in the mapping, e.g., map namespacepublic void writeMapping(OutputStream out)
public void writeMapping(Writer out)
out
- Stream for writing data to the file or consolepublic void writeTable(RelationName tableName)
protected void writeEntityIdentifier(RelationName tableName, List<Attribute> identifierColumns)
protected void writePseudoEntityIdentifier(RelationName tableName)
public void writeLabelBridge(RelationName tableName, List<Attribute> labelColumns)
public void writeColumn(Attribute column)
public void writeForeignKey(Join foreignKey)
protected String vocabularyIRITurtle(RelationName tableName)
protected List<Attribute> filter(List<Attribute> columns, boolean requireDistinct, String reason)
public boolean isLinkTable(RelationName tableName)