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)  Object fetchAssociationProperty(long assocId, String propUri)
           
(package private)  RelatedAssociationModel fetchAssociationRelatedAssociation(long assocId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
          Convenience method (checks singularity).
(package private)  List<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)  RelatedTopicModel fetchRelatedTopic(long id, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersTopicTypeUri)
          Convenience method (checks singularity).
(package private)  ResultList<RelatedTopicModel> fetchRelatedTopics(long id, 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)  Object fetchTopicProperty(long topicId, String propUri)
           
(package private)  RelatedAssociationModel fetchTopicRelatedAssociation(long topicId, String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, String othersAssocTypeUri)
          Convenience method (checks singularity).
(package private)  List<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)  boolean hasAssociationProperty(long assocId, String propUri)
           
(package private)  boolean hasTopicProperty(long topicId, String propUri)
           
(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 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 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 composite value is not initialized.

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 composite value is not initialized.

fetchTopics

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

queryTopics

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

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 the topic's value.

Note: the value is not indexed automatically. Use the indexTopicValue method. ### FIXDOC


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()

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 the association's value.

Note: the value is not indexed automatically. Use the indexAssociationValue method. ### FIXDOC


storeAssociation

void storeAssociation(AssociationModel model)

deleteAssociation

void deleteAssociation(long assocId)

fetchTopicAssociations

List<AssociationModel> fetchTopicAssociations(long topicId)
Returns:
The fetched associations. Note: their composite values are not initialized.

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 topics. Note: their composite values are not initialized.

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 composite values are not initialized.

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 composite values are not initialized.

fetchTopicRelatedAssociation

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

Returns:
The fetched association. Note: its composite value is not initialized.

fetchTopicRelatedAssociations

List<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 composite values are not initialized.

fetchAssociationRelatedTopic

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

Returns:
The fetched topics. Note: their composite values are not initialized.

fetchAssociationRelatedTopics

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

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 composite values are not initialized.

fetchAssociationRelatedAssociation

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

Returns:
The fetched association. Note: its composite value is not initialized.

fetchAssociationRelatedAssociations

List<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 composite values are not initialized.

fetchRelatedTopic

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

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
Returns:
The fetched topic. Note: its composite value is not initialized.

fetchRelatedTopics

ResultList<RelatedTopicModel> fetchRelatedTopics(long id,
                                                 String assocTypeUri,
                                                 String myRoleTypeUri,
                                                 String othersRoleTypeUri,
                                                 String othersTopicTypeUri)
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
Returns:
The fetched topics. Note: their composite values are not initialized.

fetchTopicProperty

Object fetchTopicProperty(long topicId,
                          String propUri)

fetchAssociationProperty

Object fetchAssociationProperty(long assocId,
                                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)

hasTopicProperty

boolean hasTopicProperty(long topicId,
                         String propUri)

hasAssociationProperty

boolean hasAssociationProperty(long assocId,
                               String propUri)

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)


Copyright © 2014. All Rights Reserved.