de.deepamehta.storage.neo4j
Class Neo4jStorage

Show UML class diagram
java.lang.Object
  extended by de.deepamehta.storage.neo4j.Neo4jStorage
All Implemented Interfaces:
DeepaMehtaStorage

public class Neo4jStorage
extends Object
implements DeepaMehtaStorage


Field Summary
private  org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> assocContentExact
           
private  org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> assocContentFulltext
           
private  org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> assocMetadata
           
private static String KEY_ASSOC_ID
           
private static String KEY_ASSOC_TPYE_URI
           
private static String KEY_FULLTEXT
           
private static String KEY_NODE_TYPE
           
private static String KEY_PLAYER_ID
           
private static String KEY_PLAYER_TPYE
           
private static String KEY_PLAYER_TYPE_URI
           
private static String KEY_ROLE_TPYE_URI
           
private static String KEY_TPYE_URI
           
private static String KEY_URI
           
private static String KEY_VALUE
           
private  Logger logger
           
(package private)  org.neo4j.graphdb.GraphDatabaseService neo4j
           
private  RelationtypeCache relTypeCache
           
private  org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> topicContentExact
           
private  org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> topicContentFulltext
           
 
Constructor Summary
Neo4jStorage(String databasePath)
           
 
Method Summary
private  void addRole(org.apache.lucene.search.BooleanQuery query, int pos, String roleTypeUri, NodeType playerType, long playerId, String playerTypeUri)
           
private  void addTermQuery(String key, long value, org.apache.lucene.search.BooleanQuery query)
           
private  void addTermQuery(String key, NodeType nodeType, org.apache.lucene.search.BooleanQuery query)
           
private  void addTermQuery(String key, String value, org.apache.lucene.search.BooleanQuery query)
           
 DeepaMehtaTransaction beginTx()
           
(package private)  AssociationModel buildAssociation(org.neo4j.graphdb.Node assocNode)
           
private  org.apache.lucene.search.Query buildAssociationQuery(String assocTypeUri, String roleTypeUri1, NodeType playerType1, long playerId1, String playerTypeUri1, String roleTypeUri2, NodeType playerType2, long playerId2, String playerTypeUri2)
           
private  List<AssociationModel> buildAssociations(Iterable<org.neo4j.graphdb.Node> assocNodes)
           
private  org.neo4j.index.lucene.QueryContext buildNumericRangeQuery(String propUri, Number from, Number to)
           
private  List<RelatedAssociationModel> buildRelatedAssociations(List<AssociationModel> assocs, long playerId)
           
private  List<RelatedTopicModel> buildRelatedTopics(List<AssociationModel> assocs, long playerId)
           
private  List<RoleModel> buildRoleModels(org.neo4j.graphdb.Node assocNode)
           
(package private)  TopicModel buildTopic(org.neo4j.graphdb.Node topicNode)
           
private  List<TopicModel> buildTopics(Iterable<org.neo4j.graphdb.Node> topicNodes)
           
private  org.neo4j.graphdb.Node checkType(org.neo4j.graphdb.Node node, NodeType type)
           
private  void checkUriUniqueness(String uri)
          Checks if a topic with the given URI exists in the database, and if so, throws an exception.
private  org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> createExactIndex(String name)
           
private  org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> createFulltextIndex(String name)
           
 void deleteAssociation(long assocId)
           
 void deleteAssociationProperty(long assocId, String propUri)
           
 void deleteTopic(long topicId)
           
 void deleteTopicProperty(long topicId, String propUri)
           
 Iterator<AssociationModel> fetchAllAssociations()
           
 Iterator<TopicModel> fetchAllTopics()
           
 AssociationModel fetchAssociation(long assocId)
           
 List<AssociationModel> fetchAssociationAssociations(long assocId)
           
