public class JenaR2RMLMappingManager extends R2RMLMappingManagerImpl {

    private static JenaR2RMLMappingManager INSTANCE = new JenaR2RMLMappingManager(new JenaRDF());

    private JenaR2RMLMappingManager(JenaRDF rdf) {
        super(rdf);
    }

    public Collection<TriplesMap> importMappings(Model model) throws InvalidR2RMLMappingException {
        return importMappings(((JenaRDF) getRDF()).asGraph(model));
    }

    @Override
    public JenaGraph exportMappings(Collection<TriplesMap> maps) {
        return (JenaGraph) super.exportMappings(maps);
    }

    public static JenaR2RMLMappingManager getInstance(){
        return INSTANCE;
    }
} @W3C_R2RML_Recommendation(R2RMLVocabulary.TYPE_GRAPH_MAP)
public interface GraphMap extends TermMap {

} @W3C_R2RML_Recommendation(R2RMLVocabulary.TYPE_JOIN)
public interface Join extends MappingComponent {

	/**
	 * Set the child to a column that exists in the logical table of the triples
	 * map that contains the referencing object map. A Join must have exactly
	 * one child.
	 * 
	 * @param columnName
	 *            The name of the column.
	 * @throws NullPointerException
	 *             If columnName is null.
	 */
	@W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_CHILD)
	public void setChild(String columnName);

	/**
	 * Set the parent to a column that exists in the logical table of the
	 * RefObjectMap's parent triples map. A Join must have exactly one parent.
	 * 
	 * @param columnName
	 *            The name of the column.
	 * @throws NullPointerException
	 *             If columnName is null.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PARENT)
	public void setParent(String columnName);

	/**
	 * Get the child for this Join.
	 * 
	 * @return The child associated with this Join.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_CHILD)
	public String getChild();

	/**
	 * Get the parent for this Join.
	 * 
	 * @return The parent associated with this Join.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PARENT)
	public String getParent();

}
 @W3C_R2RML_Recommendation(R2RMLVocabulary.TYPE_LOGICAL_TABLE)
public interface LogicalTable extends MappingComponent {

	/**
	 * Returns the effective SQL query of this LogicalTable. The effective SQL
	 * query of a R2RMLView is it's own SQL query. For a SQLBaseTableOrView it's
	 * "SELECT * FROM {table}".
	 * 
	 * @return The effective SQL query of this LogicalTable.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_SQL_QUERY)
	public String getSQLQuery();

}
 public interface MappingFactory {

    /**
     * Create a new TriplesMap with the given LogicalTable and SubjectMap.
     *
     * @param lt The LogicalTable of the TriplesMap. This must either be a
     *           SQLBaseTableOrView or a R2RMLView.
     * @param sm The SubjectMap of the TriplesMap.
     * @return The created TriplesMap.
     */
    TriplesMap createTriplesMap(LogicalTable lt, SubjectMap sm);

    TriplesMap createTriplesMap(LogicalTable lt, SubjectMap sm, BlankNodeOrIRI node);

    /**
     * Create a new TriplesMap with the given LogicalTable, SubjectMap and
     * PredicateObjectMap.
     *
     * @param lt  The LogicalTable of the TriplesMap. This must either be a
     *            SQLBaseTableOrView or a R2RMLView.
     * @param sm  The SubjectMap of the TriplesMap.
     * @param pom A PredicateObjectMap for the TriplesMap.
     * @return The created TriplesMap.
     */
    TriplesMap createTriplesMap(LogicalTable lt, SubjectMap sm, PredicateObjectMap pom);

    TriplesMap createTriplesMap(LogicalTable lt, SubjectMap sm, PredicateObjectMap pom, BlankNodeOrIRI node);

    /**
     * Create a new TriplesMap with the given LogicalTable, SubjectMap and list
     * of PredicateObjectMaps.
     *
     * @param lt        The LogicalTable of the TriplesMap. This must either be a
     *                  SQLBaseTableOrView or a R2RMLView.
     * @param sm        The SubjectMap of the TriplesMap.
     * @param listOfPom The list of PredicateObjectMaps that will be added to the
     *                  TriplesMap.
     * @return The created TriplesMap.
     */
    TriplesMap createTriplesMap(LogicalTable lt, SubjectMap sm, List<PredicateObjectMap> listOfPom);

    /**
     * Create a new PredicateObjectMap with the given PredicateMap and
     * ObjectMap.
     *
     * @param pm The PredicateMap for the PredicateObjectMap.
     * @param om The ObjectMap for the PredicateObjectMap.
     * @return The created PredicateObjectMap.
     */
    PredicateObjectMap createPredicateObjectMap(PredicateMap pm, ObjectMap om);

    /**
     * Create a new PredicateObjectMap with the given PredicateMap and
     * RefObjectMap.
     *
     * @param pm  The PredicateMap for the PredicateObjectMap.
     * @param rom The RefObjectMap for the PredicateObjectMap.
     * @return The created PredicateObjectMap.
     */
    PredicateObjectMap createPredicateObjectMap(PredicateMap pm, RefObjectMap rom);

    /**
     * Creates a new PredicateObjectMap with the given lists of PredicateMaps,
     * ObjectMaps and RefObjectMaps. The lists must contain at least one
     * PredicateMap and at least one of either an ObjectMap or a RefObjectMap.
     *
     * @param pms  The list of PredicateMaps.
     * @param oms  The list of ObjectMaps.
     * @param roms The list of RefObjectMaps.
     * @return The created PredicateObjectMap.
     */
    PredicateObjectMap createPredicateObjectMap(List<PredicateMap> pms,
                                                List<ObjectMap> oms, List<RefObjectMap> roms);

    /**
     * Create a new R2RMLView with the given SQL query.
     *
     * @param query The SQL query for the R2RMLView.
     * @return The created R2RMLView.
     */
    R2RMLView createR2RMLView(String query);

    /**
     * Create a new SQLBaseTableOrView with the given table name.
     *
     * @param tableName The table name for the SQLBaseTableOrView.
     * @return The created SQLBaseTableOrView.
     */
    SQLBaseTableOrView createSQLBaseTableOrView(String tableName);

    /**
     * Create a new GraphMap with the given template. The term map type of the
     * GraphMap will be set to TermMapType.TEMPLATE_VALUED.
     *
     * @param template The template for the GraphMap.
     * @return The created GraphMap.
     */
    GraphMap createGraphMap(Template template);

    /**
     * Create a new GraphMap with the given term map type and a column or
     * constant value. The term map type of the GraphMap will be set to
     * TermMapType.COLUMN_VALUED.
     *
     * @param columnName The value for the GraphMap.
     * @return The created GraphMap.
     */
    GraphMap createGraphMap(String columnName);

    /**
     * Create a new GraphMap with the given term map type and a column or
     * constant value. The term map type of the GraphMap will be set to
     * TermMapType.CONSTANT_VALUED .
     *
     * @param constant The value for the GraphMap.
     * @return The created GraphMap.
     */
    GraphMap createGraphMap(IRI constant);

    /**
     * Create a new SubjectMap with the given template. The term map type of the
     * SubjectMap will be set to TermMapType.TEMPLATE_VALUED.
     *
     * @param template The template for the SubjectMap.
     * @return The created SubjectMap.
     */
    SubjectMap createSubjectMap(Template template);

    /**
     * Create a new SubjectMap with the given term map type and a column or
     * constant value. The term map type of the SubjectMap will be set to TermMapType.COLUMN_VALUED.
     *
     * @param columnName The value for the SubjectMap.
     * @return The created SubjectMap.
     */
    SubjectMap createSubjectMap(String columnName);

    /**
     * Create a new SubjectMap with the given term map type and a column or
     * constant value. The term map type of the SubjectMap will be set to
     * TermMapType.CONSTANT_VALUED.
     *
     * @param constant The value for the SubjectMap.
     * @return The created SubjectMap.
     */
    SubjectMap createSubjectMap(IRI constant);

    /**
     * Create a new SubjectMap containing an embedded triple, the embedded
     * triple consists of three embedded term maps which are passed to the
     * constructor. The term map type of the SubjectMap will be set to
     * TermMapType.RDF_STAR_VALUED.
     *
     * @param subject The embedded subject.
     * @param predicate The embedded predicate.
     * @param object The embedded object.
     * @return The created SubjectMap.
     */
    SubjectMap createSubjectMap(ObjectMap subject, PredicateMap predicate, ObjectMap object);

    /**
     * Create a new PredicateMap with the given template. The term map type of
     * the PredicateMap will be set to TermMapType.TEMPLATE_VALUED.
     *
     * @param template The template for the PredicateMap.
     * @return The created PredicateMap.
     */
    PredicateMap createPredicateMap(Template template);

    /**
     * Create a new PredicateMap with the given term map type and a column or
     * constant value. The term map type of the PredicateMap will be set to TermMapType.COLUMN_VALUED.
     *
     * @param columnName The value for the PredicateMap.
     * @return The created PredicateMap.
     */
    PredicateMap createPredicateMap(String columnName);

    /**
     * Create a new PredicateMap with the given term map type and a column or
     * constant value. The term map type of the PredicateMap will be set to
     * TermMapType.CONSTANT_VALUED.
     *
     * @param constant The value for the PredicateMap.
     * @return The created PredicateMap.
     */
    PredicateMap createPredicateMap(IRI constant);

    /**
     * Create a new ObjectMap with the given template. The term map type of the
     * ObjectMap will be set to TermMapType.TEMPLATE_VALUED.
     *
     * @param template The template for the ObjectMap.
     * @return The created ObjectMap.
     */
    ObjectMap createObjectMap(Template template);

    /**
     * Create a new ObjectMap with the given term map type and a column or
     * constant value. The term map type of the ObjectMap will be set to TermMapType.COLUMN_VALUED.
     * TermMapType.CONSTANT_VALUED or TermMapType.COLUMN_VALUED.
     *
     * @param columnName The value for the ObjectMap.
     * @return The created ObjectMap.
     */
    ObjectMap createObjectMap(String columnName);

    /**
     * Create a new ObjectMap with the given term map type and a column or
     * constant value. The term map type of the ObjectMap will be set to TermMapType.CONSTANT_VALUED.
     *
     * @param constant The value for the ObjectMap.
     * @return The created ObjectMap.
     */
    ObjectMap createObjectMap(RDFTerm constant);

    /**
     * Create a new ObjectMap containing an embedded triple, the embedded
     * triple consists of three embedded term maps which are passed to the
     * constructor. The term map type of the SubjectMap will be set to
     * TermMapType.RDF_STAR_VALUED.
     *
     * @param subject The embedded subject.
     * @param predicate The embedded predicate.
     * @param object The embedded object.
     * @return The created ObjectMap.
     */
    ObjectMap createObjectMap(ObjectMap subject, PredicateMap predicate, ObjectMap object);

    /**
     * Create a new RefObjectMap with the given resource for the parent triples
     * map.
     *
     * @param parentMap The parent triples map for the RefObjectMap.
     * @return The created RefObjectMap.
     */
    RefObjectMap createRefObjectMap(TriplesMap parentMap);

    /**
     * Create a new Join with the given child and parent columns.
     *
     * @param childColumn  The child column of the Join.
     * @param parentColumn The parent column of the Join.
     * @return The created Join.
     */
    Join createJoinCondition(String childColumn, String parentColumn);

    /**
     * Create a new template.
     *
     * @return The created template.
     */
    Template createTemplate();

    /**
     * Create a new template given a template string.
     *
     * @param template The template as a string.
     * @return The created template.
     */
    Template createTemplate(String template);

    /**
     * Create a new InverseExpression with the given string template.
     *
     * @param invExp The string template for the inverse expression.
     * @return The created InverseExpression.
     */
    InverseExpression createInverseExpression(String invExp);
}
 @W3C_R2RML_Recommendation(R2RMLVocabulary.TYPE_OBJECT_MAP)
