Class DynamicModel

java.lang.Object
java.util.AbstractCollection<Statement>
java.util.AbstractSet<Statement>
org.eclipse.rdf4j.model.impl.DynamicModel
All Implemented Interfaces:
Serializable, Iterable<Statement>, Collection<Statement>, Set<Statement>, Model, NamespaceAware

public class DynamicModel extends AbstractSet<Statement> implements Model
A LinkedHashModel or a TreeModel achieves fast data access at the cost of higher indexing time. The DynamicModel postpones this cost until such access is actually needed. It stores all data in a LinkedHashMap and supports adding, retrieving and removing data. The model will upgrade to a full model (provided by the modelFactory) if more complex operations are called, for instance removing data according to a pattern (eg. all statements with rdf:type as predicate).

DynamicModel is thread safe to the extent that the underlying LinkedHashMap or Model is. The upgrade path is protected by the actual upgrade method being synchronized. The LinkedHashMap storage is not removed once upgraded, so concurrent reads that have started reading from the LinkedHashMap can continue to read even during an upgrade. We do make the LinkedHashMap unmodifiable to reduce the chance of there being a bug.

Author:
HÃ¥vard Mikkelsen Ottestad
See Also: