de.deepamehta.core.impl
Class StorageDecorator

Show UML class diagram
java.lang.Object
  extended by de.deepamehta.core.impl.StorageDecorator

public class StorageDecorator
extends Object


Field Summary
private  Logger logger
           
private  DeepaMehtaStorage storage
           
 
Constructor Summary
StorageDecorator(DeepaMehtaStorage storage)
           
 
Method Summary
(package private)  DeepaMehtaTransaction beginTx()
           
(package private)  void deleteAssociation(long assocId)
           
(package private)  void deleteTopic(long topicId)
          Deletes the topic.
(package private)  Iterator<AssociationModel> fetchAllAssociations()
           
(package private)  Iterator<TopicModel> fetchAllTopics()
           
(package private)  AssociationModel fetchAssociation(long assocId)
           
(package private)  AssociationModel fetchAssociation(String assocTypeUri, long topicId1, long topicId2, String roleTypeUri1, String roleTypeUri2)
          Convenience method (checks singularity).
(package private)  List<AssociationModel> fetchAssociationAssociations(long assocId)
           
(package private)  AssociationModel fetchAssociationBetweenTopicAndAssociation(String assocTypeUri, long topicId, long assocId, String topicRoleTypeUri, String assocRoleTypeUri)
          Convenience method (checks singularity).
(package private)  RelatedAssociationModel fetchAssociationRelatedAssociation(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
          Convenience method (checks singularity).
(package private)  ResultList<RelatedAssociationModel> fetchAssociationRelatedAssociations(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
           
(package private)  RelatedTopicModel fetchAssociationRelatedTopic(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)
          Convenience method (checks singularity).
(package private)  ResultList<RelatedTopicModel> fetchAssociationRelatedTopics(long assocId, List<String> assocTypeUris, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri, int maxResultSize)
          Convenience method (receives *list* of association types).
(package private)  ResultList<RelatedTopicModel> fetchAssociationRelatedTopics(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri, int maxResultSize)
           
(package private)  List<AssociationModel> fetchAssociations(String assocTypeUri, long topicId1, long topicId2, String roleTypeUri1, String roleTypeUri2)
          Returns the associations between two topics.
(package private)  List<AssociationModel> fetchAssociationsBetweenTopicAndAssociation(String assocTypeUri, long topicId, long assocId, String topicRoleTypeUri, String assocRoleTypeUri)
           
(package private)  List<AssociationModel> fetchAssociationsByProperty(String propUri, Object propValue)
           
(package private)  List<AssociationModel> fetchAssociationsByPropertyRange(String propUri, Number from, Number to)
           
(package private)  int fetchMigrationNr()
           
(package private)  DeepaMehtaObjectModel fetchObject(long id)
           
(package private)  long[] fetchPlayerIds(long assocId)
           
(package private)  Object fetchProperty(long id, String propUri)
           
(package private)  RelatedTopicModel fetchRelatedTopic(long objectId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)
          Convenience method (checks singularity).
(package private)  ResultList<RelatedTopicModel> fetchRelatedTopics(long objectId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)
           
(package private)  TopicModel fetchTopic(long topicId)
           
(package private)  TopicModel fetchTopic(String key, SimpleValue value)
          Looks up a single topic by exact property value.
(package private)  List<AssociationModel> fetchTopicAssociations(long topicId)
           
(package private)  RelatedAssociationModel fetchTopicRelatedAssociation(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
          Convenience method (checks singularity).
(package private)  ResultList<RelatedAssociationModel> fetchTopicRelatedAssociations(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
           
(package private)  RelatedTopicModel fetchTopicRelatedTopic(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)
          Convenience method (checks singularity).
(package private)  ResultList<RelatedTopicModel> fetchTopicRelatedTopics(long topicId, List<String> assocTypeUris, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri, int maxResultSize)
          Convenience method (receives *list* of association types).
(package private)  ResultList<RelatedTopicModel> fetchTopicRelatedTopics(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri, int maxResultSize)
           
(package private)  List<TopicModel> fetchTopics(String key, SimpleValue value)
           
(package private)  List<TopicModel> fetchTopicsByProperty(String propUri, Object propValue)
           
(package private)  List<TopicModel> fetchTopicsByPropertyRange(String propUri, Number from, Number to)
           
(package private)  Object getDatabaseVendorObject()
           
(package private)  Object getDatabaseVendorObject(long objectId)
           
(package private)  boolean hasProperty(long id, String propUri)
           
(package private)  void indexAssociationValue(long assocId, IndexMode indexMode, String indexKey, SimpleValue indexValue)
           
(package private)  void indexTopicValue(long topicId, IndexMode indexMode, String indexKey, SimpleValue indexValue)
           
(package private)  boolean init()
          Initializes the database.
(package private)  List<TopicModel> queryTopics(String searchTerm, String fieldUri)
           
(package private)  void removeAssociationProperty(long assocId, String propUri)
           
(package private)  void removeTopicProperty(long topicId, String propUri)
           
(package private)  void shutdown()
           
(package private)  void storeAssociation(AssociationModel model)
           
(package private)  void storeAssociationProperty(long assocId, String propUri, Object propValue, boolean addToIndex)
           
(package private)  void storeAssociationTypeUri(long assocId, String assocTypeUri)
           
(package private)  void storeAssociationUri(long assocId, String uri)
          Stores and indexes the association's URI.
(package private)  void storeAssociationValue(long assocId, SimpleValue value)
          Convenience method (no indexing).
(package private)  void storeAssociationValue(long assocId, SimpleValue value, List<IndexMode> indexModes, String indexKey, SimpleValue indexValue)
          Stores and indexes the association's value.
(package private)  void storeMigrationNr(int migrationNr)
           
(package private)  void storeRoleTypeUri(long assocId, long playerId, String roleTypeUri)
           
(package private)  void storeTopic(TopicModel model)
          Creates a topic.
(package private)  void storeTopicProperty(long topicId, String propUri, Object propValue, boolean addToIndex)
           
(package private)  void storeTopicTypeUri(long topicId, String topicTypeUri)
           
(package private)  void storeTopicUri(long topicId, String uri)
          Stores and indexes the topic's URI.
(package private)  void storeTopicValue(long topicId, SimpleValue value)
          Convenience method (no indexing).
(package private)  void storeTopicValue(long topicId, SimpleValue value, List<IndexMode> indexModes, String indexKey, SimpleValue indexValue)
          Stores and indexes the topic's value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

storage

private DeepaMehtaStorage storage

logger

private final Logger logger
Constructor Detail

StorageDecorator

public StorageDecorator(DeepaMehtaStorage storage)
Method Detail

fetchTopic

TopicModel fetchTopic(long topicId)
Returns:
The fetched topic. Note: its child topics are not fetched.

fetchTopic

TopicModel fetchTopic(String key,
                      SimpleValue value)
Looks up a single topic by exact property value. If no such topic exists null is returned. If more than one topic were found a runtime exception is thrown.

IMPORTANT: Looking up a topic this way requires the property to be indexed with indexing mode KEY. This is achieved by declaring the respective data field with indexing_mode: "KEY" (for statically declared data field, typically in types.json) or by calling DataField's DataField#setIndexingMode method with "KEY" as argument (for dynamically created data fields, typically in migration classes).

Returns:
The fetched topic. Note: its child topics are not fetched.

fetchTopics

List<TopicModel> fetchTopics(String key,
                             SimpleValue value)

queryTopics

List<TopicModel> queryTopics(String searchTerm,
                             String fieldUri)
Returns:
The fetched topics. Note: their child topics are not fetched.

fetchAllTopics

Iterator<TopicModel> fetchAllTopics()

storeTopic

void storeTopic(TopicModel model)
Creates a topic.

The topic's URI is stored and indexed.


storeTopicUri

void storeTopicUri(long topicId,
                   String uri)
Stores and indexes the topic's URI.


storeTopicTypeUri

void storeTopicTypeUri(long topicId,
                       String topicTypeUri)

storeTopicValue

void storeTopicValue(long topicId,
                     SimpleValue value)
Convenience method (no indexing).


storeTopicValue

void storeTopicValue(long topicId,
                     SimpleValue value,
                     List<IndexMode> indexModes,
                     String indexKey,
                     SimpleValue indexValue)
Stores and indexes the topic's value. ### TODO: separate storing/indexing?


indexTopicValue

void indexTopicValue(long topicId,
                     IndexMode indexMode,
                     String indexKey,
                     SimpleValue indexValue)

deleteTopic

void deleteTopic(long topicId)
Deletes the topic.

Prerequisite: the topic has no relations.


fetchAssociation

AssociationModel fetchAssociation(long assocId)

fetchAssociation

AssociationModel fetchAssociation(String assocTypeUri,
                                  long topicId1,
                                  long topicId2,
                                  String roleTypeUri1,
                                  String roleTypeUri2)
Convenience method (checks singularity). Returns the association between two topics, qualified by association type and both role types. If no such association exists null is returned. If more than one association exist, a runtime exception is thrown.

Parameters:
assocTypeUri - Association type filter. Pass null to switch filter off. ### FIXME: for methods with a singular return value all filters should be mandatory

fetchAssociations

List<AssociationModel> fetchAssociations(String assocTypeUri,
                                         long topicId1,
                                         long topicId2,
                                         String roleTypeUri1,
                                         String roleTypeUri2)
Returns the associations between two topics. If no such association exists an empty set is returned.

Parameters:
assocTypeUri - Association type filter. Pass null to switch filter off.

fetchAssociationBetweenTopicAndAssociation

AssociationModel fetchAssociationBetweenTopicAndAssociation(String assocTypeUri,
                                                            long topicId,
                                                            long assocId,
                                                            String topicRoleTypeUri,
                                                            String assocRoleTypeUri)
Convenience method (checks singularity).


fetchAssociationsBetweenTopicAndAssociation

List<AssociationModel> fetchAssociationsBetweenTopicAndAssociation(String assocTypeUri,
                                                                   long topicId,
                                                                   long assocId,
                                                                   String topicRoleTypeUri,
                                                                   String assocRoleTypeUri)

fetchAllAssociations

Iterator<AssociationModel> fetchAllAssociations()

fetchPlayerIds

long[] fetchPlayerIds(long assocId)

storeAssociationUri

void storeAssociationUri(long assocId,
                         String uri)
Stores and indexes the association's URI.


storeAssociationTypeUri

void storeAssociationTypeUri(long assocId,
                             String assocTypeUri)

storeRoleTypeUri

void storeRoleTypeUri(long assocId,
                      long playerId,
                      String roleTypeUri)

storeAssociationValue

void storeAssociationValue(long assocId,
                           SimpleValue value)
Convenience method (no indexing).


storeAssociationValue

void storeAssociationValue(long assocId,
                           SimpleValue value,
                           List<IndexMode> indexModes,
                           String indexKey,
                           SimpleValue indexValue)
Stores and indexes the association's value. ### TODO: separate storing/indexing?


indexAssociationValue

void indexAssociationValue(long assocId,
                           IndexMode indexMode,
                           String indexKey,
                           SimpleValue indexValue)

storeAssociation

void storeAssociation(AssociationModel model)

deleteAssociation

void deleteAssociation(long assocId)

fetchObject

DeepaMehtaObjectModel fetchObject(long id)

fetchTopicAssociations

List<AssociationModel> fetchTopicAssociations(long topicId)
Returns:
The fetched associations. Note: their child topics are not fetched.

fetchAssociationAssociations

List<AssociationModel> fetchAssociationAssociations(long assocId)

fetchTopicRelatedTopic

RelatedTopicModel fetchTopicRelatedTopic(long topicId,
                                         String assocTypeUri,
                                         String myRoleTypeUri,
                                         String othersRoleTypeUri,
                                         String othersTopicTypeUri)
Convenience method (checks singularity).

Parameters:
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null
othersTopicTypeUri - may be null
Returns:
The fetched topic. Note: its child topics are not fetched.

fetchTopicRelatedTopics

ResultList<RelatedTopicModel> fetchTopicRelatedTopics(long topicId,
                                                      String assocTypeUri,
                                                      String myRoleTypeUri,
                                                      String othersRoleTypeUri,
                                                      String othersTopicTypeUri,
                                                      int maxResultSize)
Parameters:
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null
othersTopicTypeUri - may be null
Returns:
The fetched topics. Note: their child topics are not fetched.

fetchTopicRelatedTopics

ResultList<RelatedTopicModel> fetchTopicRelatedTopics(long topicId,
                                                      List<String> assocTypeUris,
                                                      String myRoleTypeUri,
                                                      String othersRoleTypeUri,
                                                      String othersTopicTypeUri,
                                                      int maxResultSize)
Convenience method (receives *list* of association types).

Parameters:
assocTypeUris - may *not* be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null
othersTopicTypeUri - may be null
Returns:
The fetched topics. Note: their child topics are not fetched.

fetchTopicRelatedAssociation

RelatedAssociationModel fetchTopicRelatedAssociation(long topicId,
                                                     String assocTypeUri,
                                                     String myRoleTypeUri,
                                                     String othersRoleTypeUri,
                                                     String othersAssocTypeUri)
Convenience method (checks singularity).

Returns:
The fetched association. Note: its child topics are not fetched.

fetchTopicRelatedAssociations

ResultList<RelatedAssociationModel> fetchTopicRelatedAssociations(long topicId,
                                                                  String assocTypeUri,
                                                                  String myRoleTypeUri,
                                                                  String othersRoleTypeUri,
                                                                  String othersAssocTypeUri)
Parameters:
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null
othersAssocTypeUri - may be null
Returns:
The fetched associations. Note: their child topics are not fetched.

fetchAssociationRelatedTopic

RelatedTopicModel fetchAssociationRelatedTopic(long assocId,
                                               String assocTypeUri,
                                               String myRoleTypeUri,
                                               String othersRoleTypeUri,
                                               String othersTopicTypeUri)
Convenience method (checks singularity).

Returns:
The fetched topic. Note: its child topics are not fetched.

fetchAssociationRelatedTopics

ResultList<RelatedTopicModel> fetchAssociationRelatedTopics(long assocId,
                                                            String assocTypeUri,
                                                            String myRoleTypeUri,
                                                            String othersRoleTypeUri,
                                                            String othersTopicTypeUri,
                                                            int maxResultSize)
Returns:
The fetched topics. Note: their child topics are not fetched.

fetchAssociationRelatedTopics

ResultList<RelatedTopicModel> fetchAssociationRelatedTopics(long assocId,
                                                            List<String> assocTypeUris,
                                                            String myRoleTypeUri,
                                                            String othersRoleTypeUri,
                                                            String othersTopicTypeUri,
                                                            int maxResultSize)
Convenience method (receives *list* of association types).

Parameters:
assocTypeUris - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null
othersTopicTypeUri - may be null
Returns:
The fetched topics. Note: their child topics are not fetched.

fetchAssociationRelatedAssociation

RelatedAssociationModel fetchAssociationRelatedAssociation(long assocId,
                                                           String assocTypeUri,
                                                           String myRoleTypeUri,
                                                           String othersRoleTypeUri,
                                                           String othersAssocTypeUri)
Convenience method (checks singularity).

Returns:
The fetched association. Note: its child topics are not fetched.

fetchAssociationRelatedAssociations

ResultList<RelatedAssociationModel> fetchAssociationRelatedAssociations(long assocId,
                                                                        String assocTypeUri,
                                                                        String myRoleTypeUri,
                                                                        String othersRoleTypeUri,
                                                                        String othersAssocTypeUri)
Parameters:
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null
othersAssocTypeUri - may be null
Returns:
The fetched associations. Note: their child topics are not fetched.

fetchRelatedTopic

RelatedTopicModel fetchRelatedTopic(long objectId,
                                    String assocTypeUri,
                                    String myRoleTypeUri,
                                    String othersRoleTypeUri,
                                    String othersTopicTypeUri)
Convenience method (checks singularity).

Parameters:
objectId - id of a topic or an association
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null
othersTopicTypeUri - may be null
Returns:
The fetched topic. Note: its child topics are not fetched.

fetchRelatedTopics

ResultList<RelatedTopicModel> fetchRelatedTopics(long objectId,
                                                 String assocTypeUri,
                                                 String myRoleTypeUri,
                                                 String othersRoleTypeUri,
                                                 String othersTopicTypeUri)
Parameters:
objectId - id of a topic or an association
assocTypeUri - may be null
myRoleTypeUri - may be null
othersRoleTypeUri - may be null
othersTopicTypeUri - may be null
Returns:
The fetched topics. Note: their child topics are not fetched.

fetchProperty

Object fetchProperty(long id,
                     String propUri)

hasProperty

boolean hasProperty(long id,
                    String propUri)

fetchTopicsByProperty

List<TopicModel> fetchTopicsByProperty(String propUri,
                                       Object propValue)

fetchTopicsByPropertyRange

List<TopicModel> fetchTopicsByPropertyRange(String propUri,
                                            Number from,
                                            Number to)

fetchAssociationsByProperty

List<AssociationModel> fetchAssociationsByProperty(String propUri,
                                                   Object propValue)

fetchAssociationsByPropertyRange

List<AssociationModel> fetchAssociationsByPropertyRange(String propUri,
                                                        Number from,
                                                        Number to)

storeTopicProperty

void storeTopicProperty(long topicId,
                        String propUri,
                        Object propValue,
                        boolean addToIndex)

storeAssociationProperty

void storeAssociationProperty(long assocId,
                              String propUri,
                              Object propValue,
                              boolean addToIndex)

removeTopicProperty

void removeTopicProperty(long topicId,
                         String propUri)

removeAssociationProperty

void removeAssociationProperty(long assocId,
                               String propUri)

beginTx

DeepaMehtaTransaction beginTx()

init

boolean init()
Initializes the database. Prerequisite: there is an open transaction.

Returns:
true if a clean install is detected, false otherwise.

shutdown

void shutdown()

fetchMigrationNr

int fetchMigrationNr()

storeMigrationNr

void storeMigrationNr(int migrationNr)

getDatabaseVendorObject

Object getDatabaseVendorObject()

getDatabaseVendorObject

Object getDatabaseVendorObject(long objectId)


Copyright © 2015. All Rights Reserved.