|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.hp.hpl.mesa.rdf.jena.common.ModelCom
|
+--com.hp.hpl.mesa.rdf.jena.rdb.ModelRDB
This implementation of the Model interface uses a relational database to hold the model statements. This provides persistence, transactions and scaling at the expense of performance. It doesn't provide query support since the jena query interface is currently procedural rather than declarative.
Different SQL dialects and different table layout structures are supported by delegating all database access to a separate IRDBSpec implementation.
To reopen an existing database use the open() static factory methods.
To create a database for the first time use the create() static factory
methods.
| Constructor Summary | |
ModelRDB(IDBConnection dbcon)
Return the default model from the specified database. |
|
| Method Summary | |
Model |
abort()
Abort the current transaction and abandon any changes in progress. |
Model |
add(Statement s)
Add a statement to the model |
Model |
begin()
Begin a new transation. |
void |
clear()
Remove all the statements from the database which are associated with just this model. |
void |
close()
Close the Model and free up the resources held. |
Model |
commit()
Commit the current transaction. |
boolean |
contains(Resource s,
Property p,
RDFNode o)
Test if the model contains a triple |
Property |
convert(Property p)
Convert a property to a database implementation |
RDFNode |
convert(RDFNode n)
Convert a node (property, resource or literal) to a database implementation |
Resource |
convert(Resource r)
Convert a resource to a database implementation |
static ModelRDB |
create(IDBConnection dbcon,
java.lang.String databaseType)
Create a new database suitable for storing RDF data. |
static ModelRDB |
create(IDBConnection dbcon,
java.lang.String layoutType,
java.lang.String databaseType)
Create a new database suitable for storing RDF data. |
IConstraints |
createConstraints()
Create a constraint object appropriate for this type of database layout |
static ModelRDB |
createModel(IDBConnection dbcon,
java.lang.String name)
Create a new model on an existing, preformatted database. |
Statement |
createStatement(Resource r,
Property p,
RDFNode o)
create a new statement, not yet added to the modl |
static void |
deleteModel(IDBConnection dbcon,
java.lang.String name)
Create a named model from an existing multi-model database. |
Model |
difference(Model model)
Create a new model containing all the statements in this model which are not in another. |
IDBID |
getDBID()
Return the database index id for this model. |
StoreRDB |
getStore()
Return the store which underpins this model |
boolean |
independent()
Determine whether this model is independent. |
Model |
intersection(Model model)
Create a new model containing all the statements which are in both this model and another. |
static java.util.Iterator |
listModels(IDBConnection dbcon)
List the name of all models stored in the database |
StmtIterator |
listReifiedStatements()
list all statements which are present in reified form |
StmtIterator |
listStatements(IConstraints constraints)
List all the statements in the given moddel which make the given set of constraints (a constraint set can be obtained using createConstraints()). |
Model |
loadAll()
Loads all the statements for this model into an in-memory model. |
static ModelRDB |
open(IDBConnection dbcon)
Open an existing rdf database. |
static ModelRDB |
open(IDBConnection dbcon,
java.lang.String name)
Open an existing rdf database. |
Model |
query(Selector selector)
Create a new model containing the statements matching a query. |
boolean |
supportsJenaReification()
Returns true if the database layout supports implicit reification of statements (i.e. |
boolean |
supportsSetOperations()
Determine whether this model supports set operations. |
boolean |
supportsTransactions()
Determine whether this model supports transactions. |
Model |
union(Model model)
Create a new model containing all the statements in this model together with all of those in another given model. |
| Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.hp.hpl.mesa.rdf.jena.model.Model |
add, add, contains, contains, containsAll, containsAll, containsAny, containsAny, createLiteral, createLiteral, createProperty, createResource, createResource, equals, getProperty, getProperty, getResource, isReified, listNameSpaces, listObjects, listObjectsOfProperty, listObjectsOfProperty, listStatements, listStatements, listSubjects, listSubjectsWithProperty, listSubjectsWithProperty, read, read, read, read, remove, size, write, write, write |
| Methods inherited from interface com.hp.hpl.mesa.rdf.jena.model.ModelCon |
add, add, add, add, add, add, add, add, add, add, add, add, contains, contains, contains, contains, contains, contains, contains, contains, createAlt, createAlt, createBag, createBag, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createLiteral, createProperty, createResource, createResource, createResource, createResource, createSeq, createSeq, createStatement, createStatement, createStatement, createStatement, createStatement, createStatement, createStatement, createStatement, createStatement, createStatement, getAlt, getAlt, getBag, getBag, getProperty, getResource, getSeq, getSeq, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, remove, remove |
| Methods inherited from interface com.hp.hpl.mesa.rdf.jena.model.RDFReaderF |
getReader, getReader, setReaderClassName |
| Methods inherited from interface com.hp.hpl.mesa.rdf.jena.model.RDFWriterF |
getWriter, getWriter, setWriterClassName |
| Methods inherited from interface com.hp.hpl.mesa.rdf.jena.common.ModelI |
containerContains, containerIndexOf, containerSize, listContainerMembers |
| Constructor Detail |
public ModelRDB(IDBConnection dbcon)
throws RDFRDBException
dbcon - a DBConnectionI specifying the database connection
RDFRDBException - if the database cannot be opened| Method Detail |
public static ModelRDB open(IDBConnection dbcon,
java.lang.String name)
throws RDFRDBException
dbcon - a DBConnectionI specifying the database connectionname - the name of the RDF model to open, some database layouts support
multiple models in a single database
RDFRDBException
public static ModelRDB open(IDBConnection dbcon)
throws RDFRDBException
dbcon - a DBConnectionI specifying the database connection
RDFRDBException
public static ModelRDB createModel(IDBConnection dbcon,
java.lang.String name)
throws RDFRDBException
dbcon - a DBConnectionI specifying the database connectionname - the name to give the newly created model
RDFRDBException
public static void deleteModel(IDBConnection dbcon,
java.lang.String name)
throws RDFRDBException
dbcon - a DBConnectionI specifying the database connectionname - the name to give the newly created model
RDFRDBException
public static java.util.Iterator listModels(IDBConnection dbcon)
throws RDFRDBException
RDFRDBException
public static ModelRDB create(IDBConnection dbcon,
java.lang.String layoutType,
java.lang.String databaseType)
throws RDFRDBException
The appropriate RDF-RDB driver to use is assumed to be the class Driver
dbcon - a DBConnectionI specifying the database connectionlayoutType - the name of the layout style to use. Currently one of:
"Generic", "Hash", "MMGeneric", "MMHash", "Proc", "ThinProc".databaseType - the name of the database type. Currently one of:
"Interbase" "Postgresql" "Mysql" "Oracle". This may seem a little redundant
given that the jdbc uri implicitly contains this information but there is no
standard way of extracting this (esp. if the user connects via a bridge).
RDFRDBException
public static ModelRDB create(IDBConnection dbcon,
java.lang.String databaseType)
throws RDFRDBException
Uses a default layout format which is able to support multiple models in a single database.
databaseType - the name of the database type. Currently one of:
"Interbase" "Postgresql" "Mysql" "Oracle". This may seem a little redundant
given that the jdbc uri implicitly contains this information but there is no
standard way of extracting this (esp. if the user connects via a bridge).
RDFRDBExceptionpublic void close()
This will discard the underlying StoreRDB object which in turn. Multiple models can share a single underlying DBConnection object (when the database layout is type "MMxxx") so it is only when the last ModelRDB associated with a driver is closed that the driver itself will be closed which will close.
In earlier releases the final driver close resulted in closing the DBConnection which in turn closed the jdbc connection. This proved unpopular and has been removed. The close will free up associated prepared statements but the DBConnection will remain open so you should close that explicitly if you wish to shut down the jdbc connection.
close in interface Modelclose in class ModelCompublic StoreRDB getStore()
public IDBID getDBID()
public void clear()
throws RDFRDBException
RDFRDBException
public Model loadAll()
throws RDFException
RDFException
public StmtIterator listStatements(IConstraints constraints)
throws RDFException
createConstraints()).
RDFExceptionpublic IConstraints createConstraints()
public Resource convert(Resource r)
throws RDFException
convert in interface ModelIconvert in class ModelComr -
RDFException
public Property convert(Property p)
throws RDFException
convert in interface ModelIconvert in class ModelComp -
RDFException
public RDFNode convert(RDFNode n)
throws RDFException
convert in interface ModelIconvert in class ModelComn -
RDFExceptionpublic boolean supportsJenaReification()
public StmtIterator listReifiedStatements()
throws RDFException
listReifiedStatements in interface ModellistReifiedStatements in class ModelComRDFException - Generic RDF Exception
public Model add(Statement s)
throws RDFException
add in interface Modeladd in class ModelComs - The statement to be added.
RDFException - Generic RDF Exception
public boolean contains(Resource s,
Property p,
RDFNode o)
throws RDFException
contains in interface Modelcontains in class ModelComs - The subject of the statment tested.p - The predicate of the statement tested.o - The object of the statement tested.
RDFException - Generic RDF Exception
public Statement createStatement(Resource r,
Property p,
RDFNode o)
throws RDFException
createStatement in interface ModelcreateStatement in class ModelComr - the subject of the statementp - the predicate of the statemento - the object of the statement
RDFException - generic RDF exception
public Model begin()
throws RDFException
All changes made to a model within a transaction, will either be made, or none of them will be made.
begin in interface Modelbegin in class ModelComRDFException - Generic RDF Exception
public Model abort()
throws RDFException
abort in interface Modelabort in class ModelComRDFException - Generic RDF Exception
public Model commit()
throws RDFException
commit in interface Modelcommit in class ModelComRDFException - Generic RDF Exceptionpublic boolean independent()
For efficiency reasons, some implementations may create models which which are dependent on others, i.e. a change in one model may cause a change in another. If this is the case this method will return false, otherwise it will return true.
independent in interface Modelindependent in class ModelCompublic boolean supportsTransactions()
supportsTransactions in interface Modelpublic boolean supportsSetOperations()
Model
supportsSetOperations in interface Model
public Model query(Selector selector)
throws RDFException
ModelA statment is considered to match if the test method
of s returns true when called on s.
query in interface Modelselector - A selector object.
RDFException - Generic RDF exception.
public Model union(Model model)
throws RDFException
Model
union in interface Modelmodel - The other model whose statements are to be included.
RDFException - Generic RDF Exception
public Model intersection(Model model)
throws RDFException
Model
intersection in interface Modelmodel - The other model.
RDFException - Generic RDF Exception
public Model difference(Model model)
throws RDFException
Model
difference in interface Modelmodel - the other model whose statements are to be excluded.
RDFException - Generic RDF Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||