1 /*global $k*/
  2 
  3 /**
  4  * @class Represents an element of the semantic network.
  5 **/
  6 $k.SemanticElement = function() { };
  7 
  8 /**
  9  * Returns the attribute of the type (including sub-attributes), or undefined if no attribute exists
 10  *
 11  * @function
 12  * @param type AttributeType or internal name
 13  * @throws {$k.exception.NotUnique} If there is more than one attribute of this type
 14  * @returns {$k.Attribute}
 15 **/
 16 $k.SemanticElement.prototype.attribute = function(type) { };
 17 
 18 /**
 19  * Returns all attributes of the type (including sub-attributes).
 20  * Returns all attributes if the type is undefined
 21  *
 22  * @function
 23  * @param type AttributeType or internal name or undefined
 24  * @throws {$k.exception.SchemaError} If type is not an attribute
 25  * @returns {$k.Attribute[]}
 26 **/
 27 $k.SemanticElement.prototype.attributes = function(type) { };
 28 
 29 /**
 30  * Returns the value of the attribute, or undefined if there is no such attribute
 31  *
 32  * @function
 33  * @param type AttributeType or internal name
 34  * @param {string} [language] Language of the value. If not defined, the current language will be used.
 35  * Ignored if the attribute is not translated
 36  * @returns The value of the attribute
 37  * @throws {$k.exception.NotUnique} If there is more than one attribute of this type
 38 **/
 39 $k.SemanticElement.prototype.attributeValue = function(type, language) { };
 40 
 41 /**
 42  * Calls an internal behavior method
 43  *
 44  * @function
 45  * @param {string} method Name of the method
 46  * @param {object[]} [args] Arguments of the call
 47  * @throws {$k.exception.RuntimeError} When the behavior method raises an exception
 48 **/
 49 $k.SemanticElement.prototype.callBehaviour = function(method, args) { };
 50 
 51 /**
 52  * Returns the extended element, if this is an extension.
 53  * Returns the element itself otherwise
 54  *
 55  * @function
 56  * @returns {$k.SemanticElement}
 57 **/
 58 $k.SemanticElement.prototype.core = function() { };
 59 
 60 /**
 61  * Creates a new attribute with the given value
 62  *
 63  * @function
 64  * @param type AttributeType or internal name
 65  * @param value Value of the attribute. Pass undefined for attribute types without value.
 66  * @param {string} [language] Language of the value. If not defined, the current language will be used.
 67  * Ignored if the attribute is not translated
 68  * @returns {$k.Attribute}
 69  * @throws {$k.exception.InvalidValue} If the value is not in the range of allowed values of the attribute
 70  * @throws {$k.exception.SchemaError} If type is not a possible attribute of the element, or if no additional attributes can be created.
 71  * @throws {$k.exception.NotUnique} If there is more than one attribute of this type
 72  * @throws {$k.exception.AccessDenied} If creating an attribute is not allowed
 73  * @throws {$k.exception.TransactionError} If no write transaction is active
 74  * @example person.createAttribute("alias", "Tester");
 75 **/
 76 $k.SemanticElement.prototype.createAttribute = function(type, value, language) { };
 77 
 78 /**
 79  * Creates a new attribute and set the value from the string representation
 80  *
 81  * @function
 82  * @deprecated Use <code>setAttributeValue($k.ValueString(valueString), language)</code> instead
 83  * @param type AttributeType or internal name
 84  * @param {string} valueString String represantation of the value
 85  * @param {string} [language] Language of the value. If not defined, the current language will be used.
 86  * Ignored if the attribute is not translated
 87  * @returns {$k.Attribute}
 88  * @throws {$k.exception.InvalidValue} If the value is not in the range of allowed values of the attribute
 89  * @throws {$k.exception.SchemaError} If type is not a possible attribute of the element, or if no additional attributes can be created.
 90  * @throws {$k.exception.NotUnique} If there is more than one attribute of this type
 91  * @throws {$k.exception.AccessDenied} If creating an attribute is not allowed
 92  * @throws {$k.exception.TransactionError} If no write transaction is active
 93  * @example person.createAttributeFromString("dateOfBirth", "2.3.1968", "de");
 94 **/
 95 $k.SemanticElement.prototype.createAttributeFromString = function(type, valueString, language) { };
 96 
 97 /**
 98  * Creates a new relation
 99  *
100  * @function
101  * @param type RelationType or internal name
102  * @param {$k.SemanticElement} target The relation target.
103  * @param [inverse] RelationType or internal name of the inverse Relation. The default inverse relation type will be used if this parameter is undefined.
104  * @returns {$k.Relation}
105  * @throws {$k.exception.SchemaError} If type is not a possible relation of the element, or if no additional relations can be created.
106  * @throws {$k.exception.AccessDenied} If creating a relation is not allowed
107  * @throws {$k.exception.TransactionError} If no write transaction is active
108 **/
109 $k.SemanticElement.prototype.createRelation = function(type, target, inverse) { };
110 
111 /**
112  * Returns true if the type is a possible attribute of this element
113  *
114  * @function
115  * @param type AttributeType or internal name
116  * @returns {boolean}
117 **/
118 $k.SemanticElement.prototype.hasPossibleAttribute = function(type) { };
119 
120 /**
121  * Returns true if the type is a possible relation of this element
122  *
123  * @function
124  * @param type RelationType or internal name
125  * @returns {boolean}
126 **/
127 $k.SemanticElement.prototype.hasPossibleRelation = function(type) { };
128 
129 /**
130  * Returns the element ID as 64 bit integer.
131  * Returns undefined for non-persistent topics (system relations etc.)
132  *
133  * @function
134  * @returns {number}
135 **/
136 $k.SemanticElement.prototype.idNumber = function() { };
137 
138 /**
139  * Returns the element ID as string, e.g. 'ID123_456'.
140  * Returns undefined for non-persistent topics (system relations etc.)
141  *
142  * @function
143  * @returns {string}
144 **/
145 $k.SemanticElement.prototype.idString = function() { };
146 
147 /**
148  * Returns the own attribute or the inherited attribute of the supertype(s).
149  * If there is more than one supertype, the attribute must be unique.
150  * If this is not a type, then this function is equivalent to attribute().
151  *
152  * @function
153  * @param type AttributeType or internal name
154  * @returns {$k.Attribute} The inherited attribute, or undefined if there is no attribute
155  * @throws {$k.exception.NotUnique} If there is more than one value of this type
156 **/
157 $k.SemanticElement.prototype.inheritedAttribute = function(type) { };
158 
159 /**
160  * Returns the value of the own attribute or of the inherited value of the supertype(s).
161  * If there is more than one supertype, the value must be unique.
162  * If this is not a type, then this function is equivalent to attribute(value).
163  *
164  * @function
165  * @param type AttributeType or internal name
166  * @param {string} [language] Language of the value. If not defined, the current language will be used.
167  * Ignored if the attribute is not translated
168  * @returns The inherited value, or undefined if there is no attribute
169  * @throws {$k.exception.NotUnique} If there is more than one value of this type
170 **/
171 $k.SemanticElement.prototype.inheritedAttributeValue = function(type, language) { };
172 
173 /**
174  * Returns the modification number for the cluster conatining as 64 bit integer.
175  * Returns 0 for newly created topics that are not yet assigned to a cluster.
176  * Returns undefined for non-persistent elements (system relations etc.).
177  * An unchanged modification number indicates that the element is unchanged.
178  * A changed modification number does not necessarily indicate that the topic changed,
179  * because there might have been changes in other objects contained in the same cluster.
180  *
181  * @function
182  * @returns {number}
183 **/
184 $k.SemanticElement.prototype.modificationNumber = function() { };
185 
186 /**
187  * Returns the name of the element
188  *
189  * @function
190  * @param {string} [language] Language of the value. If not defined, the current language will be used.
191  * Ignored if the attribute is not translated
192  * @returns {string}
193 **/
194 $k.SemanticElement.prototype.name = function(language) { };
195 
196 /**
197  * Returns the possible properties of this element.
198  *
199  * @function
200  * @param {$k.PropertyFilter} [filter] Optional filter that defines which properties are returned
201  * @returns {$k.PropertyType[]}
202  * @see $k.PropertyFilter
203  * @example // Possible properties, excluding shortcut / system relations
204  * possibleProperties();
205  * @example // Possible properties, including system relations
206  * possibleProperties($k.PropertyFilter.setSystemRelations());
207  * @example // Same as above, using a literal object to define the filter
208  * possibleProperties({ systemRelations: true });
209 **/
210 $k.SemanticElement.prototype.possibleProperties = function(filter) { };
211 
212 /**
213  * Returns all properties of the property type
214  *
215  * @function
216  * @param {$k.PropertyFilter} [filter] Filter that defines which properties are returned
217  * @returns {$k.Property[]}
218  * @example // All properties 
219  * properties();
220  * @example // All relations with internal name "contains", including sub-relations
221  * properties($k.PropertyFilter.setType("contains"));
222  * @example // All relations with internal name "contains", without sub-relations
223  * properties($k.PropertyFilter.setExact().setType("contains"));
224  * @example // Same as above, using a literal object to define the filter
225  * properties({ exact: true, type: "contains" });
226 **/
227 $k.SemanticElement.prototype.properties = function(filter) { };
228 
229 /**
230  * Returns the relation of the type (including sub-relations), or undefined if no relation exists
231  *
232  * @function
233  * @param type RelationType or internal name
234  * @throws {$k.exception.SchemaError} If type is not a possible relation of the topic
235  * @throws {$k.exception.TypeError} If type is not a relation type
236  * @throws {$k.exception.NotUnique} If there is more than one relation of this type
237  * @returns {$k.Relation[]}
238 **/
239 $k.SemanticElement.prototype.relation = function(type) { };
240 
241 /**
242  * Returns all relations of the type (including sub-relations).
243  * If type is undefined, all user relations (excluding inverse one way relations) are returned.
244  *
245  * @function
246  * @param type RelationType or internal name or undefined
247  * @throws {$k.exception.TypeError} If type is not a relation type
248  * @returns {$k.Relation[]}
249 **/
250 $k.SemanticElement.prototype.relations = function(type) { };
251 
252 /**
253  * Returns the target of the relation of the relation type, or undefined if there is no such relation
254  *
255  * @function
256  * @param type RelationType or internal name
257  * @returns {$k.SemanticElement}
258  * @throws {$k.exception.NotUnique} If there is more than one relation of this type
259  * @throws {$k.exception.TypeError} If type is not a relation type
260 **/
261 $k.SemanticElement.prototype.relationTarget = function(type) { };
262 
263 /**
264  * Returns the targets of the relations of the relation type. Each target is only returned once, even if multiple relations point to the same target.
265  * Returns all relation targets if the type is undefined
266  *
267  * @function
268  * @param type RelationType or internal name or undefined
269  * @returns {$k.SemanticElement[]}
270  * @throws {$k.exception.NotUnique} If there is more than one relation of this type
271  * @throws {$k.exception.TypeError} If type is not a relation type
272 **/
273 $k.SemanticElement.prototype.relationTargets = function(type) { };
274 
275 /**
276  * Deletes the element and all attached properties
277  *
278  * @function
279  * @throws {$k.exception.AccessDenied} If deleting the element or any property not allowed
280  * @throws {$k.exception.RemoveNotPossible} If deleting the element is not possible, e.g. when trying to delete a system element
281 **/
282 $k.SemanticElement.prototype.remove = function() { };
283 
284 /**
285  * Renders the element as a literal object using the associated view configuration.
286  * Uses the optional context topic to detect a suitable configuration
287  *
288  * @function
289  * @param {$k.SemanticElement} [context] Element that defines the context.
290  * @param {object} [keyFilter] A filter that defines which property names that are included. 
291  *		<pre class="code">{"exclude": ["key1", ...]}</pre> includes all but the listed properties, while <pre class="code">{"include": ["key1", ...]}</pre> or <pre class="code">["key1", ...]</pre> includes only the listed properties. 
292  *		<br/>Non-optional properties are always included
293  * @returns {object} The rendered object
294 **/
295 $k.SemanticElement.prototype.render = function(context, keyFilter) { };
296 
297 /**
298  * Render the element as a JavaScript object using the associated view configuration.
299  * Uses the optional context topic to detect a suitable configuration
300  *
301  * @function
302  * @deprecated Use <code>render(context, {"exclude": excludedKeys})</code> instead
303  * @param {$k.SemanticElement} [context] Element that defines the context.
304  * @param {string[]} [excludedKeys] Collection of property names that are excluded
305  * @returns {object} The rendered JSON object
306 **/
307 $k.SemanticElement.prototype.renderJSON = function(context, excludedKeys) { };
308 
309 /**
310  * für Test für Bug 2638
311  *
312  * @function
313 **/
314 $k.SemanticElement.prototype.selfDestruct = function() { };
315 
316 /**
317  * Sets the value of the attribute from the string representation. Creates a new attribute if no such attribute exists
318  *
319  * @function
320  * @deprecated Use <code>setAttributeValue($k.ValueString(valueString), language)</code> instead
321  * @param type AttributeType or internal name
322  * @param {string} valueString String represantation of the value
323  * @param {string} [language] Language of the value. If not defined, the current language will be used.
324  * Ignored if the attribute is not translated
325  * @throws {$k.exception.InvalidValue} If the value is not in the range of allowed values of the attribute
326  * @throws {$k.exception.SchemaError} If type is not a possible attribute of the element
327  * @throws {$k.exception.NotUnique} If there is more than one attribute of this type
328  * @throws {$k.exception.AccessDenied} If modifying is not allowed
329  * @throws {$k.exception.TransactionError} If no write transaction is active
330 **/
331 $k.SemanticElement.prototype.setAttributeFromString = function(type, valueString, language) { };
332 
333 /**
334  * Sets the value of the attribute. Creates a new attribute if no such attribute exists
335  *
336  * @function
337  * @param type AttributeType or internal name
338  * @param value The value that should be set.
339  * @param {string} [language] Language of the value. If not defined, the current language will be used.
340  * Ignored if the attribute is not translated
341  * @throws {$k.exception.InvalidValue} If the value is not in the range of allowed values of the attribute
342  * @throws {$k.exception.SchemaError} If type is not a possible attribute of the element
343  * @throws {$k.exception.NotUnique} If there is more than one attribute of this type
344  * @throws {$k.exception.AccessDenied} If modifying is not allowed
345  * @throws {$k.exception.TransactionError} If no write transaction is active
346 **/
347 $k.SemanticElement.prototype.setAttributeValue = function(type, value, language) { };
348 
349 /**
350  * Sets the name of the element
351  *
352  * @function
353  * @param {string} name The name
354  * @param {string} [language] Language of the value. If not defined, the current language will be used.
355  * Ignored if the attribute is not translated
356  * @throws {$k.exception.TypeError} If the name is not a string
357  * @throws {$k.exception.TransactionError} If no write transaction is active
358 **/
359 $k.SemanticElement.prototype.setName = function(name, language) { };
360 
361 /**
362  * Returns the type of the element.
363  * If the topic is a type, the type itself is returned
364  *
365  * @function
366  * @returns {$k.Type}
367 **/
368 $k.SemanticElement.prototype.type = function() { };
369 
370