de.fuberlin.wiwiss.d2rq.map
Interface Translator

All Known Implementing Classes:
TranslationTable

public interface Translator

Custom translator between database values and RDF values. Implementations of this interface can be used within d2rq:TranslationTables.

A Translator defines a 1:1 mapping between database and RDF values. Mappings that are not 1:1 in both directions are not supported.

The type of the RDF node (URI, blank node, literal) is not specified by the translator, but by the d2rq:ClassMap or d2rq:PropertyBridge that uses the d2rq:TranslationTable.

Translator implementations can have two kinds of constructors:

  1. A constructor that takes a single argument, a Jena Resource. A resource representing the d2rq:TranslationTable will be passed to the constructor and can be used to retrieve further setup arguments from the mapping file.
  2. A constructor that takes no arguments.
  3. Translators are instantiated at startup time, not at query time. Performance is not critical.

    History:
    08-03-2004: Initial version.

    Version:
    V0.2
    Author:
    Richard Cyganiak

    Method Summary
     java.lang.String toDBValue(java.lang.String rdfValue)
              Translates a value that comes from an RDF source (for example a query) to a database value.
     java.lang.String toRDFValue(java.lang.String dbValue)
              Translates a value that comes from the database to an RDF value (URI, literal label, or blank node ID).
     

    Method Detail

    toRDFValue

    public java.lang.String toRDFValue(java.lang.String dbValue)
    Translates a value that comes from the database to an RDF value (URI, literal label, or blank node ID). The mapping must be unique.

    Parameters:
    dbValue - a value coming from the database
    Returns:
    the corresponding RDF value, or null if no RDF statements should be created from the database value

    toDBValue

    public java.lang.String toDBValue(java.lang.String rdfValue)
    Translates a value that comes from an RDF source (for example a query) to a database value. The mapping must be unique.

    Parameters:
    rdfValue - a value coming from an RDF source
    Returns:
    the corresponding database value, or null if the RDF value cannot be mapped to a database value