public interface ObjectMap extends TermMap {

    /**
     * {@inheritDoc}
     *
     * The possible values for the term type are:<br>
     * - rr:IRI<br>
     * - rr:BlankNode<br>
     * - rr:Literal
     *
     */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_TERM_TYPE)
    @Override
    void setTermType(IRI typeIRI);

    /**
	 * Set the language tag of this ObjectMap if the term type is set to
	 * rr:Literal. If the ObjectMap is data typed, the data type will be
	 * removed.
	 * 
	 * @param lang
	 *            The language tag to be set. Must be a valid language tag.
	 * @throws IllegalStateException
	 *             If the term type of this ObjectMap is not rr:Literal.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_LANGUAGE)
    public void setLanguageTag(String lang);

	/**
	 * Set the data type for this ObjectMap. A ObjectMap can have either zero or
	 * one data types. The ObjectMap can only be data typed if the term type is
	 * rr:Literal. If the ObjectMap has a language tag, the language tag will be
	 * removed. The datatypeURI parameter must be an instance of the library's
	 * resource class.
	 * 
	 * @param datatypeURI
	 *            The data type IRI to be set.
	 * @throws IllegalStateException
	 *             If the term type of this ObjectMap is not rr:Literal.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_DATATYPE)
	public void setDatatype(IRI datatypeURI);

	/**
	 * Get the language tag for this ObjectMap. It will return null if the
	 * ObjectMap doesn't have a language tag.
	 * 
	 * @return The language tag of this ObjectMap.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_LANGUAGE)
	public String getLanguageTag();

	/**
	 * Get the data type for this ObjectMap. It will return null if the
	 * ObjectMap is not data typed.
	 *
	 * @return The data type of this ObjectMap.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_DATATYPE)
    public IRI getDatatype();

	/**
	 * Remove the data type associated with this ObjectMap. The ObjectMap will
	 * no longer be data typed.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_DATATYPE)
	public void removeDatatype();

	/**
	 * Removes the language tag from this ObjectMap if there is one.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_LANGUAGE)
	public void removeLanguageTag();

}
 @W3C_R2RML_Recommendation(R2RMLVocabulary.TYPE_PREDICATE_MAP)
public interface PredicateMap extends TermMap {

}
 @W3C_R2RML_Recommendation(R2RMLVocabulary.TYPE_PREDICATE_OBJECT_MAP)
public interface PredicateObjectMap extends MappingComponent {

	/**
	 * Adds a PredicateMap to this PredicateObjectMap. The PredicateMap will be
	 * added to the end of the PredicateMap list. A PredicateObjectMap must have
	 * one or more PredicateMaps.
	 * 
	 * @param pm
	 *            The PredicateMap that will be added.
	 */
	@W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PREDICATE_MAP)
	public void addPredicateMap(PredicateMap pm);

	/**
	 * Adds an ObjectMap to this PredicateObjectMap. The ObjectMap will be added
	 * to the end of the ObjectMap list. A PredicateObjectMap must have at least
	 * one ObjectMap or RefObjectMap.
	 * 
	 * @param om
	 *            The ObjectMap that will be added.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_OBJECT_MAP)
	public void addObjectMap(ObjectMap om);

	/**
	 * Adds an RefObjectMap to this PredicateObjectMap. The RefObjectMap will be
	 * added to the end of the RefObjectMap list. A PredicateObjectMap must have
	 * at least one ObjectMap or RefObjectMap.
	 * 
	 * @param rom
	 *            The RefObjectMap that will be added.
	 */
	@W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_OBJECT_MAP)
	public void addRefObjectMap(RefObjectMap rom);

	/**
	 * Adds a GraphMap to this PredicateObjectMap. A PredicateObjectMap can have
	 * zero or more GraphMaps. The GraphMap will be added to the end of the
	 * GraphMap list.
	 * 
	 * @param gm
	 *            The GraphMap that will be added.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_GRAPH_MAP)
	public void addGraphMap(GraphMap gm);

	/**
	 * Adds a list of GraphMaps to this PredicateObjectMap. A PredicateObjectMap
	 * can have zero or more GraphMaps. The GraphMaps will be added to the end
	 * of the GraphMap list.
	 * 
	 * @param gms
	 *            The list of GraphMaps that will be added.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_GRAPH_MAP)
    public void addGraphMaps(List<GraphMap> gms);

	/**
	 * Get the GraphMap located at the given index.
	 * 
	 * @param index
	 *            The index of the GraphMap.
	 * @return The GraphMap located at the given index.
	 * @throws IndexOutOfBoundsException
	 *             If the given index is out of range.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_GRAPH_MAP)
	public GraphMap getGraphMap(int index);

	/**
	 * Get the RefObjectMap located at the given index.
	 * 
	 * @param index
	 *            The index of the RefObjectMap.
	 * @return The RefObjectMap located at the given index.
	 * @throws IndexOutOfBoundsException
	 *             If the given index is out of range.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_OBJECT_MAP)
    public RefObjectMap getRefObjectMap(int index);

	/**
	 * Get the ObjectMap located at the given index.
	 * 
	 * @param index
	 *            The index of the ObjectMap.
	 * @return The ObjectMap located at the given index.
	 * @throws IndexOutOfBoundsException
	 *             If the given index is out of range.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_OBJECT_MAP)
    public ObjectMap getObjectMap(int index);

	/**
	 * Get the PredicateMap located at the given index.
	 * 
	 * @param index
	 *            The index of the PredicateMap.
	 * @return The PredicateMap located at the given index.
	 * @throws IndexOutOfBoundsException
	 *             If the given index is out of range.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PREDICATE_MAP)
    public PredicateMap getPredicateMap(int index);

	/**
	 * Returns an unmodifiable view of the list of GraphMaps that have been
	 * added to this PredicateObjectMap.
	 * 
	 * @return An unmodifiable list of GraphMaps.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_GRAPH_MAP)
	public List<GraphMap> getGraphMaps();

	/**
	 * Returns an unmodifiable view of the list of RefObjectMaps that have been
	 * added to this PredicateObjectMap.
	 * 
	 * @return An unmodifiable list of RefObjectMaps.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_OBJECT_MAP)
	public List<RefObjectMap> getRefObjectMaps();

	/**
	 * Returns an unmodifiable view of the list of ObjectMaps that have been
	 * added to this PredicateObjectMap.
	 * 
	 * @return An unmodifiable list of ObjectMaps.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_OBJECT_MAP)
    public List<ObjectMap> getObjectMaps();

	/**
	 * Returns an unmodifiable view of the list of PredicateMaps that have been
	 * added to this PredicateObjectMap.
	 * 
	 * @return An unmodifiable list of PredicateMaps.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PREDICATE_MAP)
    public List<PredicateMap> getPredicateMaps();

	/**
	 * Remove the GraphMap given by the parameter, from the PredicateObjectMap.
	 * The subsequent GraphMaps in the list will be shifted left.
	 * 
	 * @param gm
	 *            The GraphMap to be removed.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_GRAPH_MAP)
    public void removeGraphMap(GraphMap gm);

	/**
	 * Remove the RefObjectMap, given by the parameter, from the
	 * PredicateObjectMap. The subsequent RefObjectMaps in the list will be
	 * shifted left.
	 * 
	 * @param rom
	 *            The RefObjectMap to be removed.
	 * @throws IllegalStateException
	 *             If removing the RefObjectMap would cause the
	 *             PredicateObjectMap to contain no RefObjectMaps or ObjectMaps.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_OBJECT_MAP)
	public void removeRefObjectMap(RefObjectMap rom);

	/**
	 * Remove the ObjectMap, given by the parameter, from the
	 * PredicateObjectMap. The subsequent ObjectMaps in the list will be shifted
	 * left.
	 * 
	 * @param om
	 *            The ObjectMap to be removed.
	 * @throws IllegalStateException
	 *             If removing the RefObjectMap would cause the
	 *             PredicateObjectMap to contain no RefObjectMaps or ObjectMaps.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_OBJECT_MAP)
	public void removeObjectMap(ObjectMap om);

	/**
	 * Remove the PredicateMap, given by the parameter, from the
	 * PredicateObjectMap. The subsequent PredicateMaps in the list will be
	 * shifted left.
	 * 
	 * @param pm
	 *            The PredicateMap to be removed.
	 * @throws IllegalStateException
	 *             If removing the RefObjectMap would cause the
	 *             PredicateObjectMap to contain no PredicateMaps.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_OBJECT_MAP)
	public void removePredicateMap(PredicateMap pm);

}
 @W3C_R2RML_Recommendation(R2RMLVocabulary.TYPE_REF_OBJECT_MAP)
public interface RefObjectMap extends MappingComponent {

	/**
	 * Sets the parent triples map of this RefObjectMap. A
	 * RefObjectMap must have exactly one parent triples map. This
	 * method will overwrite any previously set parent triples map.
	 * 
	 * @param tm
	 *            The triples map that will be set as the
	 *            parent triples map.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PARENT_TRIPLES_MAP)
	public void setParentMap(TriplesMap tm);

	/**
	 * Adds the logical table of the parent triples map to this RefObjectMap.
	 * This needs to be set to be able to use the getParentQuery and
	 * getJointQuery methods.
	 * 
	 * @param lt
	 *            The logical table of this RefObjectMap's parent triples map.
     *
     * @deprecated does not correspond to Recommendation: logicalTable is not a property of RefObjectMap
	 */
	@Deprecated
	public void setParentLogicalTable(LogicalTable lt);

	/**
	 * Adds the logical table of the triples map that this RefObjectMap is
	 * contained in. This needs to be set to be able to use the getChildQuery
	 * and getJointQuery methods.
	 * 
	 * @param lt
	 *            The logical table of the triples map that contains this
	 *            RefObjectMap.
     * @deprecated does not correspond to Recommendation: logicalTable is not a property of RefObjectMap
	 */
    @Deprecated
	public void setChildLogicalTable(LogicalTable lt);

	/**
	 * Returns the child query for this RefObjectMap. The child query is the
	 * effective SQL query of the LogicalTable of the TriplesMap that contains
	 * the RefObjectMap.
	 * 
	 * @return The child query for this RefObjectMap.
	 * @throws NullPointerException
	 *             If the child logical table is null.
	 */
    @Deprecated
	public String getChildQuery();

	/**
	 * Returns the parent query for this RefObjectMap. The parent query is the
	 * effective SQL query of the LogicalTable of the RefObjectMap's parent
	 * TriplesMap.
	 * 
	 * @return The parent query for this RefObjectMap.
	 * @throws NullPointerException
	 *             If the parent logical table is null.
	 */
    @Deprecated
	public String getParentQuery();

	/**
	 * Returns the joint query for this RefObjectMap. The specification on what
	 * this query will look like can be found here:
	 * http://www.w3.org/TR/r2rml/#dfn-joint-sql-query
	 * 
	 * @return The joint query for this RefObjectMap.
	 */
    @Deprecated
    public String getJointQuery();

	/**
	 * Add a join condition to this RefObjectMap. The Join will be added to the
	 * end of the Join list. A RefObjectMap can have any number of join
	 * conditions.
	 * 
	 * @param j
	 *            The join condition to be added.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_JOIN_CONDITION)
	public void addJoinCondition(Join j);

	/**
	 * Get the Join located at the given index.
	 * 
	 * @param index
	 *            The index of the Join.
	 * @return The Join located at the given index.
	 * @throws IndexOutOfBoundsException
	 *             If the given index is out of range.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_JOIN_CONDITION)
	public Join getJoinCondition(int index);

	/**
	 * Returns an unmodifiable view of the list of Joins that have been added to
	 * this RefObjectMap.
	 * 
	 * @return An unmodifiable list of Joins.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_JOIN_CONDITION)
    public List<Join> getJoinConditions();

	/**
	 * Get the parent triples map of this RefObjectMap.
	 *
	 * @return The parent triples map.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PARENT_TRIPLES_MAP)
	public TriplesMap getParentMap();

	/**
	 * Removes the given join condition from this RefObjectMap. The subsequent
	 * Joins in the list will be shifted left.
	 * 
	 * @param j
	 *            The join condition that will be removed.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_JOIN_CONDITION)
	public void removeJoinCondition(Join j);

	

}
 @W3C_R2RML_Recommendation(R2RMLVocabulary.TYPE_SUBJECT_MAP)
public interface SubjectMap extends TermMap {

    /**
     * Adds a class to the SubjectMap. The class URI will be added to the end of
     * the class list. A SubjectMap can have zero or more classes. The classURI
     * parameter must be an instance of the library's resource class.
     *
     * @param classURI The class URI that will be added.
     */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_CLASS)
    public void addClass(IRI classURI);

    /**
     * Adds a GraphMap to this SubjectMap. The GraphMap will be added to the end
     * of the GraphMap list. A SubjectMap can have zero or more GraphMaps.
     *
     * @param gm The GraphMap that will be added.
     */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_GRAPH_MAP)
    public void addGraphMap(GraphMap gm);

    /**
     * Adds a list of GraphMaps to this SubjectMap. A SubjectMap can have zero
     * or more GraphMaps. The GraphMaps will be added to the end of the GraphMap
     * list.
     *
     * @param gms The list of GraphMaps that will be added.
     */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_GRAPH_MAP)
    public void addGraphMap(List<GraphMap> gms);

    /**
     * {@inheritDoc}
     *
     * The possible values for the term type are
     * (http://www.w3.org/TR/r2rml/#dfn-term-type>):<br>
     * - rr:IRI<br>
     * - rr:BlankNode
     */
    @Override
    public void setTermType(IRI typeIRI);

    /**
     * Get the class URI located at the given index.
     *
     * @param index The index of the class URI.
     * @return The class URI located at the given index.
     * @throws IndexOutOfBoundsException If the given index is out of range.
     */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_CLASS)
    public IRI getClass(int index);

    /**
     * Get the GraphMap located at the given index.
     *
     * @param index The index of the GraphMap.
     * @return The GraphMap located at the given index.
     * @throws IndexOutOfBoundsException If the given index is out of range.
     */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_GRAPH_MAP)
    public GraphMap getGraphMap(int index);

    /**
     * Returns an unmodifiable view of the list of classes that have been added
     * to this SubjectMap.
     *
     * @return An unmodifiable list of classes.
     */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_CLASS)
    public List<IRI> getClasses();

    /**
     * Returns an unmodifiable view of the list of GraphMaps that have been
     * added to this SubjectMap.
     *
     * @return An unmodifiable list of GraphMaps.
     */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_GRAPH_MAP)
    public List<GraphMap> getGraphMaps();

    /**
     * Remove the class given by the parameter, from the SubjectMap. The
     * subsequent class URIs in the list will be shifted left. The classURI
     * parameter must be an instance of the library's resource class.
     *
     * @param classURI The class that will be removed.
     */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_CLASS)
    public void removeClass(IRI classURI);

    /**
     * Remove the GraphMap given by the parameter, from the SubjectMap. The
     * subsequent GraphMaps in the list will be shifted left.
     *
     * @param gm The GraphMap to be removed.
     */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_GRAPH_MAP)
    public void removeGraphMap(GraphMap gm);

}
 public interface Template {

	/**
	 * Gets the string segment at the given index.
	 * 
	 * @param segIndex
	 *            The index of the string segment.
	 * @return The string segment at the given index.
	 */
	String getStringSegment(int segIndex);

    /**
     * Gets the string segments
     * @return The string segments
     */
    List<String> getStringSegments();

    String getTemplateStringWithoutColumnNames();

    /**
	 * Set the string segment on the given index. Any previously set segments on
	 * this index will be removed. Adding a new string segment (that don't
	 * overwrite older ones), must be done by adding it with an index one higher
	 * that the previously highest index.
	 * 
	 * @param segIndex
	 *            The index where the string segment will be set.
	 * @param segment
	 *            The string segment to insert.
	 * @throws IndexOutOfBoundsException
	 *             If the index is larger than the previously highest index plus
	 *             one.
	 */
	void addStringSegment(int segIndex, String segment);

	/**
	 * Gets the column name at the given index.
	 * 
	 * @param colIndex
	 *            The index of the column name.
	 * @return The column name at the given index.
	 */
	String getColumnName(int colIndex);

	/**
	 * Returns an unmodifiable view of all the column names in this template.
	 * 
	 * @return An unmodifiable view of all column names.
	 */
	List<String> getColumnNames();

	/**
	 * Set the column name on the given index. Any previously set column names
	 * on this index will be removed. Adding new column name (that don't
	 * overwrite older ones), must be done by adding it with an index one higher
	 * that the previously highest index.
	 * 
	 * @param colIndex
	 *            The index where the column name will be set.
	 * @param columnName
	 *            The column name to insert.
	 * @throws IndexOutOfBoundsException
	 *             If the index is larger than the previously highest index plus
	 *             one.
	 */
	void addColumnName(int colIndex, String columnName);
}
 @W3C_R2RML_Recommendation(R2RMLVocabulary.TYPE_TRIPLES_MAP)
