|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graph
An RDF Graph. As defined by the Resource Description Framework (RDF): Concepts and Abstract Syntax specification. An RDF graph is a set of RDF triples. The set of nodes of an RDF graph is the set of subjects and objects of triples in the graph.
Method Summary | |
---|---|
void |
add(Iterator<Triple> triples)
Adds all the triples contained in an iterator into the graph. |
void |
add(SubjectNode subject,
PredicateNode predicate,
ObjectNode object)
Adds a triple to the graph. |
void |
add(Triple... triples)
Adds all the triples into the graph. |
void |
add(Triple triple)
Adds a triple to the graph. |
void |
clear()
Removes all statements and resource related to those statements from the graph. |
void |
close()
Closes any resources associated with this graph. |
boolean |
contains(SubjectNode subject,
PredicateNode predicate,
ObjectNode object)
Test the graph for the occurrence of a statement. |
boolean |
contains(Triple triple)
Test the graph for the occurrence of the triple. |
ClosableIterator<Triple> |
find(SubjectNode subject,
PredicateNode predicate,
ObjectNode object)
Returns an iterator of Triple s to a set of statements that
match a given subject, predicate and object. |
ClosableIterator<Triple> |
find(Triple triple)
Returns an iterator of Triple s to a set of statements that
match a given subject, predicate and object. |
ClosableIterator<? extends Node> |
findNodes(NodeType type)
Returns all unique values of a given type. |
ClosableIterator<PredicateNode> |
findPredicates(Resource resource)
Return predicates that are part of an RDF triple where resource is either a subject or object. |
ClosableIterator<? super Resource> |
findResources(ValueNodeType type)
Returns all unique resources for a given ValueNodeType (BNode or URIReference is currently supported). |
GraphElementFactory |
getElementFactory()
Returns the node factory for the graph, or creates one. |
long |
getNumberOfTriples()
Returns the number of triples in the graph. |
TripleFactory |
getTripleFactory()
Returns the triple factory for the graph, or creates one. |
boolean |
isEmpty()
Returns true if the graph is empty i.e. the number of triples is 0. |
void |
remove(Iterator<Triple> triples)
Removes all the triples contained in an iterator from the graph. |
void |
remove(SubjectNode subject,
PredicateNode predicate,
ObjectNode object)
Removes a triple from the graph. |
void |
remove(Triple... triples)
Removes all the triples into the graph. |
void |
remove(Triple triple)
Removes a triple from the graph. |
Method Detail |
---|
boolean contains(Triple triple) throws GraphException
triple
- The triple to find.
GraphException
- If there was an error accessing the graph.boolean contains(SubjectNode subject, PredicateNode predicate, ObjectNode object) throws GraphException
subject
- The subject to find or AnySubjectNode to indicate any subject.predicate
- The predicate to find or AnyPredicateNode to indicate any predicate.object
- The object to find or AnyObjectNode to indicate any object.
GraphException
- If there was an error accessing the graph.ClosableIterator<Triple> find(Triple triple) throws GraphException
Triple
s to a set of statements that
match a given subject, predicate and object. An AnyNode value for any of
the parts of a triple are treated as unconstrained, any values will be
returned.
triple
- The triple to find.
GraphException
- If there was an error accessing the graph.ClosableIterator<Triple> find(SubjectNode subject, PredicateNode predicate, ObjectNode object) throws GraphException
Triple
s to a set of statements that
match a given subject, predicate and object. An AnyNode value for any of
the parts of a triple are treated as unconstrained, any values will be
returned.
subject
- The subject to find or AnySubjectNode to indicate any subject.predicate
- The predicate to find or AnyPredicateNode to indicate any predicate.object
- The object to find or AnyObjectNode to indicate any object.
GraphException
- If there was an error accessing the graph.ClosableIterator<? extends Node> findNodes(NodeType type)
type
- the node type can be positional (SPO) or node type (URIReference, Literal or BNode).
ClosableIterator<PredicateNode> findPredicates(Resource resource) throws GraphException
resource
- the resource that is either a subject or object in a triple.
GraphException
- If there was an error accessing the graph.ClosableIterator<? super Resource> findResources(ValueNodeType type)
type
- either BlankNodeType or URIReferenceNodeType.
void add(SubjectNode subject, PredicateNode predicate, ObjectNode object) throws GraphException
GraphElementFactory
.
subject
- The subject.predicate
- The predicate.object
- The object.
GraphException
- If the statement can't be made.void add(Triple triple) throws GraphException
GraphElementFactory
.
triple
- The triple.
GraphException
- If the statement can't be made.void add(Iterator<Triple> triples) throws GraphException
GraphElementFactory
.
triples
- The triple iterator.
GraphException
- If the statements can't be made.void add(Triple... triples) throws GraphException
GraphElementFactory
.
triples
- the triples to add.
GraphException
- If the statements can't be made.void clear()
void close()
void remove(SubjectNode subject, PredicateNode predicate, ObjectNode object) throws GraphException
GraphElementFactory
.
subject
- The subject.predicate
- The predicate.object
- The object.
GraphException
- If there was an error revoking the statement, For example if it didn't exist.void remove(Triple triple) throws GraphException
GraphElementFactory
.
triple
- The triple.
GraphException
- If there was an error revoking the statement, For
example if it didn't exist.void remove(Iterator<Triple> triples) throws GraphException
GraphElementFactory
.
triples
- The triple iterator.
GraphException
- If the statements can't be revoked.void remove(Triple... triples) throws GraphException
GraphElementFactory
.
triples
- the triples to remove.
GraphException
- If the statements can't be revoked.GraphElementFactory getElementFactory()
TripleFactory getTripleFactory()
long getNumberOfTriples() throws GraphException
GraphException
- If the statements number of statements in the graph fails to be found.boolean isEmpty() throws GraphException
GraphException
- If the statements number of statements in the graph fails to be found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |