InteractionLoader
From SONIVIS:Wiki
The InteractionLoader loads Actor networks. In these, the Nodes represent Actors, i.e. authors, collaborators, etc., and the Edges a defined relationship between two distinct Actors.
Contents |
Implementation
The InteractionLoader class is located in the core in the sub-package networkloader. Its central method of action is
protected Graph loadNetwork(ENetworkType, InfoSpace)
Loading interaction relations
After some set up issues, the loader calls
private List<IInteractionRelation<IActor, IActor, IContentElement, IContentElement>> loadInteractions(InfoSpace)
to get a hold of the InteractionRelation entities of the specified InfoSpace. Note, that being able to load any InteractionRelation entities these have, of course, to be present in the persistence store. This might require to transform extracted data before. For example, an extract from the MediaWiki API Connector requires to run the CollaborationTransformer before any InteractionRelation entities are kept in the persistence store.
The loading of the entities is actually straight forward and is limited to a call to
InteractionRelationDAO.findByType(InfoSpace, Set<Class<? extends InteractionRelation>>, IInteractionRelationDAO.INIT_ACTORS)
The types to be specified are taken from the ENetworkType provided with the call to loadNetwork() (see above). The constant IInteractionRelationDAO.INIT_ACTORS indicates that both Actor instances as part of an InteractionRelation instance should be initialized. Access to properties is required later.
Creating the elements of the graph
The result set is iterated. For each retrieved InteractionRelation item for both the source as well as the target Actor entity a corresponding Node instance is created. But only at first occurrence. All created Node entities are kept in a central map where they are indexed by the corresponding Actor entity. If an Actor instance already has a representing Node instance, a reference to that is taken instead.
The class also keeps a local collection of Edge instances created so far. Since for each InteractionRelation item of the above mentioned result set a corresponding Edge is created between the Node entities representing the involved Actor instances there might be multiple occurrences of the same pair. These will all be represented by the same Edge instance. To keep track of the represented items each Edge object carries a set of serialization identifiers of the InteractionRelation entities it stands for.
Populating the graph
When the result set is completely looped over the created Node and Edge instances are added to the Graph object that is then returned to the caller.
Links
- Data Model
- Data Model in Java
- CollaborationTransformer
- Javadoc for
InteractionLoaderclass

