001 package de.deepamehta.core; 002 003 import de.deepamehta.core.model.CompositeValueModel; 004 import de.deepamehta.core.model.DeepaMehtaObjectModel; 005 import de.deepamehta.core.model.SimpleValue; 006 import de.deepamehta.core.model.TopicModel; 007 import de.deepamehta.core.service.ClientState; 008 import de.deepamehta.core.service.Directives; 009 import de.deepamehta.core.service.ResultList; 010 011 import java.util.List; 012 013 014 015 public interface DeepaMehtaObject extends Identifiable, JSONEnabled { 016 017 018 019 // === Model === 020 021 // --- ID --- 022 023 long getId(); 024 025 // --- URI --- 026 027 String getUri(); 028 029 void setUri(String uri); 030 031 // --- Type URI --- 032 033 String getTypeUri(); 034 035 void setTypeUri(String typeUri); 036 037 // --- Simple Value --- 038 039 SimpleValue getSimpleValue(); 040 041 void setSimpleValue(String value); 042 void setSimpleValue(int value); 043 void setSimpleValue(long value); 044 void setSimpleValue(boolean value); 045 void setSimpleValue(SimpleValue value); 046 047 // --- Composite Value --- 048 049 CompositeValue getCompositeValue(); 050 051 void setCompositeValue(CompositeValueModel comp, ClientState clientState, Directives directives); 052 053 // --- 054 055 void loadChildTopics(); 056 void loadChildTopics(String childTypeUri); 057 058 // --- 059 060 DeepaMehtaObjectModel getModel(); 061 062 063 064 // === Updating === 065 066 void update(DeepaMehtaObjectModel model, ClientState clientState, Directives directives); 067 068 // --- 069 070 void updateChildTopic(TopicModel newChildTopic, AssociationDefinition assocDef, ClientState clientState, 071 Directives directives); 072 void updateChildTopics(List<TopicModel> newChildTopics, AssociationDefinition assocDef, ClientState clientState, 073 Directives directives); 074 075 076 077 // === Deletion === 078 079 /** 080 * Deletes the DeepaMehta object in its entirety, that is 081 * - the object itself (the <i>parent</i>) 082 * - all child topics associated via "dm4.core.composition", recusively 083 * - all the remaining direct associations, e.g. "dm4.core.instantiation" 084 */ 085 void delete(Directives directives); 086 087 088 089 // === Traversal === 090 091 // --- Topic Retrieval --- 092 093 /** 094 * Fetches and returns a related topic or <code>null</code> if no such topic extists. 095 * 096 * @param assocTypeUri may be null 097 * @param myRoleTypeUri may be null 098 * @param othersRoleTypeUri may be null 099 * @param othersTopicTypeUri may be null 100 */ 101 RelatedTopic getRelatedTopic(String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, 102 String othersTopicTypeUri, boolean fetchComposite, boolean fetchRelatingComposite); 103 104 ResultList<RelatedTopic> getRelatedTopics(String assocTypeUri, int maxResultSize); 105 106 /** 107 * @param assocTypeUri may be null 108 * @param myRoleTypeUri may be null 109 * @param othersRoleTypeUri may be null 110 * @param othersTopicTypeUri may be null 111 * @param fetchComposite 112 * @param fetchRelatingComposite 113 * @param maxResultSize Result size limit. Pass 0 for no limit. 114 */ 115 ResultList<RelatedTopic> getRelatedTopics(String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, 116 String othersTopicTypeUri, boolean fetchComposite, boolean fetchRelatingComposite, 117 int maxResultSize); 118 119 /** 120 * @param assocTypeUris may *not* be null 121 * @param myRoleTypeUri may be null 122 * @param othersRoleTypeUri may be null 123 * @param othersTopicTypeUri may be null 124 */ 125 ResultList<RelatedTopic> getRelatedTopics(List assocTypeUris, String myRoleTypeUri, String othersRoleTypeUri, 126 String othersTopicTypeUri, boolean fetchComposite, boolean fetchRelatingComposite, 127 int maxResultSize); 128 129 // --- Association Retrieval --- 130 131 Association getAssociation(String assocTypeUri, String myRoleTypeUri, String othersRoleTypeUri, 132 long othersTopicId); 133 134 List<Association> getAssociations(); 135 136 137 138 // === Properties === 139 140 Object getProperty(String propUri); 141 142 void setProperty(String propUri, Object propValue, boolean addToIndex); 143 144 boolean hasProperty(String propUri); 145 146 void removeProperty(String propUri); 147 }