|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | 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.
The constructor will open the default model on a jdbc url whereas a variety of static factory methods are available for creating and reopening database.
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 |
begin()
Begin a new transation. |
void |
close()
Close the Model and free up resources held. |
Model |
commit()
Commit the current transaction. |
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 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. |
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 |
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() ). |
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 |
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, add, contains, contains, contains, containsAll, containsAll, containsAny, containsAny, createLiteral, createLiteral, createProperty, createResource, createResource, createStatement, equals, getProperty, getProperty, getResource, isReified, listNameSpaces, listObjects, listObjectsOfProperty, listObjectsOfProperty, listReifiedStatements, 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, 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 connectionRDFRDBException
- if the database cannot be openedMethod 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 databasepublic static ModelRDB open(IDBConnection dbcon) throws RDFRDBException
dbcon
- a DBConnectionI specifying the database connectionpublic 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 modelpublic static java.util.Iterator listModels(IDBConnection dbcon) throws 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" etc.databaseType
- the name of the database type. Currently one of:
"Interbase" "Postgresql" etc. 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).
public void close()
Not all implementations of Model require this method to be called. But some do, so in general its best to call it when done with the object, rather than leave it to the finalizer.
close
in interface Model
close
in class ModelCom
public StoreRDB getStore()
public IDBID getDBID()
public StmtIterator listStatements(IConstraints constraints) throws RDFException
createConstraints()
).public IConstraints createConstraints()
public Resource convert(Resource r) throws RDFException
convert
in interface ModelI
convert
in class ModelCom
com.hp.hpl.mesa.rdf.jena.common.ModelI
r
- RDFException
- public Property convert(Property p) throws RDFException
convert
in interface ModelI
convert
in class ModelCom
com.hp.hpl.mesa.rdf.jena.common.ModelI
p
- RDFException
- public RDFNode convert(RDFNode n) throws RDFException
convert
in interface ModelI
convert
in class ModelCom
com.hp.hpl.mesa.rdf.jena.common.ModelI
n
- RDFException
- 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 Model
begin
in class ModelCom
RDFException
- Generic RDF Exceptionpublic Model abort() throws RDFException
abort
in interface Model
abort
in class ModelCom
RDFException
- Generic RDF Exceptionpublic Model commit() throws RDFException
commit
in interface Model
commit
in class ModelCom
RDFException
- 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 Model
independent
in class ModelCom
public boolean supportsTransactions()
supportsTransactions
in interface Model
public boolean supportsSetOperations()
Model
supportsSetOperations
in interface Model
com.hp.hpl.mesa.rdf.jena.model.Model
public Model query(Selector selector) throws RDFException
Model
A statment is considered to match if the test
method
of s returns true when called on s.
query
in interface Model
com.hp.hpl.mesa.rdf.jena.model.Model
s
- A selector object.RDFException
- Generic RDF exception.public Model union(Model model) throws RDFException
Model
union
in interface Model
com.hp.hpl.mesa.rdf.jena.model.Model
model
- The other model whose statements are to be included.RDFException
- Generic RDF Exceptionpublic Model intersection(Model model) throws RDFException
Model
intersection
in interface Model
com.hp.hpl.mesa.rdf.jena.model.Model
model
- The other model.RDFException
- Generic RDF Exceptionpublic Model difference(Model model) throws RDFException
Model
difference
in interface Model
com.hp.hpl.mesa.rdf.jena.model.Model
model
- the other model whose statements are to be excluded.RDFException
- Generic RDF Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |