public class VirtuosoRepository
extends java.lang.Object
implements org.eclipse.rdf4j.repository.Repository
Please note that a repository needs to be initialized before it can be used and that it should be shut down before it is discarded/garbage collected. Forgetting the latter can result in loss of data (depending on the Repository implementation)!
Constructor and Description |
---|
VirtuosoRepository(javax.sql.ConnectionPoolDataSource ds,
java.lang.String defGraph,
boolean useLazyAdd) |
VirtuosoRepository(javax.sql.DataSource ds,
java.lang.String defGraph,
boolean useLazyAdd) |
VirtuosoRepository(java.lang.String url_hostlist,
java.lang.String user,
java.lang.String password)
Construct a VirtuosoRepository with a specified parameters.
|
VirtuosoRepository(java.lang.String url_hostlist,
java.lang.String user,
java.lang.String password,
boolean useLazyAdd)
Construct a VirtuosoRepository with a specified parameters
defGraph will be set to "sesame:nil".
|
VirtuosoRepository(java.lang.String url_hostlist,
java.lang.String user,
java.lang.String password,
java.lang.String defGraph)
Construct a VirtuosoRepository with a specified parameters.
|
VirtuosoRepository(java.lang.String url_hostlist,
java.lang.String user,
java.lang.String password,
java.lang.String defGraph,
boolean useLazyAdd)
Construct a VirtuosoRepository with a specified parameters
|
VirtuosoRepository(javax.sql.XADataSource ds,
java.lang.String defGraph) |
Modifier and Type | Method and Description |
---|---|
void |
createRuleSet(java.lang.String ruleSetName,
java.lang.String uriGraphRuleSet)
Create ruleSet in DBMS
|
int |
getBatchSize()
Get the batch size for Insert data
|
org.eclipse.rdf4j.repository.RepositoryConnection |
getConnection()
Opens a connection to this repository that can be used for querying and
updating the contents of the repository.
|
java.io.File |
getDataDir()
Get the directory where data and logging for this repository is stored.
|
int |
getFetchSize()
Get the buffer fetch size
|
boolean |
getInsertBNodeAsVirtuosoIRI()
Get the insertBNodeAsURI state for connection
|
boolean |
getInsertStringLiteralAsSimple()
Get the insertStringLiteralAsSimple state for connection
|
int |
getQueryTimeout()
Get the query timeout seconds
|
boolean |
getRoundrobin()
Get the RoundRobin state for connection
|
java.lang.String |
getRuleSet()
Get the RuleSet name
|
boolean |
getUseLazyAdd()
Get the UseLazyAdd state for connection
|
org.eclipse.rdf4j.model.ValueFactory |
getValueFactory()
Gets a ValueFactory for this Repository.
|
void |
initialize()
Initializes this repository.
|
boolean |
isInitialized()
Indicates if the Repository has been initialized.
|
boolean |
isWritable()
Checks whether this repository is writable, i.e.
|
void |
setBatchSize(int sz)
Set the batch size for Inserts data(default 5000)
|
void |
setDataDir(java.io.File dataDir)
Set the directory where data and logging for this repository is stored.
|
void |
setFetchSize(int sz)
Set the buffer fetch size(default 100)
|
void |
setInsertBNodeAsVirtuosoIRI(boolean v)
Set the insertBNodeAsURI state for connection(default false)
|
void |
setInsertStringLiteralAsSimple(boolean v)
Set the insertStringLiteralAsSimple state for connection(default false)
|
void |
setQueryTimeout(int seconds)
Set the query timeout(default 0)
|
void |
setRoundrobin(boolean v)
Set the RoundRobin state for connection(default false)
|
void |
setRuleSet(java.lang.String name)
Set inference RuleSet name
|
void |
setUseLazyAdd(boolean v)
Set the UseLazyAdd state for connection(default true)
for XADataSource connection set false and can't be changed
|
void |
shutDown()
Shuts the repository down, releasing any resources that it keeps hold of.
|
public VirtuosoRepository(javax.sql.ConnectionPoolDataSource ds, java.lang.String defGraph, boolean useLazyAdd)
public VirtuosoRepository(javax.sql.DataSource ds, java.lang.String defGraph, boolean useLazyAdd)
public VirtuosoRepository(javax.sql.XADataSource ds, java.lang.String defGraph)
public VirtuosoRepository(java.lang.String url_hostlist, java.lang.String user, java.lang.String password, java.lang.String defGraph, boolean useLazyAdd)
url_hostlist
- the Virtuoso JDBC URL connection string or hostlist for poolled connection.
Virtuoso database hostlist
"hostone:1112,hosttwo:1113" or "hostone,hosttwo" if default port=1111 is used on hosts
user
- the database user on whose behalf the connection is being madepassword
- the user's passworddefGraph
- a default Graph name, used for Sesame calls, when contexts list
is empty, exclude exportStatements, hasStatement, getStatements methodsuseLazyAdd
- set true to enable using batch optimization for sequence of
add(Resource subject, URI predicate, Value object, Resource... contexts); add(Statement statement, Resource... contexts);methods, when autoCommit mode is off. The triples will be sent to DBMS on commit call or when batch size become more than predefined batch max_size. LazyAdd will be set false for XADataSource connection
public VirtuosoRepository(java.lang.String url_hostlist, java.lang.String user, java.lang.String password, boolean useLazyAdd)
url_hostlist
- the Virtuoso JDBC URL connection string or hostlist for poolled connection.
Virtuoso database hostlist
"hostone:1112,hosttwo:1113" or "hostone,hosttwo" if default port=1111 is used on hosts
user
- the database user on whose behalf the connection is being madepassword
- the user's passworduseLazyAdd
- set true to enable using batch optimization for sequence of
add(Resource subject, URI predicate, Value object, Resource... contexts); add(Statement statement, Resource... contexts);methods, when autoCommit mode is off. The triples will be sent to DBMS on commit call or when batch size become more than predefined batch max_size. LazyAdd will be set false for XADataSource connection
public VirtuosoRepository(java.lang.String url_hostlist, java.lang.String user, java.lang.String password, java.lang.String defGraph)
url_hostlist
- the Virtuoso JDBC URL connection string or hostlist for poolled connection.
Virtuoso database hostlist
"hostone:1112,hosttwo:1113" or "hostone,hosttwo" if the default port=1111 is used for hosts
user
- the database user on whose behalf the connection is being madepassword
- the user's passworddefGraph
- a default Graph name, used for Sesame calls, when contexts list
is empty, exclude exportStatements, hasStatement, getStatements methodspublic VirtuosoRepository(java.lang.String url_hostlist, java.lang.String user, java.lang.String password)
url_hostlist
- the Virtuoso JDBC URL connection string or hostlist for poolled connection.
Virtuoso database hostlist
"hostone:1112,hosttwo:1113" or "hostone,hosttwo" if the default port=1111 is used for hosts
user
- the database user on whose behalf the connection is being madepassword
- the user's passwordpublic org.eclipse.rdf4j.repository.RepositoryConnection getConnection() throws org.eclipse.rdf4j.repository.RepositoryException
Connection con = repository.getConnection(); try { // perform operations on the connection } finally { con.close(); }
getConnection
in interface org.eclipse.rdf4j.repository.Repository
org.eclipse.rdf4j.repository.RepositoryException
- If something went wrong during the creation of the Connection.public void setFetchSize(int sz)
sz
- buffer fetch size.public int getFetchSize()
public void setBatchSize(int sz)
sz
- batch size.public int getBatchSize()
public void setQueryTimeout(int seconds)
seconds
- queryTimeout seconds, 0 - unlimited.public int getQueryTimeout()
public void setUseLazyAdd(boolean v)
v
- true - useLazyAddpublic boolean getUseLazyAdd()
public void setRoundrobin(boolean v)
v
- true - use roundrobinpublic boolean getRoundrobin()
public void setInsertBNodeAsVirtuosoIRI(boolean v)
v
- true - insert BNode as Virtuoso IRI
false - insert BNode as Virtuoso Native BNodepublic boolean getInsertBNodeAsVirtuosoIRI()
public boolean getInsertStringLiteralAsSimple()
public void setInsertStringLiteralAsSimple(boolean v)
v
- true - insert String Literals as Simple Literals
false - insert String Literals as ispublic void setRuleSet(java.lang.String name)
name
- RuleSet name.public java.lang.String getRuleSet()
public java.io.File getDataDir()
getDataDir
in interface org.eclipse.rdf4j.repository.Repository
public org.eclipse.rdf4j.model.ValueFactory getValueFactory()
getValueFactory
in interface org.eclipse.rdf4j.repository.Repository
public void initialize() throws org.eclipse.rdf4j.repository.RepositoryException
initialize
in interface org.eclipse.rdf4j.repository.Repository
org.eclipse.rdf4j.repository.RepositoryException
- If the initialization failed.public boolean isInitialized()
isInitialized
in interface org.eclipse.rdf4j.repository.Repository
public boolean isWritable() throws org.eclipse.rdf4j.repository.RepositoryException
isWritable
in interface org.eclipse.rdf4j.repository.Repository
org.eclipse.rdf4j.repository.RepositoryException
public void setDataDir(java.io.File dataDir)
setDataDir
in interface org.eclipse.rdf4j.repository.Repository
dataDir
- the directory where data for this repository is storedpublic void shutDown() throws org.eclipse.rdf4j.repository.RepositoryException
shutDown
in interface org.eclipse.rdf4j.repository.Repository
org.eclipse.rdf4j.repository.RepositoryException
public void createRuleSet(java.lang.String ruleSetName, java.lang.String uriGraphRuleSet) throws org.eclipse.rdf4j.repository.RepositoryException
ruleSetName
- uriGraphRuleSet
- org.eclipse.rdf4j.repository.RepositoryException
- If something went wrong during the creation of the Connection.