|
|||||||||||
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
GraphRDB implementation This graph stores data persistently in a relational database. Most application developers should not need to interact directly with GraphRDB, instead use ModelRDB. 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 specialied graphs is consistent and immutable after the graph is constructed. This aids optimization. For example, if a specialied 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 java.lang.String |
DEFAULT
|
static int |
OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING
Optimize all triples representing part or all of a reified statement. |
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. |
Fields inherited from interface com.hp.hpl.jena.graph.Graph |
ADD, DELETE, ORDERED, SIZE |
Constructor Summary | |
GraphRDB(IDBConnection con,
java.lang.String graphID,
Graph requestedProperties,
boolean isNew)
Deprecated. Please use the alernate constructor and explicely choose the desired reification behaviour. |
|
GraphRDB(IDBConnection con,
java.lang.String graphID,
Graph requestedProperties,
int reificationBehaviour,
boolean isNew)
Construct a new GraphRDB |
Method Summary | |
void |
add(java.util.List triples)
Add a list of triples. |
void |
close()
Free all resources, any further use of this Graph is an error. |
boolean |
contains(Node s,
Node p,
Node o)
Answer true iff the graph contains a triple matching (s, p, o). |
boolean |
contains(Triple t)
Answer true iff the graph contains a triple that t matches; t may be fluid. |
void |
delete(java.util.List triples)
Delete a list of triples. |
ExtendedIterator |
find(TripleMatch m)
Returns an iterator over all the Triples that match the triple pattern. |
BulkUpdateHandler |
getBulkUpdateHandler()
returns this Graph's bulk-update handler |
IDBConnection |
getConnection()
Return the connection |
Node |
getNode()
Returns the Node for this model in the system properties graph. |
com.hp.hpl.jena.shared.PrefixMapping |
getPrefixMapping()
returns this Graph's prefix mapping. |
ExtendedIterator |
getPropertyTriples()
Returns triples that describe this graph in the system properties graph. |
Reifier |
getReifier()
returns this Graph's reifier. |
TransactionHandler |
getTransactionHandler()
returns this Graph's transaction handler |
void |
performAdd(Triple t)
|
void |
performDelete(Triple t)
|
void |
remove()
Remove this Graph entirely from the database. |
int |
size()
|
Methods inherited from class com.hp.hpl.jena.graph.impl.GraphBase |
add, capabilities, delete, dependsOn, find, getCapabilities, getEventManager, isIsomorphicWith, notifyAdd, notifyDelete, queryHandler, toString, withReification |
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 |
add, capabilities, delete, dependsOn, find, getCapabilities, getEventManager, isIsomorphicWith, queryHandler |
Field Detail |
public static final java.lang.String DEFAULT
public static final int OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING
For common cases, where Graphs either contain mostly reified triples, or mostly non-reified triples, this is the best choice. 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
add(Triple)
or using the Reifier interface).
If you store a mix of reified and non-reified statments within a single graph
and you wish to query only non-reified statements, then this is more efficient than
the other options. However, it can 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 for backward compability with Jena 1.
Constructor Detail |
public GraphRDB(IDBConnection con, java.lang.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, java.lang.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_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS,
OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS or OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING.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 Node getNode()
public ExtendedIterator getPropertyTriples()
public void performAdd(Triple t)
public void add(java.util.List triples)
triples
- List to be added. This is unchanged by the callpublic void performDelete(Triple t)
public void delete(java.util.List triples)
triples
- List to be deleted. This is unchanged by the call.public int size()
size
in interface Graph
Graph.size()
public boolean contains(Triple t)
Graph
contains
in interface Graph
public boolean contains(Node s, Node p, Node o)
Graph
contains
in interface Graph
public ExtendedIterator find(TripleMatch m)
Graph
find
in interface Graph
Graph.find(TripleMatch)
public BulkUpdateHandler getBulkUpdateHandler()
Graph
getBulkUpdateHandler
in interface Graph
public Reifier getReifier()
Graph
getReifier
in interface Graph
public com.hp.hpl.jena.shared.PrefixMapping getPrefixMapping()
Graph
getPrefixMapping
in interface Graph
public TransactionHandler getTransactionHandler()
Graph
getTransactionHandler
in interface Graph
public void close()
Graph
close
in interface Graph
Graph.close()
public void remove()
public IDBConnection getConnection()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |