org.apache.clerezza.rdf.core
Interface TripleCollection

All Superinterfaces:
Collection<Triple>, Iterable<Triple>
All Known Subinterfaces:
Graph, LockableMGraph, MGraph
All Known Implementing Classes:
AbstractGraph, AbstractMGraph, AbstractTripleCollection, LockableMGraphWrapper, PrivilegedGraphWrapper, PrivilegedMGraphWrapper, PrivilegedTripleCollectionWrapper, SecuredMGraph, SecuredTripleCollection, SimpleGraph, SimpleMGraph, WriteBlockedMGraph, WriteBlockedTripleCollection

public interface TripleCollection
extends Collection<Triple>

A set of triples (as it doesn't allow duplicates), it does however not extend Set as it doesn't inherit its specification for hashCode() and equals. It is possible to add GraphListener to listen for modifications in the triples.

Author:
reto

Method Summary
 void addGraphListener(GraphListener listener, FilterTriple filter)
          Adds the specified GraphListener to the graph.
 void addGraphListener(GraphListener listener, FilterTriple filter, long delay)
          Adds the specified GraphListener to the graph.
 Iterator<Triple> filter(NonLiteral subject, UriRef predicate, Resource object)
          Filters triples given a pattern.
 void removeGraphListener(GraphListener listener)
          Removes the specified GraphListener from the graph.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

filter

Iterator<Triple> filter(NonLiteral subject,
                        UriRef predicate,
                        Resource object)
Filters triples given a pattern. filter(null, null, null) returns the same as iterator()

Parameters:
subject -
predicate -
object -
Returns:
Iterator

addGraphListener

void addGraphListener(GraphListener listener,
                      FilterTriple filter,
                      long delay)
Adds the specified GraphListener to the graph. This listener will be notified, when the graph is modified and the Triple that was part of the modifiaction matched the specified FilterTriple. The notification will be passed to the listener after the specified delay time (in milli-seconds) has passed. If more matching events occur during the delay period, then they are passed all together at the end of the delay period. If the the listener unregisters or the platform is stopped within the period then the already occurred events may not be delivered. All implementations support this method, immutable implementations will typically provide an empty implementation, they shall not throw an exception. Implementation of which the triples change over time without add- and remove-methods being called (e.g. implementation dynamically generating their triples on invocation of the filer-method) may choose not to, or only partially propagate their changes to the listener. They should describe the behavior in the documentation of the class. Implementations should keep weak references the listeners, so that the listener can be garbage collected if its no longer referenced by another object. If delay is 0 notification will happen synchroneously.

Parameters:
listener - The listener that will be notified
filter - The triple filter with which triples are tested, that were part of the modification.
delay - The time period afer which the listener will be notified in milliseconds.

addGraphListener

void addGraphListener(GraphListener listener,
                      FilterTriple filter)
Adds the specified GraphListener to the graph. This listener will be notified, when the graph is modified and the Triple that was part of the modifiaction matched the specified FilterTriple. The notification will be passed without delay. Same as addGraphListener(listener, filter, 0).

Parameters:
listener - The listener that will be notified
filter - The triple filter with which triples are tested, that were part of the modification.

removeGraphListener

void removeGraphListener(GraphListener listener)
Removes the specified GraphListener from the graph. This listener will no longer be notified, when the graph is modified.

Parameters:
listener - The listener to be removed.


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.