All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mysema.rdfbean.model.RDFConnection Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2010 Mysema Ltd.
 * All rights reserved.
 *
 */
package com.mysema.rdfbean.model;

import java.io.Closeable;
import java.util.Collection;

import javax.annotation.Nullable;

import com.mysema.commons.lang.CloseableIterator;

/**
 * RDFConnection defines a session interface to the Repository
 * 
 * @author tiwe
 * @version $Id$
 * 
 */
public interface RDFConnection extends Closeable {

    /**
     * Create a new transaction for the Connection
     * 
     * @param readOnly
     * @param txTimeout
     * @param isolationLevel
     * @return
     */
    RDFBeanTransaction beginTransaction(boolean readOnly, int txTimeout, int isolationLevel);

    /**
     * Clear any cached objects in the Connection
     */
    void clear();

    /**
     * Close this connection
     */
    void close();

    /**
     * Create a new unique Blank node
     * 
     * @return
     */
    BID createBNode();

    /**
     * @param 
     * @param 
     * @param updateLanguage
     * @param definition
     * @return
     */
     Q createUpdate(UpdateLanguage updateLanguage, @Nullable D definition);

    /**
     * Prepare a Query of the given query language with the given definition
     * 
     * @param 
     * @param 
     * @param queryLanguage
     * @param definition
     * @return
     */
     Q createQuery(QueryLanguage queryLanguage, @Nullable D definition);

    /**
     * Find out if statements matching the given pattern exist
     * 
     * @param subject
     * @param predicate
     * @param object
     * @param context
     * @param includeInferred
     * @return
     */
    boolean exists(
            @Nullable ID subject,
            @Nullable UID predicate,
            @Nullable NODE object,
            @Nullable UID context, boolean includeInferred);

    /**
     * Find the statements matching the given pattern
     * 
     * @param subject
     * @param predicate
     * @param object
     * @param context
     * @param includeInferred
     *            true, if inferred triples are included, and false, if not
     * @return
     */
    CloseableIterator findStatements(
            @Nullable ID subject,
            @Nullable UID predicate,
            @Nullable NODE object,
            @Nullable UID context, boolean includeInferred);

    /**
     * Get a unallocated local id for use in a ID/LID mapping
     * 
     * @return
     */
    long getNextLocalId();

    /**
     * Remove all matching statements
     * 
     * @param subject
     * @param predicate
     * @param object
     * @param context
     */
    void remove(
            @Nullable ID subject,
            @Nullable UID predicate,
            @Nullable NODE object,
            @Nullable UID context);

    /**
     * Update the Repository with the given statements
     * 
     * @param removedStatements
     *            statements to be removed
     * @param addedStatements
     *            statement to be added
     */
    void update(@Nullable Collection removedStatements, @Nullable Collection addedStatements);

    /**
     * @return
     */
    QueryOptions getQueryOptions();

    /**
     * @return
     */
    InferenceOptions getInferenceOptions();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy