Class ObjectSet<T>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<T>
com.inrupt.rdf.wrapping.commons.ObjectSet<T>
Type Parameters:
T - the type of elements handled by this set
All Implemented Interfaces:
Iterable<T>, Collection<T>, Set<T>

public class ObjectSet<T> extends AbstractSet<T>
This class implements the Set interface as a dynamic, mutable view over an RDF predicate-object list (statements that share a subject and a predicate). It is intended for use in classes that wrap RDF nodes for strongly typed convenience mapping.

This set does not permit null elements.

The order of elements returned by this implementation is not guaranteed as it depends on the ordering of query results in the underlying Graph. This reflects the unordered nature of RDF graphs.

The synchronization characteristics and time complexity of this implementation are those of the underlying Graph implementation. It could well be that read and write operations on instances of this class result in expensive IO operations. Even simple iteration is most likely to be much less performant than what callers expect from other Java collections.

The iterators returned by this implementation do not support the Iterator.remove() operation.

This implementation uses the AbstractSet.equals(Object) and AbstractSet.hashCode() operations. Equality and hashing are dynamic: They depend on the state of the underlying Graph at the time of calling and are not fixed when creating the instance.

Example: Given a node wrapper N, instances of this class can be used to make read/write strongly typed set properties.

public class N {
     public Set<String> getType {
         return new PredicateObjectSet<>(
             this,
             RDF.type,
             g,
             NodeMappings::asIriResource,
             ValueMappings::iriAsString
         );
     }
 }
Author:
Samu Lang