private  org.neo4j.graphdb.Node fetchAssociationNode(long assocId)
           
 Object fetchAssociationProperty(long assocId, String propUri)
           
 List<RelatedAssociationModel> fetchAssociationRelatedAssociations(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
           
 List<RelatedTopicModel> fetchAssociationRelatedTopics(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)
           
private  List<AssociationModel> fetchAssociations(org.neo4j.graphdb.Node node)
           
 List<AssociationModel> fetchAssociations(String assocTypeUri, long topicId1, long topicId2, String roleTypeUri1, String roleTypeUri2)
           
 List<AssociationModel> fetchAssociationsBetweenTopicAndAssociation(String assocTypeUri, long topicId, long assocId, String topicRoleTypeUri, String assocRoleTypeUri)
           
 List<AssociationModel> fetchAssociationsByProperty(String propUri, Object propValue)
           
 List<AssociationModel> fetchAssociationsByPropertyRange(String propUri, Number from, Number to)
           
private  org.neo4j.graphdb.Node fetchNode(long id)
           
private  org.neo4j.graphdb.Node fetchPlayerNode(RoleModel roleModel)
           
 List<RelatedAssociationModel> fetchRelatedAssociations(long id, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
           
 List<RelatedTopicModel> fetchRelatedTopics(long id, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)
           
private  org.neo4j.graphdb.Relationship fetchRelationship(org.neo4j.graphdb.Node assocNode, long playerId)
           
private  List<org.neo4j.graphdb.Relationship> fetchRelationships(org.neo4j.graphdb.Node assocNode)
           
 TopicModel fetchTopic(long topicId)
           
 TopicModel fetchTopic(String key, Object value)
           
 List<AssociationModel> fetchTopicAssociations(long topicId)
           
private  org.neo4j.graphdb.Node fetchTopicNode(long topicId)
           
private  org.neo4j.graphdb.Node fetchTopicNodeByUri(String uri)
           
private  org.neo4j.graphdb.Node fetchTopicPlayerNode(TopicRoleModel roleModel)
           
 Object fetchTopicProperty(long topicId, String propUri)
           
 List<RelatedAssociationModel> fetchTopicRelatedAssociations(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
           
 List<RelatedTopicModel> fetchTopicRelatedTopics(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)
           
 List<TopicModel> fetchTopics(String key, Object value)
           
 List<TopicModel> fetchTopicsByProperty(String propUri, Object propValue)
           
 List<TopicModel> fetchTopicsByPropertyRange(String propUri, Number from, Number to)
           
private  Object getIndexValue(SimpleValue value, SimpleValue indexValue)
           
private  org.neo4j.graphdb.RelationshipType getRelationshipType(String typeName)
           
 boolean hasAssociationProperty(long assocId, String propUri)
           
 boolean hasTopicProperty(long topicId, String propUri)
           
private  void indexAssociation(org.neo4j.graphdb.Node assocNode, String roleTypeUri1, org.neo4j.graphdb.Node playerNode1, String roleTypeUri2, org.neo4j.graphdb.Node playerNode2)
           
private  void indexAssociationId(org.neo4j.graphdb.Node assocNode)
           
private  void indexAssociationRole(org.neo4j.graphdb.Node assocNode, int pos, String roleTypeUri, org.neo4j.graphdb.Node playerNode)
           
private  void indexAssociationRoleType(org.neo4j.graphdb.Node assocNode, long playerId, String roleTypeUri)
           
private  void indexAssociationType(org.neo4j.graphdb.Node assocNode, String assocTypeUri)
           
private  void indexNodeValue(org.neo4j.graphdb.Node node, Object value, List<IndexMode> indexModes, String indexKey, org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> exactIndex, org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> fulltextIndex)
           
private  boolean isPlayerAtPosition(int pos, long assocId, long playerId)
           
private  org.neo4j.graphdb.index.IndexHits<org.neo4j.graphdb.Node> lookupAssociations(int pos, org.neo4j.graphdb.Node playerNode)
           
private  int lookupPlayerPosition(long assocId, long playerId)
           
private  List<AssociationModel> queryAssociationIndex(String assocTypeUri, String roleTypeUri1, NodeType playerType1, long playerId1, String playerTypeUri1, String roleTypeUri2, NodeType playerType2, long playerId2, String playerTypeUri2)
           
private  org.neo4j.graphdb.index.IndexHits<org.neo4j.graphdb.Node> queryIndexByProperty(org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> index, String propUri, Object propValue)
           
private  org.neo4j.graphdb.index.IndexHits<org.neo4j.graphdb.Node> queryIndexByPropertyRange(org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> index, String propUri, Number from, Number to)
           
 List<TopicModel> queryTopics(Object value)
           
 List<TopicModel> queryTopics(String key, Object value)
           
private  void reindexTypeUri(int pos, org.neo4j.graphdb.Node playerNode, String typeUri)
          Re-indexes the KEY_PLAYER_TYPE_URI of all associations in which the specified node is a player at the specified position.
private  void reindexTypeUri(org.neo4j.graphdb.Node playerNode, String typeUri)
           
private  void reindexValue(org.neo4j.graphdb.Node assocNode, String key, int pos, String value)
           
private  void reindexValue(org.neo4j.graphdb.Node assocNode, String key, String value)
           
private  void removeAssociationFromIndex(org.neo4j.graphdb.Node assocNode)
           
private  void removeAssociationPropertyFromIndex(org.neo4j.graphdb.Node assocNode, String propUri)
           
private  void removeTopicFromIndex(org.neo4j.graphdb.Node topicNode)
           
private  void removeTopicPropertyFromIndex(org.neo4j.graphdb.Node topicNode, String propUri)
           
 boolean setupRootNode()
           
 void shutdown()
           
private  SimpleValue simpleValue(org.neo4j.graphdb.Node node)
           
private  void storeAndIndexAssociationTypeUri(org.neo4j.graphdb.Node assocNode, String assocTypeUri)
           
private  void storeAndIndexAssociationUri(org.neo4j.graphdb.Node assocNode, String uri)
           
private  void storeAndIndexAssociationValue(org.neo4j.graphdb.Node assocNode, Object value, List<IndexMode> indexModes, String indexKey, Object indexValue)
           
private  void storeAndIndexExactValue(org.neo4j.graphdb.Node node, String key, Object value, org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> exactIndex)
          Stores a node value under the specified key and adds the value to the specified index (under the same key).
private  void storeAndIndexTopicTypeUri(org.neo4j.graphdb.Node topicNode, String topicTypeUri)
           
private  void storeAndIndexTopicUri(org.neo4j.graphdb.Node topicNode, String uri)
           
private  void storeAndIndexTopicValue(org.neo4j.graphdb.Node topicNode, Object value, List<IndexMode> indexModes, String indexKey, Object indexValue)
           
 void storeAssociation(AssociationModel assocModel)
           
 void storeAssociationProperty(long assocId, String propUri, Object propValue, boolean addToIndex)
           
 void storeAssociationTypeUri(long assocId, String assocTypeUri)
           
 void storeAssociationUri(long assocId, String uri)
           
 void storeAssociationValue(long assocId, SimpleValue value, List<IndexMode> indexModes, String indexKey, SimpleValue indexValue)
           
private  org.neo4j.graphdb.Node storePlayerRelationship(org.neo4j.graphdb.Node assocNode, RoleModel roleModel)
           
 void storeRoleTypeUri(long assocId, long playerId, String roleTypeUri)
           
 void storeTopic(TopicModel topicModel)
           
 void storeTopicProperty(long topicId, String propUri, Object propValue, boolean addToIndex)
           
 void storeTopicTypeUri(long topicId, String topicTypeUri)
           
 void storeTopicUri(long topicId, String uri)
           
 void storeTopicValue(long topicId, SimpleValue value, List<IndexMode> indexModes, String indexKey, SimpleValue indexValue)
           
private  String typeUri(org.neo4j.graphdb.Node node)
           
private  String uri(org.neo4j.graphdb.Node node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_NODE_TYPE

private static final String KEY_NODE_TYPE
See Also:
Constant Field Values

KEY_VALUE

private static final String KEY_VALUE
See Also:
Constant Field Values

KEY_URI

private static final String KEY_URI
See Also:
Constant Field Values

KEY_TPYE_URI

private static final String KEY_TPYE_URI
See Also:
Constant Field Values

KEY_FULLTEXT

private static final String KEY_FULLTEXT
See Also:
Constant Field Values

KEY_ASSOC_ID

private static final String KEY_ASSOC_ID
See Also:
Constant Field Values

KEY_ASSOC_TPYE_URI

private static final String KEY_ASSOC_TPYE_URI
See Also:
Constant Field Values

KEY_ROLE_TPYE_URI

private static final String KEY_ROLE_TPYE_URI
See Also:
Constant Field Values

KEY_PLAYER_TPYE

private static final String KEY_PLAYER_TPYE
See Also:
Constant Field Values

KEY_PLAYER_ID

private static final String KEY_PLAYER_ID
See Also:
Constant Field Values

KEY_PLAYER_TYPE_URI

private static final String KEY_PLAYER_TYPE_URI
See Also:
Constant Field Values

neo4j

org.neo4j.graphdb.GraphDatabaseService neo4j

relTypeCache

private RelationtypeCache relTypeCache

topicContentExact

private org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> topicContentExact

topicContentFulltext

private org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> topicContentFulltext

assocContentExact

private org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> assocContentExact

assocContentFulltext

private org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> assocContentFulltext

assocMetadata

private org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> assocMetadata

logger

private final Logger logger
Constructor Detail

Neo4jStorage

Neo4jStorage(String databasePath)
Method Detail

fetchTopic

public TopicModel fetchTopic(long topicId)
Specified by:
fetchTopic in interface DeepaMehtaStorage

fetchTopic

public TopicModel fetchTopic(String key,
                             Object value)
Specified by:
fetchTopic in interface DeepaMehtaStorage

fetchTopics

public List<TopicModel> fetchTopics(String key,
                                    Object value)
Specified by:
fetchTopics in interface DeepaMehtaStorage

queryTopics

public List<TopicModel> queryTopics(Object value)
Specified by:
queryTopics in interface DeepaMehtaStorage

queryTopics

public List<TopicModel> queryTopics(String key,
                                    Object value)
Specified by:
queryTopics in interface DeepaMehtaStorage

fetchAllTopics

public Iterator<TopicModel> fetchAllTopics()
Specified by:
fetchAllTopics in interface DeepaMehtaStorage

storeTopic

public void storeTopic(TopicModel topicModel)
Specified by:
storeTopic in interface DeepaMehtaStorage

storeTopicUri

public void storeTopicUri(long topicId,
                          String uri)
Specified by:
storeTopicUri in interface DeepaMehtaStorage

storeTopicTypeUri

public void storeTopicTypeUri(long topicId,
                              String topicTypeUri)
Specified by:
storeTopicTypeUri in interface DeepaMehtaStorage

storeTopicValue

public void storeTopicValue(long topicId,
                            SimpleValue value,
                            List<IndexMode> indexModes,
                            String indexKey,
                            SimpleValue indexValue)
Specified by:
storeTopicValue in interface DeepaMehtaStorage
indexValue - Optional: the value to be indexed. If indexValue is not specified, value is used.

deleteTopic

public void deleteTopic(long topicId)
Specified by:
deleteTopic in interface DeepaMehtaStorage

fetchAssociation

public AssociationModel fetchAssociation(long assocId)
Specified by:
fetchAssociation in interface DeepaMehtaStorage

fetchAssociations

public List<AssociationModel> fetchAssociations(String assocTypeUri,
                                                long topicId1,
                                                long topicId2,
                                                String roleTypeUri1,
                                                String roleTypeUri2)
Specified by:
fetchAssociations in interface DeepaMehtaStorage

fetchAssociationsBetweenTopicAndAssociation

public List<AssociationModel> fetchAssociationsBetweenTopicAndAssociation(String assocTypeUri,
                                                                          long topicId,
                                                                          long assocId,
                                                                          String topicRoleTypeUri,
                                                                          String assocRoleTypeUri)
Specified by:
fetchAssociationsBetweenTopicAndAssociation in interface DeepaMehtaStorage

fetchAllAssociations

public Iterator<AssociationModel> fetchAllAssociations()
Specified by:
fetchAllAssociations in interface DeepaMehtaStorage

storeAssociation

public void storeAssociation(AssociationModel assocModel)
Specified by:
storeAssociation in interface DeepaMehtaStorage

storeAssociationUri

public void storeAssociationUri(long assocId,
                                String uri)
Specified by:
storeAssociationUri in interface DeepaMehtaStorage

storeAssociationTypeUri

public void storeAssociationTypeUri(long assocId,
                                    String assocTypeUri)
Specified by:
storeAssociationTypeUri in interface DeepaMehtaStorage

storeAssociationValue

public void storeAssociationValue(long assocId,
                                  SimpleValue value,
                                  List<IndexMode> indexModes,
                                  String indexKey,
                                  SimpleValue indexValue)
Specified by:
storeAssociationValue in interface DeepaMehtaStorage
indexValue - Optional: the value to be indexed. If indexValue is not specified, value is used.

storeRoleTypeUri

public void storeRoleTypeUri(long assocId,
                             long playerId,
                             String roleTypeUri)
Specified by:
storeRoleTypeUri in interface DeepaMehtaStorage

deleteAssociation

public void deleteAssociation(long assocId)
Specified by:
deleteAssociation in interface DeepaMehtaStorage

fetchTopicAssociations

public List<AssociationModel> fetchTopicAssociations(long topicId)
Specified by:
fetchTopicAssociations in interface DeepaMehtaStorage

fetchAssociationAssociations

public List<AssociationModel> fetchAssociationAssociations(long assocId)
Specified by:
fetchAssociationAssociations in interface DeepaMehtaStorage

fetchTopicRelatedTopics

public List<RelatedTopicModel> fetchTopicRelatedTopics(long topicId,
                                                       String assocTypeUri,
                                                       String myRoleTypeUri,
                                                       String othersRoleTypeUri,
                                                       String othersTopicTypeUri)
Specified by:
fetchTopicRelatedTopics in interface DeepaMehtaStorage
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null
othersTopicTypeUri - may be null

fetchTopicRelatedAssociations

public List<RelatedAssociationModel> fetchTopicRelatedAssociations(long topicId,
                                                                   String assocTypeUri,
                                                                   String myRoleTypeUri,
                                                                   String othersRoleTypeUri,
                                                                   String othersAssocTypeUri)
Specified by:
fetchTopicRelatedAssociations in interface DeepaMehtaStorage
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null

fetchAssociationRelatedTopics

public List<RelatedTopicModel> fetchAssociationRelatedTopics(long assocId,
                                                             String assocTypeUri,
                                                             String myRoleTypeUri,
                                                             String othersRoleTypeUri,
                                                             String othersTopicTypeUri)
Specified by:
fetchAssociationRelatedTopics in interface DeepaMehtaStorage
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null
othersTopicTypeUri - may be null

fetchAssociationRelatedAssociations

public List<RelatedAssociationModel> fetchAssociationRelatedAssociations(long assocId,
                                                                         String assocTypeUri,
                                                                         String myRoleTypeUri,
                                                                         String othersRoleTypeUri,
                                                                         String othersAssocTypeUri)
Specified by:
fetchAssociationRelatedAssociations in interface DeepaMehtaStorage
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null

fetchRelatedTopics

public List<RelatedTopicModel> fetchRelatedTopics(long id,
                                                  String assocTypeUri,
                                                  String myRoleTypeUri,
                                                  String othersRoleTypeUri,
                                                  String othersTopicTypeUri)
Specified by:
fetchRelatedTopics in interface DeepaMehtaStorage
Parameters:
id - id of a topic or an association
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null
othersTopicTypeUri - may be null

fetchRelatedAssociations

public List<RelatedAssociationModel> fetchRelatedAssociations(long id,
                                                              String assocTypeUri,
                                                              String myRoleTypeUri,
                                                              String othersRoleTypeUri,
                                                              String othersAssocTypeUri)
Specified by:
fetchRelatedAssociations in interface DeepaMehtaStorage
Parameters:
id - id of a topic or an association
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null

fetchTopicProperty

public Object fetchTopicProperty(long topicId,
                                 String propUri)
Specified by:
fetchTopicProperty in interface DeepaMehtaStorage

fetchAssociationProperty

public Object fetchAssociationProperty(long assocId,
                                       String propUri)
Specified by:
fetchAssociationProperty in interface DeepaMehtaStorage

fetchTopicsByProperty

public List<TopicModel> fetchTopicsByProperty(String propUri,
                                              Object propValue)
Specified by:
fetchTopicsByProperty in interface DeepaMehtaStorage

fetchTopicsByPropertyRange

public List<TopicModel> fetchTopicsByPropertyRange(String propUri,
                                                   Number from,
                                                   Number to)
Specified by:
fetchTopicsByPropertyRange in interface DeepaMehtaStorage

fetchAssociationsByProperty

public List<AssociationModel> fetchAssociationsByProperty(String propUri,
                                                          Object propValue)
Specified by:
fetchAssociationsByProperty in interface DeepaMehtaStorage

fetchAssociationsByPropertyRange

public List<AssociationModel> fetchAssociationsByPropertyRange(String propUri,
                                                               Number from,
                                                               Number to)
Specified by:
fetchAssociationsByPropertyRange in interface DeepaMehtaStorage

storeTopicProperty

public void storeTopicProperty(long topicId,
                               String propUri,
                               Object propValue,
                               boolean addToIndex)
Specified by:
storeTopicProperty in interface DeepaMehtaStorage

storeAssociationProperty

public void storeAssociationProperty(long assocId,
                                     String propUri,
                                     Object propValue,
                                     boolean addToIndex)
Specified by:
storeAssociationProperty in interface DeepaMehtaStorage

hasTopicProperty

public boolean hasTopicProperty(long topicId,
                                String propUri)
Specified by:
hasTopicProperty in interface DeepaMehtaStorage

hasAssociationProperty

public boolean hasAssociationProperty(long assocId,
                                      String propUri)
Specified by:
hasAssociationProperty in interface DeepaMehtaStorage

deleteTopicProperty

public void deleteTopicProperty(long topicId,
                                String propUri)
Specified by:
deleteTopicProperty in interface DeepaMehtaStorage

deleteAssociationProperty

public void deleteAssociationProperty(long assocId,
                                      String propUri)
Specified by:
deleteAssociationProperty in interface DeepaMehtaStorage

beginTx

public DeepaMehtaTransaction beginTx()
Specified by:
beginTx in interface DeepaMehtaStorage

setupRootNode

public boolean setupRootNode()
Specified by:
setupRootNode in interface DeepaMehtaStorage

shutdown

public void shutdown()
Specified by:
shutdown in interface DeepaMehtaStorage

storeAndIndexTopicUri

private void storeAndIndexTopicUri(org.neo4j.graphdb.Node topicNode,
                                   String uri)

storeAndIndexAssociationUri

private void storeAndIndexAssociationUri(org.neo4j.graphdb.Node assocNode,
                                         String uri)

storeAndIndexTopicTypeUri

private void storeAndIndexTopicTypeUri(org.neo4j.graphdb.Node topicNode,
                                       String topicTypeUri)

storeAndIndexAssociationTypeUri

private void storeAndIndexAssociationTypeUri(org.neo4j.graphdb.Node assocNode,
                                             String assocTypeUri)

storeAndIndexExactValue

private void storeAndIndexExactValue(org.neo4j.graphdb.Node node,
                                     String key,
                                     Object value,
                                     org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> exactIndex)
Stores a node value under the specified key and adds the value to the specified index (under the same key). IndexMode.KEY is used for indexing.

Used for URIs, type URIs, and properties.

Parameters:
node - a topic node, or an association node.
exactIndex - the index to add the value to. If null no indexing is performed.

storeAndIndexTopicValue

private void storeAndIndexTopicValue(org.neo4j.graphdb.Node topicNode,
                                     Object value,
                                     List<IndexMode> indexModes,
                                     String indexKey,
                                     Object indexValue)

storeAndIndexAssociationValue

private void storeAndIndexAssociationValue(org.neo4j.graphdb.Node assocNode,
                                           Object value,
                                           List<IndexMode> indexModes,
                                           String indexKey,
                                           Object indexValue)

getIndexValue

private Object getIndexValue(SimpleValue value,
                             SimpleValue indexValue)

indexNodeValue

private void indexNodeValue(org.neo4j.graphdb.Node node,
                            Object value,
                            List<IndexMode> indexModes,
                            String indexKey,
                            org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> exactIndex,
                            org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> fulltextIndex)

indexAssociation

private void indexAssociation(org.neo4j.graphdb.Node assocNode,
                              String roleTypeUri1,
                              org.neo4j.graphdb.Node playerNode1,
                              String roleTypeUri2,
                              org.neo4j.graphdb.Node playerNode2)

indexAssociationId

private void indexAssociationId(org.neo4j.graphdb.Node assocNode)

indexAssociationType

private void indexAssociationType(org.neo4j.graphdb.Node assocNode,
                                  String assocTypeUri)

indexAssociationRole

private void indexAssociationRole(org.neo4j.graphdb.Node assocNode,
                                  int pos,
                                  String roleTypeUri,
                                  org.neo4j.graphdb.Node playerNode)

indexAssociationRoleType

private void indexAssociationRoleType(org.neo4j.graphdb.Node assocNode,
                                      long playerId,
                                      String roleTypeUri)

lookupPlayerPosition

private int lookupPlayerPosition(long assocId,
                                 long playerId)

isPlayerAtPosition

private boolean isPlayerAtPosition(int pos,
                                   long assocId,
                                   long playerId)

reindexTypeUri

private void reindexTypeUri(org.neo4j.graphdb.Node playerNode,
                            String typeUri)

reindexTypeUri

private void reindexTypeUri(int pos,
                            org.neo4j.graphdb.Node playerNode,
                            String typeUri)
Re-indexes the KEY_PLAYER_TYPE_URI of all associations in which the specified node is a player at the specified position.

Parameters:
playerNode - a topic node or an association node.
typeUri - the new type URI to be indexed for the player node.

lookupAssociations

private org.neo4j.graphdb.index.IndexHits<org.neo4j.graphdb.Node> lookupAssociations(int pos,
                                                                                     org.neo4j.graphdb.Node playerNode)

reindexValue

private void reindexValue(org.neo4j.graphdb.Node assocNode,
                          String key,
                          int pos,
                          String value)

reindexValue

private void reindexValue(org.neo4j.graphdb.Node assocNode,
                          String key,
                          String value)

queryIndexByProperty

private org.neo4j.graphdb.index.IndexHits<org.neo4j.graphdb.Node> queryIndexByProperty(org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> index,
                                                                                       String propUri,
                                                                                       Object propValue)

queryIndexByPropertyRange

private org.neo4j.graphdb.index.IndexHits<org.neo4j.graphdb.Node> queryIndexByPropertyRange(org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> index,
                                                                                            String propUri,
                                                                                            Number from,
                                                                                            Number to)

queryAssociationIndex

private List<AssociationModel> queryAssociationIndex(String assocTypeUri,
                                                     String roleTypeUri1,
                                                     NodeType playerType1,
                                                     long playerId1,
                                                     String playerTypeUri1,
                                                     String roleTypeUri2,
                                                     NodeType playerType2,
                                                     long playerId2,
                                                     String playerTypeUri2)

buildNumericRangeQuery

private org.neo4j.index.lucene.QueryContext buildNumericRangeQuery(String propUri,
                                                                   Number from,
                                                                   Number to)

buildAssociationQuery

private org.apache.lucene.search.Query buildAssociationQuery(String assocTypeUri,
                                                             String roleTypeUri1,
                                                             NodeType playerType1,
                                                             long playerId1,
                                                             String playerTypeUri1,
                                                             String roleTypeUri2,
                                                             NodeType playerType2,
                                                             long playerId2,
                                                             String playerTypeUri2)

addRole

private void addRole(org.apache.lucene.search.BooleanQuery query,
                     int pos,
                     String roleTypeUri,
                     NodeType playerType,
                     long playerId,
                     String playerTypeUri)

addTermQuery

private void addTermQuery(String key,
                          long value,
                          org.apache.lucene.search.BooleanQuery query)

addTermQuery

private void addTermQuery(String key,
                          NodeType nodeType,
                          org.apache.lucene.search.BooleanQuery query)

addTermQuery

private void addTermQuery(String key,
                          String value,
                          org.apache.lucene.search.BooleanQuery query)

removeTopicFromIndex

private void removeTopicFromIndex(org.neo4j.graphdb.Node topicNode)

removeAssociationFromIndex

private void removeAssociationFromIndex(org.neo4j.graphdb.Node assocNode)

removeTopicPropertyFromIndex

private void removeTopicPropertyFromIndex(org.neo4j.graphdb.Node topicNode,
                                          String propUri)

removeAssociationPropertyFromIndex

private void removeAssociationPropertyFromIndex(org.neo4j.graphdb.Node assocNode,
                                                String propUri)

createExactIndex

private org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> createExactIndex(String name)

createFulltextIndex

private org.neo4j.graphdb.index.Index<org.neo4j.graphdb.Node> createFulltextIndex(String name)

buildTopic

TopicModel buildTopic(org.neo4j.graphdb.Node topicNode)

buildTopics

private List<TopicModel> buildTopics(Iterable<org.neo4j.graphdb.Node> topicNodes)

buildAssociation

AssociationModel buildAssociation(org.neo4j.graphdb.Node assocNode)

buildAssociations

private List<AssociationModel> buildAssociations(Iterable<org.neo4j.graphdb.Node> assocNodes)

buildRoleModels

private List<RoleModel> buildRoleModels(org.neo4j.graphdb.Node assocNode)

storePlayerRelationship

private org.neo4j.graphdb.Node storePlayerRelationship(org.neo4j.graphdb.Node assocNode,
                                                       RoleModel roleModel)

fetchPlayerNode

private org.neo4j.graphdb.Node fetchPlayerNode(RoleModel roleModel)

fetchTopicPlayerNode

private org.neo4j.graphdb.Node fetchTopicPlayerNode(TopicRoleModel roleModel)

fetchRelationship

private org.neo4j.graphdb.Relationship fetchRelationship(org.neo4j.graphdb.Node assocNode,
                                                         long playerId)

fetchRelationships

private List<org.neo4j.graphdb.Relationship> fetchRelationships(org.neo4j.graphdb.Node assocNode)

fetchAssociations

private List<AssociationModel> fetchAssociations(org.neo4j.graphdb.Node node)

fetchTopicNode

private org.neo4j.graphdb.Node fetchTopicNode(long topicId)

fetchAssociationNode

private org.neo4j.graphdb.Node fetchAssociationNode(long assocId)

fetchNode

private org.neo4j.graphdb.Node fetchNode(long id)

fetchTopicNodeByUri

private org.neo4j.graphdb.Node fetchTopicNodeByUri(String uri)

checkType

private org.neo4j.graphdb.Node checkType(org.neo4j.graphdb.Node node,
                                         NodeType type)

getRelationshipType

private org.neo4j.graphdb.RelationshipType getRelationshipType(String typeName)

uri

private String uri(org.neo4j.graphdb.Node node)

typeUri

private String typeUri(org.neo4j.graphdb.Node node)

simpleValue

private SimpleValue simpleValue(org.neo4j.graphdb.Node node)

buildRelatedTopics

private List<RelatedTopicModel> buildRelatedTopics(List<AssociationModel> assocs,
                                                   long playerId)

buildRelatedAssociations

private List<RelatedAssociationModel> buildRelatedAssociations(List<AssociationModel> assocs,
                                                               long playerId)

checkUriUniqueness

private void checkUriUniqueness(String uri)
Checks if a topic with the given URI exists in the database, and if so, throws an exception. If an empty string is given no check is performed. ### FIXDOC

Parameters:
uri - The URI to check. Must not be null.


Copyright © 2013. All Rights Reserved.