public interface TriplesMap extends MappingComponent {

	/**
	 * Set the LogicalTable of this TriplesMap. A TriplesMap must have exactly
	 * one LogicalTable.
	 * 
	 * @param lt
	 *            The LogicalTable that will be added.
	 */
	@W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_LOGICAL_TABLE)
	public void setLogicalTable(LogicalTable lt);

	/**
	 * Set the SubjectMap of this TriplesMap. A TriplesMap must have exactly one
	 * SubjectMap.
	 * 
	 * @param sm
	 *            The SubjectMap that will be added.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_SUBJECT_MAP)
	public void setSubjectMap(SubjectMap sm);

	/**
	 * Adds a PredicateObjectMap to this TriplesMap. The PredicateObjectMap will
	 * be added to the end of the PredicateObjectMap list. A TriplesMap can have
	 * any number of PredicateObjectMaps.
	 * 
	 * @param pom
	 *            The PredicateObjectMap that will be added.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PREDICATE_OBJECT_MAP)
	public void addPredicateObjectMap(PredicateObjectMap pom);
	
	/**
	 * Adds a collection of PredicateObjectMaps to this TriplesMap. The PredicateObjectMap will
	 * be added to the end of the PredicateObjectMap list. A TriplesMap can have
	 * any number of PredicateObjectMaps.
	 * 
	 * @param poms
	 *            The PredicateObjectMaps that will be added.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PREDICATE_OBJECT_MAP)
	public void addPredicateObjectMaps(Collection<PredicateObjectMap> poms);

	/**
	 * Get the LogicalTable associated with this TriplesMap.
	 * 
	 * @return The LogicalTable of this TriplesMap.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_LOGICAL_TABLE)
	public LogicalTable getLogicalTable();

	/**
	 * Get the SubjectMap associated with this TriplesMap.
	 * 
	 * @return The SubjectMap of this TriplesMap.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_SUBJECT_MAP)
	public SubjectMap getSubjectMap();

	/**
	 * Get the PredicateObjectMap located at the given index.
	 * 
	 * @param index
	 *            The index of the PredicateObjectMap.
	 * @return The PredicateObjectMap located at the given index.
	 * @throws IndexOutOfBoundsException
	 *             If the given index is out of range.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PREDICATE_OBJECT_MAP)
	public PredicateObjectMap getPredicateObjectMap(int index);

	/**
	 * Returns an unmodifiable view of the list of PredicateObjectMaps that have
	 * been added to this TriplesMap.
	 * 
	 * @return An unmodifiable list of PredicateObjectMaps.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PREDICATE_OBJECT_MAP)
	public List<PredicateObjectMap> getPredicateObjectMaps();

	/**
	 * Remove the PredicateObjectMap given by the parameter, from the
	 * TriplesMap. The subsequent PredicateObjectMaps in the list will be
	 * shifted left.
	 * 
	 * @param pom
	 *            The PredicateObjectMap to be removed.
	 */
    @W3C_R2RML_Recommendation(R2RMLVocabulary.PROP_PREDICATE_OBJECT_MAP)
	public void removePredicateObjectMap(PredicateObjectMap pom);

	

}

