com.hp.hpl.jena.graph
Interface Graph

All Superinterfaces:
GraphAdd
All Known Subinterfaces:
BackwardRuleInfGraphI, ForwardRuleInfGraphI, InfGraph
All Known Implementing Classes:
BaseInfGraph, BasicForwardRuleInfGraph, CompositionBase, Delta, Difference, DisjointUnion, Dyadic, FBRuleInfGraph, com.hp.hpl.jena.graph.impl.GraphBase, Intersection, LPBackwardRuleInfGraph, MonitorGraph, MultiUnion, Polyadic, RandomOrderGraph, RDFSRuleInfGraph, RETERuleInfGraph, TransitiveInfGraph, Union, com.hp.hpl.jena.graph.impl.WrappedGraph

public interface Graph
extends GraphAdd

The interface to be satisfied by implementations maintaining collections of RDF triples. The core interface is small (add, delete, find, contains) and is augmented by additional classes to handle more complicated matters such as reification, query handling, bulk update, event management, and transaction handling.

For add(Triple) see GraphAdd.

Author:
Jeremy Carroll, Chris Dollin

Field Summary
static Graph emptyGraph
          An immutable empty graph.
 
Method Summary
 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(Triple t)
          Remove the triple t (if possible) from the set belonging to this graph
 boolean dependsOn(Graph other)
          true if this graph's content depends on the other graph.
 com.hp.hpl.jena.util.iterator.ExtendedIterator<Triple> find(Node s, Node p, Node o)
          Returns an iterator over Triple.
 com.hp.hpl.jena.util.iterator.ExtendedIterator<Triple> find(TripleMatch m)
          Returns an iterator over all the Triples that match the triple pattern.
 BulkUpdateHandler getBulkUpdateHandler()
          returns this Graph's bulk-update handler
 Capabilities getCapabilities()
          returns this Graph's capabilities
 GraphEventManager getEventManager()
          Answer this Graph's event manager.
 PrefixMapping getPrefixMapping()
          returns this Graph's prefix mapping.
 Reifier getReifier()
          returns this Graph's reifier.
 GraphStatisticsHandler getStatisticsHandler()
          Answer this Graph's statistics handler, or null if there isn't one.
 TransactionHandler getTransactionHandler()
          returns this Graph's transaction handler
 boolean isClosed()
          Answer true iff .close() has been called onn this Graph.
 boolean isEmpty()
          Answer true iff this graph is empty.
 boolean isIsomorphicWith(Graph g)
          Compare this graph with another using the method described in http://www.w3.org/TR/rdf-concepts#section-Graph-syntax
 QueryHandler queryHandler()
          returns this Graph's query handler
 int size()
          For a concrete graph this returns the number of triples in the graph.
 
Methods inherited from interface com.hp.hpl.jena.graph.GraphAdd
add
 

Field Detail

emptyGraph

static final Graph emptyGraph
An immutable empty graph.

Method Detail

dependsOn

boolean dependsOn(Graph other)
true if this graph's content depends on the other graph. May be pessimistic (ie return true if it's not sure). Typically true when a graph is a composition of other graphs, eg union.

Parameters:
other - the graph this graph may depend on
Returns:
false if this does not depend on other

queryHandler

QueryHandler queryHandler()
returns this Graph's query handler


getTransactionHandler

TransactionHandler getTransactionHandler()
returns this Graph's transaction handler


getBulkUpdateHandler

BulkUpdateHandler getBulkUpdateHandler()
returns this Graph's bulk-update handler


getCapabilities

Capabilities getCapabilities()
returns this Graph's capabilities


getEventManager

GraphEventManager getEventManager()
Answer this Graph's event manager.


getStatisticsHandler

GraphStatisticsHandler getStatisticsHandler()
Answer this Graph's statistics handler, or null if there isn't one. Every call to this method on a particular graph delivers the same (==) answer.


getReifier

Reifier getReifier()
returns this Graph's reifier. Each call on a given Graph gets the same Reifier object.


getPrefixMapping

PrefixMapping getPrefixMapping()
returns this Graph's prefix mapping. Each call on a given Graph gets the same PrefixMapping object, which is the one used by the Graph.


delete

void delete(Triple t)
            throws DeleteDeniedException
Remove the triple t (if possible) from the set belonging to this graph

Parameters:
t - the triple to add to the graph
Throws:
DeleteDeniedException - if the triple cannot be removed

find

com.hp.hpl.jena.util.iterator.ExtendedIterator<Triple> find(TripleMatch m)
Returns an iterator over all the Triples that match the triple pattern.

Parameters:
m - a Triple[Match] encoding the pattern to look for
Returns:
an iterator of all triples in this graph that match m

find

com.hp.hpl.jena.util.iterator.ExtendedIterator<Triple> find(Node s,
                                                            Node p,
                                                            Node o)
Returns an iterator over Triple.


isIsomorphicWith

boolean isIsomorphicWith(Graph g)
Compare this graph with another using the method described in http://www.w3.org/TR/rdf-concepts#section-Graph-syntax

Parameters:
g - Compare against this.
Returns:
boolean True if the two graphs are isomorphic.

contains

boolean contains(Node s,
                 Node p,
                 Node o)
Answer true iff the graph contains a triple matching (s, p, o). s/p/o may be concrete or fluid. Equivalent to find(s,p,o).hasNext, but an implementation is expected to optimise this in easy cases.


contains

boolean contains(Triple t)
Answer true iff the graph contains a triple that t matches; t may be fluid.


close

void close()
Free all resources, any further use of this Graph is an error.


isEmpty

boolean isEmpty()
Answer true iff this graph is empty. "Empty" means "has as few triples as it can manage", because an inference graph may have irremovable axioms and their consequences.


size

int size()
For a concrete graph this returns the number of triples in the graph. For graphs which might infer additional triples it results an estimated lower bound of the number of triples. For example, an inference graph might return the number of triples in the raw data graph.


isClosed

boolean isClosed()
Answer true iff .close() has been called onn this Graph.



Licenced under the Apache License, Version 2.0