Package systems.dmx.storage.neo4j
Class Neo4jStorage
- java.lang.Object
-
- systems.dmx.storage.neo4j.Neo4jStorage
-
- All Implemented Interfaces:
DMXStorage
public class Neo4jStorage extends Object implements DMXStorage
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DMXTransactionbeginTx()voiddeleteAssoc(long assocId)voiddeleteAssocProperty(long assocId, String propUri)voiddeleteTopic(long topicId)Deletes the topic.voiddeleteTopicProperty(long topicId, String propUri)Iterable<AssocModelImpl>fetchAllAssocs()Iterable<TopicModelImpl>fetchAllTopics()AssocModelImplfetchAssoc(long assocId)Fetches an assoc by ID.List<AssocModelImpl>fetchAssocAssocs(long assocId)List<RelatedAssocModelImpl>fetchAssocRelatedAssocs(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)<M extends RelatedObjectModel>
List<M>fetchAssocRelatedObjects(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTypeUri)List<RelatedTopicModelImpl>fetchAssocRelatedTopics(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)List<AssocModelImpl>fetchAssocs(String assocTypeUri, long topicId1, long topicId2, String roleTypeUri1, String roleTypeUri2)Returns the associations between two topics.List<AssocModelImpl>fetchAssocs(String key, Object value)Fetches assocs by exact value.List<AssocModelImpl>fetchAssocsBetweenTopicAndAssoc(String assocTypeUri, long topicId, long assocId, String topicRoleTypeUri, String assocRoleTypeUri)List<AssocModelImpl>fetchAssocsByProperty(String propUri, Object propValue)List<AssocModelImpl>fetchAssocsByPropertyRange(String propUri, Number from, Number to)DMXObjectModelImplfetchObject(long id)List<PlayerModel>fetchPlayerModels(long assocId)ObjectfetchProperty(long id, String propUri)List<RelatedAssocModelImpl>fetchRelatedAssocs(long id, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)List<RelatedTopicModelImpl>fetchRelatedTopics(long id, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)TopicModelImplfetchTopic(long topicId)Fetches a topic by ID.List<AssocModelImpl>fetchTopicAssocs(long topicId)List<RelatedAssocModelImpl>fetchTopicRelatedAssocs(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)<M extends RelatedObjectModel>
List<M>fetchTopicRelatedObjects(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTypeUri)List<RelatedTopicModelImpl>fetchTopicRelatedTopics(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)List<TopicModelImpl>fetchTopics(String key, Object value)Fetches topics by exact value.List<TopicModelImpl>fetchTopicsByProperty(String propUri, Object propValue)List<TopicModelImpl>fetchTopicsByPropertyRange(String propUri, Number from, Number to)ObjectgetDatabaseVendorObject()ObjectgetDatabaseVendorObject(long objectId)ModelFactoryImplgetModelFactory()booleanhasProperty(long id, String propUri)voidindexAssocProperty(long assocId, String propUri, Object propValue)voidindexTopicFulltext(long topicId, String text, String indexKey)voidindexTopicProperty(long topicId, String propUri, Object propValue)List<AssocModelImpl>queryAssocs(String key, Object value)List<AssocModelImpl>queryAssocsByRoleType(String roleTypeUri)List<AssocModelImpl>queryAssocsFulltext(String key, Object value)List<TopicModelImpl>queryTopics(String key, Object value)List<TopicModelImpl>queryTopicsFulltext(String key, Object value)booleansetupRootNode()voidshutdown()voidstoreAssoc(AssocModelImpl assocModel)voidstoreAssocProperty(long assocId, String propUri, Object propValue, boolean addToIndex)voidstoreAssocTypeUri(long assocId, String assocTypeUri)voidstoreAssocUri(long assocId, String uri)Stores and indexes the association's URI.voidstoreAssocValue(long assocId, SimpleValue value, String indexKey, boolean isHtmlValue)Stores and indexes an association value.voidstoreRoleTypeUri(long assocId, long playerId, String roleTypeUri)voidstoreTopic(TopicModelImpl topicModel)Stores a rudimentary topic in the DB.voidstoreTopicProperty(long topicId, String propUri, Object propValue, boolean addToIndex)voidstoreTopicTypeUri(long topicId, String topicTypeUri)voidstoreTopicUri(long topicId, String uri)Stores and indexes the topic's URI.voidstoreTopicValue(long topicId, SimpleValue value, String indexKey, boolean isHtmlValue)Stores and indexes a topic value.
-
-
-
Method Detail
-
fetchTopic
public TopicModelImpl fetchTopic(long topicId)
Description copied from interface:DMXStorageFetches a topic by ID.- Specified by:
fetchTopicin interfaceDMXStorage- Returns:
- The fetched topic.
-
fetchTopics
public List<TopicModelImpl> fetchTopics(String key, Object value)
Description copied from interface:DMXStorageFetches topics by exact value.- Specified by:
fetchTopicsin interfaceDMXStorage
-
queryTopics
public List<TopicModelImpl> queryTopics(String key, Object value)
- Specified by:
queryTopicsin interfaceDMXStorage
-
queryTopicsFulltext
public List<TopicModelImpl> queryTopicsFulltext(String key, Object value)
- Specified by:
queryTopicsFulltextin interfaceDMXStorage- Returns:
- The fetched topics.
-
fetchAllTopics
public Iterable<TopicModelImpl> fetchAllTopics()
- Specified by:
fetchAllTopicsin interfaceDMXStorage
-
storeTopic
public void storeTopic(TopicModelImpl topicModel)
Description copied from interface:DMXStorageStores a rudimentary topic in the DB.Only the topic URI and the topic type URI are stored. The topic value (simple or composite) is not stored. The "Instantiation" association is not stored.
An URI uniqueness check is performed. If the DB already contains a topic or an association with the URI passed, an exception is thrown and nothing is stored.
- Specified by:
storeTopicin interfaceDMXStorage- Parameters:
topicModel- The topic to store. Once the method returns the topic model contains: - the ID of the stored topic. - an empty URI ("") in casenullwas passed. - an empty simple value ("") in casenullwas passed.
-
storeTopicUri
public void storeTopicUri(long topicId, String uri)Description copied from interface:DMXStorageStores and indexes the topic's URI.- Specified by:
storeTopicUriin interfaceDMXStorage
-
storeTopicTypeUri
public void storeTopicTypeUri(long topicId, String topicTypeUri)- Specified by:
storeTopicTypeUriin interfaceDMXStorage
-
storeTopicValue
public void storeTopicValue(long topicId, SimpleValue value, String indexKey, boolean isHtmlValue)Description copied from interface:DMXStorageStores and indexes a topic value.- Specified by:
storeTopicValuein interfaceDMXStorageindexKey- must not null
-
indexTopicFulltext
public void indexTopicFulltext(long topicId, String text, String indexKey)- Specified by:
indexTopicFulltextin interfaceDMXStorage
-
deleteTopic
public void deleteTopic(long topicId)
Description copied from interface:DMXStorageDeletes the topic.Prerequisite: the topic has no relations.
- Specified by:
deleteTopicin interfaceDMXStorage
-
fetchAssoc
public AssocModelImpl fetchAssoc(long assocId)
Description copied from interface:DMXStorageFetches an assoc by ID.- Specified by:
fetchAssocin interfaceDMXStorage- Returns:
- The fetched assoc.
-
fetchAssocs
public List<AssocModelImpl> fetchAssocs(String key, Object value)
Description copied from interface:DMXStorageFetches assocs by exact value.- Specified by:
fetchAssocsin interfaceDMXStorage
-
queryAssocs
public List<AssocModelImpl> queryAssocs(String key, Object value)
- Specified by:
queryAssocsin interfaceDMXStorage
-
queryAssocsFulltext
public List<AssocModelImpl> queryAssocsFulltext(String key, Object value)
- Specified by:
queryAssocsFulltextin interfaceDMXStorage- Returns:
- The fetched assocs.
-
queryAssocsByRoleType
public List<AssocModelImpl> queryAssocsByRoleType(String roleTypeUri)
- Specified by:
queryAssocsByRoleTypein interfaceDMXStorage
-
fetchAssocs
public List<AssocModelImpl> fetchAssocs(String assocTypeUri, long topicId1, long topicId2, String roleTypeUri1, String roleTypeUri2)
Description copied from interface:DMXStorageReturns the associations between two topics. If no such association exists an empty set is returned.- Specified by:
fetchAssocsin interfaceDMXStorage- Parameters:
assocTypeUri- Assoc type filter. Passnullto switch filter off.
-
fetchAssocsBetweenTopicAndAssoc
public List<AssocModelImpl> fetchAssocsBetweenTopicAndAssoc(String assocTypeUri, long topicId, long assocId, String topicRoleTypeUri, String assocRoleTypeUri)
- Specified by:
fetchAssocsBetweenTopicAndAssocin interfaceDMXStorage
-
fetchAllAssocs
public Iterable<AssocModelImpl> fetchAllAssocs()
- Specified by:
fetchAllAssocsin interfaceDMXStorage
-
fetchPlayerModels
public List<PlayerModel> fetchPlayerModels(long assocId)
- Specified by:
fetchPlayerModelsin interfaceDMXStorage
-
storeAssoc
public void storeAssoc(AssocModelImpl assocModel)
- Specified by:
storeAssocin interfaceDMXStorage
-
storeAssocUri
public void storeAssocUri(long assocId, String uri)Description copied from interface:DMXStorageStores and indexes the association's URI.- Specified by:
storeAssocUriin interfaceDMXStorage
-
storeAssocTypeUri
public void storeAssocTypeUri(long assocId, String assocTypeUri)- Specified by:
storeAssocTypeUriin interfaceDMXStorage
-
storeAssocValue
public void storeAssocValue(long assocId, SimpleValue value, String indexKey, boolean isHtmlValue)Description copied from interface:DMXStorageStores and indexes an association value.- Specified by:
storeAssocValuein interfaceDMXStorageindexKey- must not null
-
storeRoleTypeUri
public void storeRoleTypeUri(long assocId, long playerId, String roleTypeUri)- Specified by:
storeRoleTypeUriin interfaceDMXStorage
-
deleteAssoc
public void deleteAssoc(long assocId)
- Specified by:
deleteAssocin interfaceDMXStorage
-
fetchObject
public DMXObjectModelImpl fetchObject(long id)
- Specified by:
fetchObjectin interfaceDMXStorage
-
fetchTopicAssocs
public List<AssocModelImpl> fetchTopicAssocs(long topicId)
- Specified by:
fetchTopicAssocsin interfaceDMXStorage
-
fetchAssocAssocs
public List<AssocModelImpl> fetchAssocAssocs(long assocId)
- Specified by:
fetchAssocAssocsin interfaceDMXStorage
-
fetchTopicRelatedTopics
public List<RelatedTopicModelImpl> fetchTopicRelatedTopics(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)
- Specified by:
fetchTopicRelatedTopicsin interfaceDMXStorageassocTypeUri- may be nullmyRoleTypeUri- may be nullothersRoleTypeUri- may be nullothersTopicTypeUri- may be null- Returns:
- The fetched topics.
-
fetchTopicRelatedAssocs
public List<RelatedAssocModelImpl> fetchTopicRelatedAssocs(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
- Specified by:
fetchTopicRelatedAssocsin interfaceDMXStorageassocTypeUri- may be nullmyRoleTypeUri- may be nullothersRoleTypeUri- may be null- Returns:
- The fetched associations.
-
fetchAssocRelatedTopics
public List<RelatedTopicModelImpl> fetchAssocRelatedTopics(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)
- Specified by:
fetchAssocRelatedTopicsin interfaceDMXStorageassocTypeUri- may be nullmyRoleTypeUri- may be nullothersRoleTypeUri- may be nullothersTopicTypeUri- may be null- Returns:
- The fetched topics.
-
fetchAssocRelatedAssocs
public List<RelatedAssocModelImpl> fetchAssocRelatedAssocs(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
- Specified by:
fetchAssocRelatedAssocsin interfaceDMXStorageassocTypeUri- may be nullmyRoleTypeUri- may be nullothersRoleTypeUri- may be null- Returns:
- The fetched associations.
-
fetchTopicRelatedObjects
public <M extends RelatedObjectModel> List<M> fetchTopicRelatedObjects(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTypeUri)
- Specified by:
fetchTopicRelatedObjectsin interfaceDMXStorage
-
fetchAssocRelatedObjects
public <M extends RelatedObjectModel> List<M> fetchAssocRelatedObjects(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTypeUri)
- Specified by:
fetchAssocRelatedObjectsin interfaceDMXStorage
-
fetchRelatedTopics
public List<RelatedTopicModelImpl> fetchRelatedTopics(long id, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)
- Specified by:
fetchRelatedTopicsin interfaceDMXStorage- Parameters:
id- id of a topic or an associationassocTypeUri- may be nullmyRoleTypeUri- may be nullothersRoleTypeUri- may be nullothersTopicTypeUri- may be null- Returns:
- The fetched topics.
-
fetchRelatedAssocs
public List<RelatedAssocModelImpl> fetchRelatedAssocs(long id, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
- Specified by:
fetchRelatedAssocsin interfaceDMXStorage- Parameters:
id- id of a topic or an associationassocTypeUri- may be nullmyRoleTypeUri- may be nullothersRoleTypeUri- may be null- Returns:
- The fetched associations.
-
fetchProperty
public Object fetchProperty(long id, String propUri)
- Specified by:
fetchPropertyin interfaceDMXStorage- Parameters:
id- id of a topic or an association
-
hasProperty
public boolean hasProperty(long id, String propUri)- Specified by:
hasPropertyin interfaceDMXStorage- Parameters:
id- id of a topic or an association
-
fetchTopicsByProperty
public List<TopicModelImpl> fetchTopicsByProperty(String propUri, Object propValue)
- Specified by:
fetchTopicsByPropertyin interfaceDMXStorage
-
fetchTopicsByPropertyRange
public List<TopicModelImpl> fetchTopicsByPropertyRange(String propUri, Number from, Number to)
- Specified by:
fetchTopicsByPropertyRangein interfaceDMXStorage
-
fetchAssocsByProperty
public List<AssocModelImpl> fetchAssocsByProperty(String propUri, Object propValue)
- Specified by:
fetchAssocsByPropertyin interfaceDMXStorage
-
fetchAssocsByPropertyRange
public List<AssocModelImpl> fetchAssocsByPropertyRange(String propUri, Number from, Number to)
- Specified by:
fetchAssocsByPropertyRangein interfaceDMXStorage
-
storeTopicProperty
public void storeTopicProperty(long topicId, String propUri, Object propValue, boolean addToIndex)- Specified by:
storeTopicPropertyin interfaceDMXStorage
-
storeAssocProperty
public void storeAssocProperty(long assocId, String propUri, Object propValue, boolean addToIndex)- Specified by:
storeAssocPropertyin interfaceDMXStorage
-
indexTopicProperty
public void indexTopicProperty(long topicId, String propUri, Object propValue)- Specified by:
indexTopicPropertyin interfaceDMXStorage
-
indexAssocProperty
public void indexAssocProperty(long assocId, String propUri, Object propValue)- Specified by:
indexAssocPropertyin interfaceDMXStorage
-
deleteTopicProperty
public void deleteTopicProperty(long topicId, String propUri)- Specified by:
deleteTopicPropertyin interfaceDMXStorage
-
deleteAssocProperty
public void deleteAssocProperty(long assocId, String propUri)- Specified by:
deleteAssocPropertyin interfaceDMXStorage
-
beginTx
public DMXTransaction beginTx()
- Specified by:
beginTxin interfaceDMXStorage
-
setupRootNode
public boolean setupRootNode()
- Specified by:
setupRootNodein interfaceDMXStorage
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceDMXStorage
-
getDatabaseVendorObject
public Object getDatabaseVendorObject()
- Specified by:
getDatabaseVendorObjectin interfaceDMXStorage
-
getDatabaseVendorObject
public Object getDatabaseVendorObject(long objectId)
- Specified by:
getDatabaseVendorObjectin interfaceDMXStorage
-
getModelFactory
public ModelFactoryImpl getModelFactory()
- Specified by:
getModelFactoryin interfaceDMXStorage
-
-