|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hp.hpl.jena.graph.impl.GraphBase
com.hp.hpl.jena.db.GraphRDB
public class GraphRDB
A persistent Graph implementation using a relational database for storage.
This graph stores data persistently in a relational database. It supports the full Graph interface and should operate just like a GraphMem.
Internally, each GraphRDB keeps a list of specialized graphs. For each operation, it works through the list of graphs attempting to perform the operation on each one.
The intention is that each type of specialized graph is optimized for a different type of triple. For example, one type of specialied graph might be optimized for storing triples in a particular ontology. The last specialized graph in the list is always a generic one that can handle any valid RDF triple.
The order of the specialized graphs is consistent and immutable after the graph is constructed. This aids optimization. For example, if a specialized graph is asked to perform an operatin on a triple, and it knows that it would have added it if asked, then it can advise the calling GraphRDB that the operaton is complete even though it doesn't know anything about other specialized graphs later in the list.
Field Summary | |
---|---|
static String |
DEFAULT
The name used for the default graph. |
static int |
OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING
Optimize all triples representing part or all of a reified statement; this is the recommended option. |
static int |
OPTIMIZE_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS
Optimize and hide any triples representing part or all of a reified statement. |
static int |
OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS
Optimize and hide only fully reified statements added via the Reifier interface, use only for backward-compatability with Jena1. |
Fields inherited from interface com.hp.hpl.jena.graph.Graph |
---|
emptyGraph |
Constructor Summary | |
---|---|
GraphRDB(IDBConnection con,
String graphID,
Graph requestedProperties,
boolean isNew)
Deprecated. Please use the alternate constructor and choose the desired reification behaviour. |
|
GraphRDB(IDBConnection con,
String graphID,
Graph requestedProperties,
int reificationBehaviour,
boolean isNew)
Construct a new GraphRDB |
Method Summary | |
---|---|
void |
add(List triples)
Add a list of triples. |
void |
close()
Close this graph. |
void |
delete(List triples)
Delete a list of triples. |
BulkUpdateHandler |
getBulkUpdateHandler()
Answer a BulkUpdateHandler bound to this graph. |
IDBConnection |
getConnection()
Return the connection |
boolean |
getDoDuplicateCheck()
Get the value of DoDuplicateCheck |
Node |
getNode()
Returns the Node for this model in the system properties graph. |
PrefixMapping |
getPrefixMapping()
Answer the PrefixMapping object for this graph, the same one each time. |
ExtendedIterator |
getPropertyTriples()
Returns triples that describe this graph in the system properties graph. |
Reifier |
getReifier()
Answer this graph's reifier. |
Iterator |
getSpecializedGraphs()
Return an iterator over the specialized graphs for this graph |
TransactionHandler |
getTransactionHandler()
Answer a transaction handler bound to this graph. |
boolean |
graphBaseContains(Triple t)
Answer true if the graph contains any triple matching t . |
ExtendedIterator |
graphBaseFind(TripleMatch m)
Answer an iterator over all the triples held in this graph's non-reified triple store that match m . |
int |
graphBaseSize()
Answer the number of triples in this graph. |
void |
performAdd(Triple t)
Add a triple to the triple store. |
void |
performDelete(Triple t)
Remove a triple from the triple store. |
QueryHandler |
queryHandler()
Answer a QueryHandler bound to this graph. |
int |
reificationBehavior()
Return the reification behavior (GraphRDB) for this graph |
int |
reifierSize()
Answer the number of visible reification quads. |
ExtendedIterator |
reifierTriples(TripleMatch m)
Answer an iterator over all the triples exposed in this graph's reifier that match m . |
void |
remove()
Remove this Graph entirely from the database. |
void |
setDoDuplicateCheck(boolean bool)
Set the value of DoDuplicateCheck. |
static ReificationStyle |
styleRDB(int behaviour)
Answer the reification style corresponding to the DB behaviour integer. |
static int |
styleRDB(ReificationStyle style)
Answer the integer representing the RDB reifier style given the Reifier style. |
Methods inherited from class com.hp.hpl.jena.graph.impl.GraphBase |
---|
add, contains, contains, delete, dependsOn, find, find, getCapabilities, getEventManager, isEmpty, isIsomorphicWith, notifyAdd, notifyDelete, size, toString, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.hp.hpl.jena.graph.Graph |
---|
contains, contains, delete, dependsOn, find, find, getCapabilities, getEventManager, isEmpty, isIsomorphicWith, size |
Methods inherited from interface com.hp.hpl.jena.graph.GraphAdd |
---|
add |
Field Detail |
---|
public static final String DEFAULT
public static final int OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING
This is the best choice in almost every case. It optimizes all reified triples regardless of how they are added to the graph, provides a simple interface, and is quite efficient.
With this choice, if you do add(A)
then
contains(A)
will return true for all A.
public static final int OPTIMIZE_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS
This optimizes all triples but hides them so they are visible only via the reifier interface. There is no significant performance advantage in using this option and it is not recommended. It is included only for compatability with in-memory graphs.
Note that it will also cause unexpected behaviour, for example, if you do:
add(new Triple( s, RDF.predicate, o))
then that triple will be hidden and a subsequent call to contains
,
find
, or size
will not show it's presence. The only
way to see that statement is to use Reifier.getHiddenTriples
.
public static final int OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS
This treats triples added through the Reifier interface as distinct from those added using the normal Graph.add function. Those added via the reifier interface will be optimized and hidden from view. Those added via Graph.add will not be optimized and will be visible.
Since many of the techniques for adding triple to Graphs use Graph.add, and that is never optimized, this is not usually a good choice. It is included only for backward compability with Jena 1. There is no performance advantage in using this option.
Constructor Detail |
---|
public GraphRDB(IDBConnection con, String graphID, Graph requestedProperties, boolean isNew)
con
- an open connection to the databasegraphID
- is the name of a graph or GraphRDB.DEFAULTrequestedProperties
- a set of default properties.
(May be null, if non-null should be a superset of the properties
obtained by calling ModelRDB.getDefaultModelProperties ).isNew
- is true if the graph doesn't already exist and
false otherwise. (If unsure, test for existance by using
IDBConnection.containsGraph ).public GraphRDB(IDBConnection con, String graphID, Graph requestedProperties, int reificationBehaviour, boolean isNew)
con
- an open connection to the databasegraphID
- is the name of a graph or GraphRDB.DEFAULTrequestedProperties
- a set of default properties.
(May be null, if non-null should be a superset of the properties
obtained by calling ModelRDB.getDefaultModelProperties ).reificationBehaviour
- specifies how this graph should handle reified triples.
The options are OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING (strongly recommended), OPTIMIZE_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS (included only for full compatability with all the options for in-memory Graphs),
OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS (included only for compatability with older jena1-style usage).isNew
- is true if the graph doesn't already exist and
false otherwise. (If unsure, test for existance by using
IDBConnection.containsGraph ).Method Detail |
---|
public static int styleRDB(ReificationStyle style)
public static ReificationStyle styleRDB(int behaviour)
public Node getNode()
public ExtendedIterator getPropertyTriples()
public void performAdd(Triple t)
com.hp.hpl.jena.graph.impl.GraphBase
performAdd
in interface com.hp.hpl.jena.graph.impl.GraphWithPerform
performAdd
in class com.hp.hpl.jena.graph.impl.GraphBase
public void add(List triples)
triples
- List to be added. This is unchanged by the callpublic void performDelete(Triple t)
com.hp.hpl.jena.graph.impl.GraphBase
performDelete
in interface com.hp.hpl.jena.graph.impl.GraphWithPerform
performDelete
in class com.hp.hpl.jena.graph.impl.GraphBase
public void delete(List triples)
triples
- List to be deleted. This is unchanged by the call.public int graphBaseSize()
com.hp.hpl.jena.graph.impl.GraphBase
graphBaseSize
in class com.hp.hpl.jena.graph.impl.GraphBase
public boolean graphBaseContains(Triple t)
com.hp.hpl.jena.graph.impl.GraphBase
t
.
The default implementation uses find
and checks to see
if the iterator is non-empty.
graphBaseContains
in class com.hp.hpl.jena.graph.impl.GraphBase
public ExtendedIterator graphBaseFind(TripleMatch m)
com.hp.hpl.jena.graph.impl.GraphBase
m
. Subclasses must override; it is the core
implementation for find(TripleMatch)
.
graphBaseFind
in class com.hp.hpl.jena.graph.impl.GraphBase
public ExtendedIterator reifierTriples(TripleMatch m)
com.hp.hpl.jena.graph.impl.GraphBase
m
. The default implementation delegates this to
the reifier; subclasses probably don't need to override this.
reifierTriples
in class com.hp.hpl.jena.graph.impl.GraphBase
public int reifierSize()
com.hp.hpl.jena.graph.impl.GraphBase
reifierSize
in class com.hp.hpl.jena.graph.impl.GraphBase
public BulkUpdateHandler getBulkUpdateHandler()
com.hp.hpl.jena.graph.impl.GraphBase
getBulkUpdateHandler
in interface Graph
getBulkUpdateHandler
in class com.hp.hpl.jena.graph.impl.GraphBase
public Reifier getReifier()
com.hp.hpl.jena.graph.impl.GraphBase
getReifier
in interface Graph
getReifier
in class com.hp.hpl.jena.graph.impl.GraphBase
public PrefixMapping getPrefixMapping()
com.hp.hpl.jena.graph.impl.GraphBase
getPrefixMapping
in interface Graph
getPrefixMapping
in class com.hp.hpl.jena.graph.impl.GraphBase
public TransactionHandler getTransactionHandler()
com.hp.hpl.jena.graph.impl.GraphBase
getTransactionHandler
in interface Graph
getTransactionHandler
in class com.hp.hpl.jena.graph.impl.GraphBase
public void close()
com.hp.hpl.jena.graph.impl.GraphBase
close
in interface Graph
close
in class com.hp.hpl.jena.graph.impl.GraphBase
public void remove()
public IDBConnection getConnection()
public int reificationBehavior()
public Iterator getSpecializedGraphs()
public QueryHandler queryHandler()
com.hp.hpl.jena.graph.impl.GraphBase
queryHandler
in interface Graph
queryHandler
in class com.hp.hpl.jena.graph.impl.GraphBase
public boolean getDoDuplicateCheck()
public void setDoDuplicateCheck(boolean bool)
bool
- boolean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |