When using the SesameManagerFactory, all entities created will implement the interface Entity and SesameEntity. The Entity has access to the qualified-name of the resource as a QName and the ElmoManager. The SesameEntity interface provides access to the the Sesame resource for this entity and the SesameManager instance used to create it. The SesameManager provides access to the Sesame repository connection used by this manager.
The entity's non-functional properties (type of java.util.Set) stream the results from the repositories and should be closed after every iteration to clean up temporary resources. They will close themselves automatically once all the results have been read. However, the manager also has a close(Iterator) method to close opened iterators. This can be used when not all results have been read.
Elmo provides a subset of the JPA implementation for easier integration into existing frameworks. EntityManager is an Enterprise JavaBean persistence interface for relational mapping of Entity Objects. Elmo ships supporting a subset of this interface. This interface provides a standard way for applications to interact with the Bean pool. Because entities are dependent on the repository connection they can only be used within a transaction.
To use Elmo through JPA, use the provider org.openrdf.elmo.sesame.SesamePersistenceProvider with the property repositoryId, one of dataDir or applicationId, with optional property resources, which are described below.
the Sesame data directory, stores multiple repository configurations and persistence data.
when no dataDir is provided use this unique id to identify a system specific dataDir location.
the remote Sesame server URL, an alternative to dataDir and applicationId.
the repository configuration id stored in the dataDir or serverUrl, if none exists a persisting MemoryStore repository configuration will be created with this id.
load RDF datasets from resource files - file can either be a supported RDF file or a property file listing RDF resources to load, optionally assigned to a context.
See the FOAF example for how to setup Elmo's JPA implementation in Spring.
Elmo does not support detached entities (unlike other JPA implementations). Therefore entities can only be used within a JPA transaction. Elmo supports foreign entities being merged into the pool if they implement an registered interface, however, they are only copied and cannot be attached to the session. In Elmo the merge and persist method do the same thing. Once an entity has been persisted any further changes to it will not be reflected in the repository.
Elmo includes a set of configuration and classes that can be used to allow HiveMind to manage the ElmoManager as a singleton service. It also includes some configuration points that can be used to provide additional configuration inside a hivemind.xml file.
See the GEDCOM example for how to setup Tapestry and Elmo.