com.bigdata.rdf.sail
Class BigdataSailRepositoryConnection

java.lang.Object
  extended by org.openrdf.repository.base.RepositoryConnectionBase
      extended by org.openrdf.repository.sail.SailRepositoryConnection
          extended by com.bigdata.rdf.sail.BigdataSailRepositoryConnection
All Implemented Interfaces:
RepositoryConnection

public class BigdataSailRepositoryConnection
extends SailRepositoryConnection

Class with support for a variety of bigdata specific extensions,

Author:
mrpersonick

Field Summary
 
Fields inherited from class org.openrdf.repository.base.RepositoryConnectionBase
logger
 
Constructor Summary
BigdataSailRepositoryConnection(BigdataSailRepository repository, SailConnection sailConnection)
           
 
Method Summary
 void addChangeLog(IChangeLog log)
          Set the change log on the SAIL connection.
 void commit()
          
 long commit2()
          Commit, returning the timestamp associated with the new commit point.
 void computeClosure()
          Computes the closure of the triple store for RDF(S)+ entailments.
 void flush()
          Flush the statement buffers.
 BigdataSailRepository getRepository()
           
 BigdataSail.BigdataSailConnection getSailConnection()
           
 AbstractTripleStore getTripleStore()
          Return the backing AbstractTripleStore object.
 BigdataValueFactory getValueFactory()
           
 boolean isReadOnly()
          Return true if the connection does not permit mutation.
 boolean isUnisolated()
          Return true if this is the ITx.UNISOLATED connection.
 BigdataSailBooleanQuery prepareBooleanQuery(QueryLanguage ql, String qs, String baseURI)
           
 BigdataSailGraphQuery prepareGraphQuery(QueryLanguage ql, String qs, String baseURI)
           
 BigdataSailQuery prepareNativeSPARQLQuery(QueryLanguage ql, String queryStr, String baseURI)
          Parse a SPARQL query
 BigdataSailUpdate prepareNativeSPARQLUpdate(QueryLanguage ql, String updateStr, String baseURI)
          Parse a SPARQL UPDATE request.
 SailQuery prepareQuery(QueryLanguage ql, String qs, String baseURI)
           
 BigdataSailTupleQuery prepareTupleQuery(QueryLanguage ql, String qs, String baseURI)
           
 Update prepareUpdate(QueryLanguage ql, String update, String baseURI)
          
 void removeAllEntailments()
          Removes all "inferred" statements from the database (does NOT commit the database).
 String toString()
           
 
Methods inherited from class org.openrdf.repository.sail.SailRepositoryConnection
addWithoutCommit, autoCommit, clear, clearNamespaces, close, createRepositoryResult, exportStatements, getContextIDs, getNamespace, getNamespaces, getStatements, isEmpty, removeNamespace, removeWithoutCommit, rollback, setNamespace, size
 
Methods inherited from class org.openrdf.repository.base.RepositoryConnectionBase
add, add, add, add, add, add, add, add, addInputStreamOrReader, addWithoutCommit, export, getParserConfig, hasStatement, hasStatement, isAutoCommit, isOpen, prepareBooleanQuery, prepareGraphQuery, prepareQuery, prepareTupleQuery, prepareUpdate, remove, remove, remove, remove, removeWithoutCommit, setAutoCommit, setParserConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BigdataSailRepositoryConnection

public BigdataSailRepositoryConnection(BigdataSailRepository repository,
                                       SailConnection sailConnection)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

getRepository

public BigdataSailRepository getRepository()
Specified by:
getRepository in interface RepositoryConnection
Overrides:
getRepository in class RepositoryConnectionBase

getSailConnection

public BigdataSail.BigdataSailConnection getSailConnection()
Overrides:
getSailConnection in class SailRepositoryConnection

getValueFactory

public BigdataValueFactory getValueFactory()
Specified by:
getValueFactory in interface RepositoryConnection
Overrides:
getValueFactory in class RepositoryConnectionBase

prepareGraphQuery

public BigdataSailGraphQuery prepareGraphQuery(QueryLanguage ql,
                                               String qs,
                                               String baseURI)
                                        throws MalformedQueryException
Specified by:
prepareGraphQuery in interface RepositoryConnection
Overrides:
prepareGraphQuery in class SailRepositoryConnection
Throws:
MalformedQueryException

prepareTupleQuery

public BigdataSailTupleQuery prepareTupleQuery(QueryLanguage ql,
                                               String qs,
                                               String baseURI)
                                        throws MalformedQueryException
Specified by:
prepareTupleQuery in interface RepositoryConnection
Overrides:
prepareTupleQuery in class SailRepositoryConnection
Throws:
MalformedQueryException

prepareBooleanQuery

public BigdataSailBooleanQuery prepareBooleanQuery(QueryLanguage ql,
                                                   String qs,
                                                   String baseURI)
                                            throws MalformedQueryException
Specified by:
prepareBooleanQuery in interface RepositoryConnection
Overrides:
prepareBooleanQuery in class SailRepositoryConnection
Throws:
MalformedQueryException

prepareQuery

public SailQuery prepareQuery(QueryLanguage ql,
                              String qs,
                              String baseURI)
                       throws MalformedQueryException
Specified by:
prepareQuery in interface RepositoryConnection
Overrides:
prepareQuery in class SailRepositoryConnection
Throws:
MalformedQueryException

prepareUpdate

public Update prepareUpdate(QueryLanguage ql,
                            String update,
                            String baseURI)
                     throws RepositoryException,
                            MalformedQueryException

Specified by:
prepareUpdate in interface RepositoryConnection
Overrides:
prepareUpdate in class SailRepositoryConnection
Throws:
RepositoryException
MalformedQueryException
See Also:
SPARQL 1.1 Update

prepareNativeSPARQLQuery

public BigdataSailQuery prepareNativeSPARQLQuery(QueryLanguage ql,
                                                 String queryStr,
                                                 String baseURI)
                                          throws MalformedQueryException
Parse a SPARQL query

Parameters:
ql - The QueryLanguage.
queryStr - The query.
baseURI - The base URI.
Returns:
An object wrapping the bigdata AST model for that query.
Throws:
MalformedQueryException
UnsupportedOperationException - if the query language is not SPARQL.

prepareNativeSPARQLUpdate

public BigdataSailUpdate prepareNativeSPARQLUpdate(QueryLanguage ql,
                                                   String updateStr,
                                                   String baseURI)
                                            throws MalformedQueryException
Parse a SPARQL UPDATE request.

Parameters:
ql - The QueryLanguage.
updateStr - The update request.
baseURI - The base URI.
Returns:
An object wrapping the bigdata AST model for that request.
Throws:
MalformedQueryException
UnsupportedOperationException - if the QueryLanguage is not SPARQL.

isReadOnly

public final boolean isReadOnly()
Return true if the connection does not permit mutation.


isUnisolated

public final boolean isUnisolated()
Return true if this is the ITx.UNISOLATED connection.


commit2

public long commit2()
             throws RepositoryException
Commit, returning the timestamp associated with the new commit point.

Note: auto-commit is an EXTREMELY bad idea. Performance will be terrible. The database will swell to an outrageous size. TURN OFF AUTO COMMIT.

Returns:
The timestamp associated with the new commit point. This will be 0L if the write set was empty such that nothing was committed.
Throws:
RepositoryException
See Also:
BigdataSail.Options.ALLOW_AUTO_COMMIT

commit

public void commit()
            throws RepositoryException

Note: auto-commit is an EXTREMELY bad idea. Performance will be terrible. The database will swell to an outrageous size. TURN OFF AUTO COMMIT.

Specified by:
commit in interface RepositoryConnection
Overrides:
commit in class SailRepositoryConnection
Throws:
RepositoryException
See Also:
BigdataSail.Options.ALLOW_AUTO_COMMIT

flush

public void flush()
           throws RepositoryException
Flush the statement buffers. The BigdataSail.BigdataSailConnection heavily buffers assertions and retractions. Either a flush() or a commit() is required before executing any operations directly against the backing AbstractTripleStore so that the buffered assertions or retractions will be written onto the KB and become visible to other methods. This is not a transaction issue -- just a buffer issue. The public methods on the BigdataSail.BigdataSailConnection all flush the buffers before performing any queries against the underlying AbstractTripleStore.

Throws:
RepositoryException

getTripleStore

public AbstractTripleStore getTripleStore()
Return the backing AbstractTripleStore object. Caution MUST be used when accessing this object as the access goes around the SAIL API.


computeClosure

public void computeClosure()
                    throws RepositoryException
Computes the closure of the triple store for RDF(S)+ entailments.

This computes the closure of the database. This can be used if you do NOT enable truth maintenance and choose instead to load up all of your data first and then compute the closure of the database. Note that some rules may be computed by eager closure while others are computed at query time.

Note: If there are already entailments in the database AND you have retracted statements since the last time the closure was computed then you MUST delete all entailments from the database before re-computing the closure.

Note: This method does NOT commit the database. See AbstractTripleStore.commit() and getTripleStore().

Throws:
RepositoryException
See Also:
removeAllEntailments()

removeAllEntailments

public void removeAllEntailments()
                          throws SailException,
                                 RepositoryException
Removes all "inferred" statements from the database (does NOT commit the database).

Throws:
RepositoryException
SailException

addChangeLog

public void addChangeLog(IChangeLog log)
Set the change log on the SAIL connection. See IChangeLog and IChangeRecord.

Parameters:
log - the change log


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.