org.openrdf.model
Interface Graph

All Known Implementing Classes:
GraphImpl

public interface Graph

Graph is an interface for fast manipulation of collections of RDF statements in code.

Version:
$Revision: 1.4.2.3 $
Author:
Jeen Broekstra

Method Summary
 void add(Collection statements)
          Adds all statements in the Collection to the graph.
 void add(Collection statements, boolean joinBlankNodes)
          Adds all statements in the Collection to the graph.
 void add(Graph graph)
          Adds all statements in the supplied graph to this graph.
 void add(Graph graph, boolean joinBlankNodes)
          Adds all statements in the supplied graph to this graph.
 void add(Resource subject, URI predicate, Value object)
          Adds a single statement to the graph.
 void add(Statement statement)
          Adds a single statement to the graph.
 void add(StatementIterator iterator)
          Adds all statements in the iterator to the graph.
 void add(StatementIterator iterator, boolean joinBlankNodes)
          Adds all statements in the iterator to the graph.
 void clear()
          Clears the graph.
 boolean contains(Resource subject, URI predicate, Value object)
          Checks if a statement matching the (subject, predicate, object) pattern is present in the graph.
 boolean contains(Statement statement)
          Checks if the supplied statement is present in the graph.
 Collection getStatementCollection(Resource subject, URI predicate, Value object)
          Retrieves all statements matching the (subject, predicate, object) pattern in the graph as a Collection.
 StatementIterator getStatements()
          Retrieves all statements in the graph as an iterator
 StatementIterator getStatements(Resource subject, URI predicate, Value object)
          Retrieves all statements matching the (subject, predicate, object) pattern in the graph as an iterator.
 ValueFactory getValueFactory()
          Retrieves a ValueFactory for this graph.
 int remove(Graph graph)
          Remove all statements in the supplied graph from this graph.
 int remove(Resource subject, URI predicate, Value object)
          Remove all statements matching the (subject, predicate, object) pattern from the graph.
 int remove(Statement statement)
          Remove the supplied statement from the graph.
 int remove(StatementIterator iterator)
          Remove all statements in the StatementIterator from the graph.
 

Method Detail

add

public void add(Resource subject,
                URI predicate,
                Value object)
Adds a single statement to the graph. If the supplied parameters contain any blank nodes that are shared with this graph, these will be joined.

Parameters:
subject - the statement subject
predicate - the statement predicate
object - the statement object

add

public void add(Statement statement)
Adds a single statement to the graph. If the supplied statements contains any blank nodes that are shared with this graph, these will be joined.

Parameters:
statement - the statement to be added

add

public void add(StatementIterator iterator)
Adds all statements in the iterator to the graph. If the supplied iterator contains any blank nodes that are shared with this graph, these will be joined.

Parameters:
iterator - an iterator containing statements

add

public void add(StatementIterator iterator,
                boolean joinBlankNodes)
Adds all statements in the iterator to the graph.

Parameters:
iterator - an iterator containing statements
joinBlankNodes - specifies whether blank nodes in the supplied iterator should be joined with this graph. If false, new blank nodes will be created for each blank node in the supplied iterator.

add

public void add(Collection statements)
Adds all statements in the Collection to the graph. If the supplied collection contains any blank nodes that are shared with this graph, these will be joined.

Parameters:
statements - a Collection containing Statement objects.

add

public void add(Collection statements,
                boolean joinBlankNodes)
Adds all statements in the Collection to the graph.

Parameters:
statements - a Collection containing statements
joinBlankNodes - specifies whether blank nodes in the supplied Collection should be joined with this graph. If false, new blank nodes will be created for each blank node in the supplied Collection.

add

public void add(Graph graph)
Adds all statements in the supplied graph to this graph. If the supplied graph contains any blank nodes that are shared with this graph, these will be joined.

Parameters:
graph - the supplied graph, to be added to this graph.

add

public void add(Graph graph,
                boolean joinBlankNodes)
Adds all statements in the supplied graph to this graph.

Parameters:
graph - the supplied graph, to be added to this graph.
joinBlankNodes - specifies whether blank nodes in the supplied graph should be joined with this graph. If false, new blank nodes will be created for each blank node in the supplied graph.

contains

public boolean contains(Resource subject,
                        URI predicate,
                        Value object)
Checks if a statement matching the (subject, predicate, object) pattern is present in the graph.

Parameters:
subject - the statement subject, or null for a wildcard.
predicate - the statement predicate, or null for a wildcard.
object - the statement object, or null for a wildcard.
Returns:
true if a matching statement is found, false otherwise.

contains

public boolean contains(Statement statement)
Checks if the supplied statement is present in the graph.

Parameters:
statement - the statement for which presence is checked.
Returns:
true if the statement is present in the graph, false otherwise.

getStatements

public StatementIterator getStatements()
Retrieves all statements in the graph as an iterator

Returns:
a StatementIterator containing all statements in the graph.

getStatements

public StatementIterator getStatements(Resource subject,
                                       URI predicate,
                                       Value object)
Retrieves all statements matching the (subject, predicate, object) pattern in the graph as an iterator.

Parameters:
subject - the statement subject, or null for a wildcard
predicate - the statement predicate, or null for a wildcard
object - the statement object, or null for a wildcard
Returns:
a StatementIterator containing all matching statements in the graph.

getStatementCollection

public Collection getStatementCollection(Resource subject,
                                         URI predicate,
                                         Value object)
Retrieves all statements matching the (subject, predicate, object) pattern in the graph as a Collection.

Parameters:
subject - the statement subject, or null for a wildcard.
predicate - the statement predicate, or null for a wildcard.
object - the statement object, or null for a wildcard.
Returns:
a Collection of matching statements.

remove

public int remove(Resource subject,
                  URI predicate,
                  Value object)
Remove all statements matching the (subject, predicate, object) pattern from the graph.

Parameters:
subject - the statement subject, or null for a wildcard.
predicate - the statement predicate, or null for a wildcard.
object - the statement object, or null for a wildcard.
Returns:
the number of statements that were removed.

remove

public int remove(Statement statement)
Remove the supplied statement from the graph.

Parameters:
statement - the statement to be removed.
Returns:
the number of statements removed. If the statement was not present in the graph, 0 is returned.

remove

public int remove(StatementIterator iterator)
Remove all statements in the StatementIterator from the graph.

Parameters:
iterator - A StatementIterator containing all statements to be removed.
Returns:
the number of statements removed.

remove

public int remove(Graph graph)
Remove all statements in the supplied graph from this graph.

Parameters:
graph -
Returns:
the number of statements removed.

clear

public void clear()
Clears the graph. All statements are removed from the graph.


getValueFactory

public ValueFactory getValueFactory()
Retrieves a ValueFactory for this graph.

Returns:
a ValueFactory.


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.