import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import eu.optique.r2rml.api.binding.jena.JenaR2RMLMappingManager;
import org.apache.commons.rdf.api.IRI;
import org.apache.commons.rdf.jena.JenaRDF;
import org.apache.jena.graph.NodeFactory;
import org.junit.Assert;
import org.junit.Test;
import eu.optique.r2rml.api.model.GraphMap;
import eu.optique.r2rml.api.model.Join;
import eu.optique.r2rml.api.model.LogicalTable;
import eu.optique.r2rml.api.MappingFactory;
import eu.optique.r2rml.api.model.ObjectMap;
import eu.optique.r2rml.api.model.PredicateMap;
import eu.optique.r2rml.api.model.PredicateObjectMap;
import eu.optique.r2rml.api.model.RefObjectMap;
import eu.optique.r2rml.api.model.SubjectMap;
import eu.optique.r2rml.api.model.Template;
import eu.optique.r2rml.api.model.TriplesMap;

/*******************************************************************************
 * Copyright 2013, the Optique Consortium
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * This first version of the R2RML API was developed jointly at the University of Oslo, 
 * the University of Bolzano, La Sapienza University of Rome, and fluid Operations AG, 
 * as part of the Optique project, www.optique-project.eu
 ******************************************************************************/
package jenaTest;





/**
 * JUnit Test Cases
 * 
 * @author Riccardo Mancini
 */
public class InMemoryStructureCreation3_Test{
	
	@Test
	public void test(){
		
		JenaR2RMLMappingManager mm = JenaR2RMLMappingManager.getInstance();

		MappingFactory mfact = mm.getMappingFactory();
