Package lv.lumii.tda.raapi
Interface RAAPI
-
- All Known Subinterfaces:
IWebMemory
public interface RAAPI
RAAPI
is a common abstraction layer for accessing models stored in different repositories associated with different technical spaces.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
callSpecificOperation(java.lang.String operationName, java.lang.String arguments)
Calls a repository-specific operation (e.g., or MOF/ECore-like operation, an SQL statement, or a SPARQL statement).long
createAdvancedAssociation(java.lang.String name, boolean nAry, boolean associationClass)
Creates an n-ary association, an association class, or an n-ary association class.long
createAssociation(long rSourceClass, long rTargetClass, java.lang.String sourceRoleName, java.lang.String targetRoleName, boolean isComposition)
Creates a bidirectional association (or two directed associations, where each is an inverse of the other).long
createAttribute(long rClass, java.lang.String name, long rPrimitiveType)
Creates (defines) a new attribute for the given class.long
createClass(java.lang.String name)
Creates a class with the given fully qualified name.long
createDirectedAssociation(long rSourceClass, long rTargetClass, java.lang.String targetRoleName, boolean isComposition)
Creates a directed association.boolean
createGeneralization(long rSubClass, long rSuperClass)
Creates a generalization between the two given classes.boolean
createLink(long rSourceObject, long rTargetObject, long rAssociationEnd)
Creates a link of the given type (specified byrAssociationEnd
) between two objects.long
createObject(long rClass)
Creates an instance of the given class.boolean
createOrderedLink(long rSourceObject, long rTargetObject, long rAssociationEnd, int targetPosition)
Creates a link of the given type (specified byrAssociationEnd
) between two objects at the given position.boolean
deleteAssociation(long rAssociationEndOrAdvancedAssociation)
Deletes the given association.boolean
deleteAttribute(long rAttribute)
Deletes the given attribute.boolean
deleteAttributeValue(long rObject, long rAttribute)
Deletes the value (all the values) of the given attribute for the given object.boolean
deleteClass(long rClass)
Deletes the class and frees the reference.boolean
deleteGeneralization(long rSubClass, long rSuperClass)
Deletes the generalization between the given two classes.boolean
deleteLink(long rSourceObject, long rTargetObject, long rAssociationEnd)
Deletes a link of the given type (specified byrTargetAssociationEnd
) between the given two objects.boolean
deleteObject(long rObject)
Creates the given object.long
deserializeReference(java.lang.String r)
Obtains a reference to a serialized element from the given serialization.boolean
excludeObjectFromClass(long rObject, long rClass)
Takes out the given object from the given (quasi-ontological) class.long
findAssociationEnd(long rSourceClass, java.lang.String targetRoleName)
Obtains a reference to an association end (by its role name) starting at the given class.long
findAttribute(long rClass, java.lang.String name)
Obtains a reference to an existing attribute with the given name of the given class.long
findClass(java.lang.String name)
Obtains a reference to an existing class with the given fully qualified name.long
findPrimitiveDataType(java.lang.String name)
Obtains a reference to a primitive data type with the given name.void
freeIterator(long it)
Frees the memory associated with the given iterator reference.void
freeReference(long r)
Frees the memory associated with the given reference (if necessary).long
getAttributeDomain(long rAttribute)
Obtains a class, for which the given attribute was defined.java.lang.String
getAttributeName(long rAttribute)
Returns the name of the given attribute.long
getAttributeType(long rAttribute)
Returns the (primitive) type for values of the given attribute.java.lang.String
getAttributeValue(long rObject, long rAttribute)
Gets the value or the ordered collection of values (encoded as a string) of the given attribute for the given object.java.lang.String
getClassName(long rClass)
Returns the fully qualified name of the given class.long
getInverseAssociationEnd(long rAssociationEnd)
Obtains a reference to the inverse association end of the given association end (if association is bidirectional or a bidirectional part of an advanced association).long
getIteratorForAllAttributes(long rClass)
Obtains an iterator for all (including inherited) attributes of the given class.long
getIteratorForAllClassObjects(long rClassOrAdvancedAssociation)
Obtains an iterator for all quasi-ontological instances of the given class or advanced association.long
getIteratorForAllIngoingAssociationEnds(long rClass)
Obtains an iterator for all (including inherited) ingoing association ends of the given class.long
getIteratorForAllLinguisticInstances(long rClass)
Returns an iterator for all quasi-linguistic instances (including instances of subclasses) at Level MΩ of the given class at Level M3.long
getIteratorForAllOutgoingAssociationEnds(long rClass)
Obtains an iterator for all (including inherited) outgoing association ends of the given class.long
getIteratorForClasses()
Obtains an iterator for all classes (all quasi-ontological classes at all quasi-ontological meta-levels).long
getIteratorForDirectAttributes(long rClass)
Obtains an iterator for direct (without inherited) attributes of the given class.long
getIteratorForDirectClassObjects(long rClassOrAdvancedAssociation)
Obtains an iterator for direct quasi-ontological instances of the given class or advanced association.long
getIteratorForDirectIngoingAssociationEnds(long rClass)
Obtains an iterator for direct (without inherited) ingoing association ends of the given class.long
getIteratorForDirectLinguisticInstances(long rClass)
Returns an iterator for direct quasi-linguistic instances (not including instances of subclasses) at Level MΩ of the given class at Level M3.long
getIteratorForDirectObjectClasses(long rObjectOrAdvancedLink)
Obtains an iterator for direct quasi-ontological classes of the given object or advanced link.long
getIteratorForDirectOutgoingAssociationEnds(long rClass)
Obtains an iterator for direct (without inherited) outgoing association ends of the given class.long
getIteratorForDirectSubClasses(long rSuperClass)
Obtains an iterator for all direct subclasses of the given superclass.long
getIteratorForDirectSuperClasses(long rSubClass)
Obtains an iterator for all direct superclasses of the given subclass.long
getIteratorForLinguisticClasses()
Returns an iterator for all quasi-linguistic classes at Level M3.long
getIteratorForLinkedObjects(long rObject, long rAssociationEnd)
Returns an iterator for objects linked to the given start object by links of the given type.long
getIteratorForObjectsByAttributeValue(long rAttribute, java.lang.String value)
Obtains an iterator for objects, for whose the value of the given attribute equals to the given value.int
getIteratorLength(long it)
Places the iterator to the position 0 and returns the total number of elements to iterate through.long
getLinguisticClassFor(long r)
Returns a reference to the Level M3 class of the given quasi-ontological (Level MΩ) element.int
getLinkedObjectPosition(long rSourceObject, long rTargetObject, long rAssociationEnd)
Returns the index (numeration starts from 0) of the target object in the list of objects linked to the source object by links of the given type.java.lang.String
getPrimitiveDataTypeName(long rDataType)
Returns the name of the given primitive data type.java.lang.String
getRoleName(long rAssociationEnd)
Returns the role name of the given association end.long
getSourceClass(long rTargetAssociationEnd)
Obtains a reference to the source class of the given directed or bidirectional association (or part of an advanced association) specified by its target end.long
getTargetClass(long rTargetAssociationEnd)
Obtains a reference to the class corresponding to the given association end of some directed, bidirectional, or advanced association.boolean
includeObjectInClass(long rObject, long rClass)
Adds the given object to the given (quasi-ontological) class.boolean
isAdvancedAssociation(long r)
Checks, whether the given reference corresponds to an advanced association.boolean
isAssociationEnd(long r)
Checks, whether the given reference corresponds to an association end.boolean
isAttribute(long r)
Checks whether the given reference is associated with an attribute.boolean
isClass(long r)
Checks whether the given reference is associated with a class.boolean
isComposition(long rTargetAssociationEnd)
Returns, whether the directed or bidirectional association (or a part of an advanced association) specified by its target association end is a composition (i.e., whether the source class objects are containers for the target class objects).boolean
isDerivedClass(long rDirectlyOrIndirectlyDerivedClass, long rSuperClass)
Checks whether one class is a direct or indirect subclass of another.boolean
isDirectSubClass(long rSubClass, long rSuperClass)
Checks whether the generalization relation between the two given classes holds.boolean
isKindOf(long rObject, long rClass)
Checks whether the given object is a direct or indirect, quasi-ontological or quasi-linguistic, instance of the given class.boolean
isLinguistic(long r)
Checks, whether the given reference is associated with a Level M3 element.boolean
isPrimitiveDataType(long r)
Checks whether the given reference is associated with a primitive data type.boolean
isTypeOf(long rObject, long rClass)
Checks whether the given object is a direct (quasi-ontological or quasi-linguistic) instance of the given class.boolean
linkExists(long rSourceObject, long rTargetObject, long rAssociationEnd)
Checks whether the link of the given type (specified byrTargetAssociationEnd
) between the given two objects exists.boolean
moveObject(long rObject, long rToClass)
Moves (reclassifies) the given object into the given (quasi-ontological) class, removing it from its current class (classes).long
resolveIterator(long it, int position)
Returns a reference to the element at the givenposition
(numeration starts from 0) and forwards the iterator toposition+1
.long
resolveIteratorFirst(long it)
Places the iterator to the position 0 and gets the element there.long
resolveIteratorNext(long it)
Moves the iterator forward and gets the element at that position.java.lang.String
serializeReference(long r)
Creates a string representation of the given reference, which survives the current session.boolean
setAttributeValue(long rObject, long rAttribute, java.lang.String value)
Sets the value or the ordered collection of values (encoded as a string) of the given attribute for the given object.
-
-
-
Method Detail
-
findPrimitiveDataType
long findPrimitiveDataType(java.lang.String name)
Obtains a reference to a primitive data type with the given name.- Parameters:
name
- the type name. Each repository must support at least four standard primitive data types: "Integer", "Real", "Boolean", and "String".
[TODO] Certain repositories may introduce additional primitive types. To denote a repository-specific additional primitive data type, prepend the mount point of that repository, e.g.,MountPoint::PeculiarDataType
.- Returns:
- a reference to a primitive data type with the given name, or 0 on error.
Note (TDA Kernel): TDA Kernel returns a proxy reference, which is usable even when there are multiple repositories mounted or non-standard primitive data types are used.
-
getPrimitiveDataTypeName
java.lang.String getPrimitiveDataTypeName(long rDataType)
Returns the name of the given primitive data type.- Parameters:
rDataType
- a reference to a primitive data type, for which the name has to be obtained- Returns:
- the name of the given primitive data type, or
null
on error. - See Also:
findPrimitiveDataType(java.lang.String)
-
isPrimitiveDataType
boolean isPrimitiveDataType(long r)
Checks whether the given reference is associated with a primitive data type.- Parameters:
r
- a reference in question- Returns:
- whether the given reference is associated with a primitive data type.
On error,
false
is returned. - See Also:
findPrimitiveDataType(java.lang.String)
,getPrimitiveDataTypeName(long)
-
createClass
long createClass(java.lang.String name)
Creates a class with the given fully qualified name.- Parameters:
name
- the fully qualified name of the class (packages are delimited by double colon "::"); this fully qualified name must be unique- Returns:
- a reference to the class just created, or 0 on error.
-
findClass
long findClass(java.lang.String name)
Obtains a reference to an existing class with the given fully qualified name.
Note (M3): If the underlying repository provides access to its quasi-linguistic meta-metamodel, quasi-linguistic classes can be accessed by using the prefix "M3::", e.g.,SomePath::MountPoint::M3::SomeMetaType
Note (adapters): This function is optional for repository adapters. If not implemented in an adapter, TDA Kernel implements it throughgetIteratorForClasses
[TODO] andgetIteratorForLinguisticClasses
.- Parameters:
name
- the fully qualified name of the class (for quasi-linguistic classes, use prefix "M3::")- Returns:
- a reference to a (quasi-ontological or quasi-linguistic) class with the given fully qualified name.
- See Also:
- on meta-levels
-
getClassName
java.lang.String getClassName(long rClass)
Returns the fully qualified name of the given class.
[TODO] Note (M3): If the reference points to a quasi-linguistic class, then the prefix "M3::" is also included in the return value, e.g.,MountPointForTheCorrespondingRepository::M3::ClassName
.- Parameters:
rClass
- a reference to the class, for which the class name has to be obtained- Returns:
- the fully qualified name of the given class, or
null
on error. - See Also:
- on meta-levels
-
deleteClass
boolean deleteClass(long rClass)
Deletes the class and frees the reference.- Parameters:
rClass
- a reference to the class to be deleted- Returns:
- whether the operation succeeded.
-
getIteratorForClasses
long getIteratorForClasses()
Obtains an iterator for all classes (all quasi-ontological classes at all quasi-ontological meta-levels).
Note (M3): Linguistic classes are not traversed by this iterator. UsegetIteratorForLinguisticClasses
instead.
- Returns:
- an iterator for all classes, or 0 on error.
- See Also:
getIteratorForLinguisticClasses()
, on iterators, on meta-levels
-
createGeneralization
boolean createGeneralization(long rSubClass, long rSuperClass)
Creates a generalization between the two given classes.
The given subclass can be a derived class of the given superclass, but the direct generalization between them must not exist.
The generalization relation being created must not introduce inheritance loops.- Parameters:
rSubClass
- a class that becomes a subclassrSuperClass
- a class that becomes a superclass- Returns:
- whether the operation succeeded.
-
deleteGeneralization
boolean deleteGeneralization(long rSubClass, long rSuperClass)
Deletes the generalization between the given two classes.- Parameters:
rSubClass
- a class that was a subclassrSuperClass
- a class that was a superclass- Returns:
- whether the operation succeeded.
-
getIteratorForDirectSuperClasses
long getIteratorForDirectSuperClasses(long rSubClass)
Obtains an iterator for all direct superclasses of the given subclass.
Note (M3): If the given subclass is a quasi-linguistic class, then an iterator for its direct quasi-linguistic superclasses is returned.- Parameters:
rSubClass
- a subclass for which to obtain direct superclasses- Returns:
- an iterator for all direct superclasses of the given subclass, or 0 on error.
- See Also:
- on iterators, on meta-levels
-
getIteratorForDirectSubClasses
long getIteratorForDirectSubClasses(long rSuperClass)
Obtains an iterator for all direct subclasses of the given superclass.
Note (M3): If the given superclass is a quasi-linguistic class, then an iterator for direct quasi-linguistic subclasses is returned.- Parameters:
rSuperClass
- a superclass for which to obtain direct subclasses- Returns:
- an iterator for all direct subclasses of the given superclass, or 0 on error.
- See Also:
- on iterators, on meta-levels
-
isClass
boolean isClass(long r)
Checks whether the given reference is associated with a class.
Note (M3): A reference at Level M3 can also be passed.- Parameters:
r
- a reference in question- Returns:
- whether the given reference is associated with a class.
On error,
false
is returned. - See Also:
- on meta-levels
-
isDirectSubClass
boolean isDirectSubClass(long rSubClass, long rSuperClass)
Checks whether the generalization relation between the two given classes holds.
Note (M3): Both classes may be either quasi-ontological, or quasi-linguistic.- Parameters:
rSubClass
- a reference to a potential subclassrSuperClass
- a reference to a potential superclass- Returns:
- whether the generalization relation holds.
On error,
false
is returned. - See Also:
- on meta-levels
-
isDerivedClass
boolean isDerivedClass(long rDirectlyOrIndirectlyDerivedClass, long rSuperClass)
Checks whether one class is a direct or indirect subclass of another.
Note (M3): Both classes may be either quasi-ontological, or quasi-linguistic.- Parameters:
rDirectlyOrIndirectlyDerivedClass
- a reference to a potential subclass or derived classrSuperClass
- a reference to a potential (direct or indirect) superclass- Returns:
- whether the first class derives from the second.
On error,
false
is returned. - See Also:
- on meta-levels
-
createObject
long createObject(long rClass)
Creates an instance of the given class.
Note (M3): If the given class is a quasi-linguistic class, then its quasi-linguistic instance at Level MΩ is being created.- Parameters:
rClass
- a reference to a class (either quasi-ontological, or quasi-linguistic)- Returns:
- whether the operation succeeded.
- See Also:
- on meta-levels
-
deleteObject
boolean deleteObject(long rObject)
Creates the given object.- Parameters:
rObject
- a reference to the object to be deleted- Returns:
- whether the operation succeeded.
-
includeObjectInClass
boolean includeObjectInClass(long rObject, long rClass)
Adds the given object to the given (quasi-ontological) class. The function works, if the underlying repository supports multiple classification and dynamic reclassification.
Note (M3): It is assumed that an element from a quasi-ontological level can be associated with only one quasi-linguistic type (quasi-linguistic class), thus,includeObjectInClass
is meaningless in this case.- Parameters:
rObject
- a reference to the object to be included in the given classrClass
- a reference to the class, where to put the object (in addition to classes, where the object already belongs)- Returns:
- whether the operation succeeded.
- See Also:
- on meta-levels
-
excludeObjectFromClass
boolean excludeObjectFromClass(long rObject, long rClass)
Takes out the given object from the given (quasi-ontological) class.
The function works, if the underlying repository supports multiple classification and dynamic reclassification. If the object currently is only in one class, then the operation fails (it is assumed that each object must be at least in one class).
Note (M3): It is assumed that an element from a quasi-ontological level can be associated with only one quasi-linguistic type (quasi-linguistic class), thus,excludeObjectInClass
as well asincludeObjectInClass
are meaningless in this case.- Parameters:
rObject
- a reference to the object to be excluded from the given classrClass
- a reference to the class, which to exclude from the classifiers of the given object- Returns:
- whether the operation succeeded.
- See Also:
- on meta-levels
-
moveObject
boolean moveObject(long rObject, long rToClass)
Moves (reclassifies) the given object into the given (quasi-ontological) class, removing it from its current class (classes).
The function is similar to callingincludeObjectInClass(rObject, rToClass);
followed by callingexcludeObjectInClass(rObject, c)
for all other current classifiers c of the given object.
The distinction is that it may be possible to implement this function even when multiple classification is not supported.
Note (adapters): This function is optional for repository adapters. If not implemented in an adapter, TDA Kernel implements it by [TODO] recreating the object (with the new type), while also recreating all attributes and links.
Note (M3): It is assumed that an element from a quasi-ontological level cannot dynamically change its quasi-linguistic type (quasi-linguistic class), thus,moveObject
is meaningless in this case.- Parameters:
rObject
- a reference to the object to be reclassifiedrToClass
- a reference to the class, to which the object will belong- Returns:
- whether the operation succeeded.
- See Also:
- on meta-levels
-
getIteratorForAllClassObjects
long getIteratorForAllClassObjects(long rClassOrAdvancedAssociation)
Obtains an iterator for all quasi-ontological instances of the given class or advanced association.
Note (adapters): A repository adapter may implement only one of the functionsgetIteratorForAllClassObjects
andgetIteratorForDirectClassObjects
. The unimplemented function will be implemented via another by TDA Kernel.
Note (M3): If the given class or advanced association is quasi-linguistic, then an iterator for the quasi-linguistic elements it describes is returned, e.g., for the EMOF class "Class", an iterator for all classes found in EMOF is returned; for the EMOF class "Property", an iterator for all properties found in EMOF is returned, etc.- Parameters:
rClassOrAdvancedAssociation
- a reference to a class or an advanced association- Returns:
- an iterator for all quasi-ontological instances (objects) of the given class or advanced association. On error, 0 is returned.
- See Also:
getIteratorForDirectClassObjects(long)
, on iterators, on advanced associations, on meta-levels
-
getIteratorForDirectClassObjects
long getIteratorForDirectClassObjects(long rClassOrAdvancedAssociation)
Obtains an iterator for direct quasi-ontological instances of the given class or advanced association.
Note (adapters): A repository adapter may implement only one of the functionsgetIteratorForAllClassObjects
andgetIteratorForDirectClassObjects
. The unimplemented function will be implemented via another by TDA Kernel.
Note (M3): If the given class or advanced association is quasi-linguistic, then an iterator for the quasi-linguistic elements it describes is returned, e.g., for the EMOF class "Class", an iterator for all classes found in EMOF is returned; for the EMOF class "Property", an iterator for all properties found in EMOF is returned, etc.- Parameters:
rClassOrAdvancedAssociation
- a reference to a class or an advanced association- Returns:
- an iterator for direct quasi-ontological instances (objects) of the given class or advanced association. On error, 0 is returned.
- See Also:
getIteratorForAllClassObjects(long)
, on iterators, on advanced associations, on meta-levels
-
getIteratorForDirectObjectClasses
long getIteratorForDirectObjectClasses(long rObjectOrAdvancedLink)
Obtains an iterator for direct quasi-ontological classes of the given object or advanced link.
Note (M3): The function works also if the given object or advanced link is quasi-linguistic and the underlying repository provides access to quasi-linguistic elements. To get the quasi-linguistic class for the given element at some quasi-ontological level, usegetLinguisticClassFor
.- Parameters:
rObjectOrAdvancedLink
- a reference to an object or advanced link- Returns:
- an iterator for direct quasi-ontological classes of the given object or advanced link. On error, 0 is returned.
- See Also:
getLinguisticClassFor(long)
, on iterators, on advanced associations, on meta-levels
-
isTypeOf
boolean isTypeOf(long rObject, long rClass)
Checks whether the given object is a direct (quasi-ontological or quasi-linguistic) instance of the given class.
Note (M3): The function works also when one or both ofrObject
andrClass
is/are quasi-linguistic. If the object is at a quasi-ontological meta-level, but the class is quasi-linguistic, then the function checks whether the object is a direct quasi-linguistic instance of the given class.- Parameters:
rObject
- a reference to an objectrClass
- a reference to a class- Returns:
- whether the given object is a direct instance of the given class.
On error,
false
is returned. - See Also:
isKindOf(long, long)
, on meta-levels
-
isKindOf
boolean isKindOf(long rObject, long rClass)
Checks whether the given object is a direct or indirect, quasi-ontological or quasi-linguistic, instance of the given class.
Note (M3): The function works also when one or both ofrObject
andrClass
is/are quasi-linguistic. If the object is at a quasi-ontological meta-level, but the class is quasi-linguistic, then the function checks whether the object is a quasi-linguistic instance of the given class or one of its subclasses.- Parameters:
rObject
- a reference to an objectrClass
- a reference to a class- Returns:
- whether the given object is a (direct or indirect) instance of the given class.
On error,
false
is returned. - See Also:
isTypeOf(long, long)
, on meta-levels
-
createAttribute
long createAttribute(long rClass, java.lang.String name, long rPrimitiveType)
Creates (defines) a new attribute for the given class. The default cardinality is the widest cardinality supported by the repository (e.g., "0..*", if multi-valued attributes are supported; or "0..1", otherwise). The cardinality can be looked up and changed by using the quasi-linguistic meta-metalevel.- Parameters:
rClass
- a reference to an existing class, for which to define the attributename
- the name of the attribute being created; it must be unique within all the attributes defined for this class, including derived onesrPrimitiveType
- a reference to a primitive data type for attribute values- Returns:
- a reference to the attribute just created, or 0 on error.
- See Also:
- on meta-levels
-
findAttribute
long findAttribute(long rClass, java.lang.String name)
Obtains a reference to an existing attribute with the given name of the given class.
Note (M3): The class reference may point also to a quasi-linguistic class.- Parameters:
rClass
- a reference to a class, where the attribute in question belongs;rClass
may be also one of its subclasses, since the attribute is available for subclasses, tooname
- the name of the attribute- Returns:
- a reference to the desired attribute, or 0 on error; the reference returned is the same reference for the class, for which the attribute was defined, as well as for derived classes.
- See Also:
- on meta-levels
-
deleteAttribute
boolean deleteAttribute(long rAttribute)
Deletes the given attribute.- Parameters:
rAttribute
- a reference to the attribute to be deleted- Returns:
- whether the operation succeeded.
-
getIteratorForAllAttributes
long getIteratorForAllAttributes(long rClass)
Obtains an iterator for all (including inherited) attributes of the given class.
Note (adapters): A repository adapter may implement only one of the functionsgetIteratorForAllAttributes
andgetIteratorForDirectAttributes
. The unimplemented function will be implemented via another by TDA Kernel.
Note (M3): The function works also for quasi-linguistic classes.- Parameters:
rClass
- a reference to a class, whose attributes we are interested in- Returns:
- an iterator for all attributes (including inherited) of the given class. On error, 0 is returned.
- See Also:
getIteratorForDirectAttributes(long)
, on iterators, on meta-levels
-
getIteratorForDirectAttributes
long getIteratorForDirectAttributes(long rClass)
Obtains an iterator for direct (without inherited) attributes of the given class.
Note (adapters): A repository adapter may implement only one of the functionsgetIteratorForAllAttributes
andgetIteratorForDirectAttributes
. The unimplemented function will be implemented via another by TDA Kernel.
Note (M3): The function works also for quasi-linguistic classes.- Parameters:
rClass
- a reference to a class, whose attributes we are interested in- Returns:
- an iterator for direct attributes of the given class. On error, 0 is returned.
- See Also:
getIteratorForAllAttributes(long)
, on iterators, on meta-levels
-
getAttributeName
java.lang.String getAttributeName(long rAttribute)
Returns the name of the given attribute.
Note (M3): The function works also for attributes of quasi-linguistic classes.- Parameters:
rAttribute
- a reference to the attribute in question- Returns:
- the name of the given attribute, or
null
on error. - See Also:
- on meta-levels
-
getAttributeDomain
long getAttributeDomain(long rAttribute)
Obtains a class, for which the given attribute was defined.
Note (M3): The function works also for attributes of quasi-linguistic classes.- Parameters:
rAttribute
- a reference to the attribute in question- Returns:
- a reference to a class, for which the given attribute belongs, or 0 on error.
- See Also:
- on meta-levels
-
getAttributeType
long getAttributeType(long rAttribute)
Returns the (primitive) type for values of the given attribute.
Note (M3): The function works also for attributes of quasi-linguistic classes.- Parameters:
rAttribute
- a reference to the attribute in question- Returns:
- a reference to a primitive data type for values of the given attribute.
- See Also:
- on meta-levels
-
isAttribute
boolean isAttribute(long r)
Checks whether the given reference is associated with an attribute.
Note (adapters): If a repository adapter does not implement this function, TDA Kernel will implement it by means ofgetAttributeDomain
,getAttributeName
andfindAttribute
.
Note (M3): A reference at Level M3 can also be passed.- Parameters:
r
- a reference in question- Returns:
- whether the given reference is associated with an attribute.
On error,
false
is returned. - See Also:
- on meta-levels
-
setAttributeValue
boolean setAttributeValue(long rObject, long rAttribute, java.lang.String value)
Sets the value or the ordered collection of values (encoded as a string) of the given attribute for the given object.
Note (adapters): Repository adapters may assume that the value is notnull
and not a string encodingnull
, since for those cases TDA Kernel forwards the call todeleteAttributeValue
.
Note (M3): The attribute reference can be a reference at the M3 level. In this case the object can be any element at the MΩ level.- Parameters:
rObject
- the object, for which to set the attribute value (values)rAttribute
- the attribute, for which to set the value; this attribute must be associated either with a quasi-ontological class or the quasi-linguistic class of the given objectvalue
- the attribute value (values) encoded as a string (use "." for the decimal point)- Returns:
- whether the value(s) has (have) been set.
On error,
false
is returned. - See Also:
- on encoding values, on meta-levels
-
getAttributeValue
java.lang.String getAttributeValue(long rObject, long rAttribute)
Gets the value or the ordered collection of values (encoded as a string) of the given attribute for the given object.
Note (M3): The attribute reference can be a reference at the M3 level.- Parameters:
rObject
- the object, for which to get the attribute value (values)rAttribute
- the attribute, for which to obtain the value; this attribute must be associated either with a quasi-ontological class or the quasi-linguistic class of the given object- Returns:
- the attribute value (values) encoded as a string
(for the decimal point the dot symbol "." is used), or
null
on error. - See Also:
- on encoding values, on meta-levels
-
deleteAttributeValue
boolean deleteAttributeValue(long rObject, long rAttribute)
Deletes the value (all the values) of the given attribute for the given object.
Note (M3): The attribute reference can be a reference at the M3 level. In this case the object can be any element at the MΩ level.- Parameters:
rObject
- the object, for which to get the attribute value (values)rAttribute
- the attribute, for which to obtain the value; this attribute must be associated either with a quasi-ontological class or the quasi-linguistic class of the given object- Returns:
- whether the operation succeeded.
- See Also:
- on encoding values, on meta-levels
-
getIteratorForObjectsByAttributeValue
long getIteratorForObjectsByAttributeValue(long rAttribute, java.lang.String value)
Obtains an iterator for objects, for whose the value of the given attribute equals to the given value. The value has to be encoded as a string (it may encode an ordered collection of multiple values).
Note (M3): The attribute reference can be a reference at the M3 level. In this case the objects traversed by the returned iterator are elements at the MΩ level.- Parameters:
rAttribute
- the attribute to checkvalue
- the value to check- Returns:
- the iterator for objects with the given attribute value, or 0 on error.
- See Also:
- on iterators, on encoding values, on meta-levels
-
createAssociation
long createAssociation(long rSourceClass, long rTargetClass, java.lang.String sourceRoleName, java.lang.String targetRoleName, boolean isComposition)
Creates a bidirectional association (or two directed associations, where each is an inverse of the other). The default value for the source and target cardinalities should be "*".
Note (M3): The M3 level can be used to get/set the cardinality, if the repository supports constraints and the M3 level operations. Cardinality constraints must be accessible via M3 for that.- Parameters:
rSourceClass
- the class, where the association startsrTargetClass
- the class, where the association endssourceRoleName
- the name of the association end near the source classtargetRoleName
- the name of the association end near the target classisComposition
- whether the association is a composition, i.e., the source class objects are containers for the target class objects- Returns:
- a reference for the target association end of the association just created, or 0 on error.
- See Also:
- on meta-levels
-
createDirectedAssociation
long createDirectedAssociation(long rSourceClass, long rTargetClass, java.lang.String targetRoleName, boolean isComposition)
Creates a directed association. The default value for the source and target cardinalities should be "*".
Note (adapters): If a repository adapter does not implement this function, TDA kernel will simulate it by means ofcreateAssociation
(a stub inverse role will be generated).
Note (M3): The M3 level can be used to get/set the cardinality, if the repository supports constraints and the M3 level operations. Cardinality constraints must be accessible via M3 for that.- Parameters:
rSourceClass
- the class, where the association startsrTargetClass
- the class, where the association endstargetRoleName
- the name of the association end near the target classisComposition
- whether the association is a composition, i.e., the source class objects are containers for the target class objects- Returns:
- a reference for the target association end of the association just created, or 0 on error.
- See Also:
- on meta-levels
-
createAdvancedAssociation
long createAdvancedAssociation(java.lang.String name, boolean nAry, boolean associationClass)
Creates an n-ary association, an association class, or an n-ary association class.
An advanced association behaves likes a class (although it might not be a class internally) with n bidirectional associations attached to it. To specify all n association ends, callcreateAssociation
n times, where a reference to the n-ary association has to be passed instead of one of the class references. N-ary association links can be created by means ofcreateObject
, and n-ary link ends can be created by callingcreateLink
n times and passing a reference to the n-ary link instead of one of the object references.
Note (adapters): The underlying repository is allowed to create an n-ary association class, even when nAry or associationClass isfalse
.
Note (adapters): If a repository adapter does not implement this function, TDA kernel will implement this function by introducing an additional class.
Note (M3): The M3 level can be used to get/set the cardinality, if the repository supports constraints and the M3 level operations. Cardinality constraints must be accessible via M3 for that.- Parameters:
name
- the name of the advanced association (the class name in case of an association class)nAry
- whether the association is an n-ary associationassociationClass
- whether the association is an association class- Returns:
- a reference to the n-ary association just created (not the association end, since no association ends are created yet), or 0 on error.
- See Also:
- on meta-levels, on advanced associations
-
findAssociationEnd
long findAssociationEnd(long rSourceClass, java.lang.String targetRoleName)
Obtains a reference to an association end (by its role name) starting at the given class.
Note (adapters): If not implemented in the adapter, TDA kernel will implement it by means ofgetIteratorForAllOutgoingAssociationEnds
.
Note (M3): The function works also, when searching for association ends at Level M3.- Parameters:
rSourceClass
- a class that is a source class for the association, or one of its subclassestargetRoleName
- a role name associated with the target association end- Returns:
- a reference to an association end corresponding to the given target role name.
- See Also:
- on meta-levels
-
deleteAssociation
boolean deleteAssociation(long rAssociationEndOrAdvancedAssociation)
Deletes the given association. Directed and bidirectional associations are specified by (one of) their ends. Advanced associations have their own references. If the association is bidirectional, the inverse association end is deleted as well. For advanced associations, all association parts are deleted.- Parameters:
rAssociationEndOrAdvancedAssociation
- a reference to an association end (if the association is directed or bidirectional) or a reference to an advanced association- Returns:
- whether the operation succeeded.
- See Also:
- on advanced associations
-
getIteratorForAllOutgoingAssociationEnds
long getIteratorForAllOutgoingAssociationEnds(long rClass)
Obtains an iterator for all (including inherited) outgoing association ends of the given class.
Note (adapters): A repository adapter may implement only one of the functionsgetIteratorForAllOutgoingAssociationEnds
andgetIteratorForDirectOutgoingAssociationEnds
. The unimplemented function will be implemented via another by TDA Kernel.
Note (M3): The function works also for associations at Level M3.- Parameters:
rClass
- a reference to a class, whose outgoing associations (including inherited) have to be traversed- Returns:
- an iterator for all (including inherited) outgoing association ends of the given class. On error, 0 is returned.
- See Also:
getIteratorForDirectOutgoingAssociationEnds(long)
, on iterators, on meta-levels
-
getIteratorForDirectOutgoingAssociationEnds
long getIteratorForDirectOutgoingAssociationEnds(long rClass)
Obtains an iterator for direct (without inherited) outgoing association ends of the given class.
Note (adapters): A repository adapter may implement only one of the functionsgetIteratorForAllOutgoingAssociationEnds
andgetIteratorForDirectOutgoingAssociationEnds
. The unimplemented function will be implemented via another by TDA Kernel.
Note (M3): The function works also for associations at Level M3.- Parameters:
rClass
- a reference to a class, whose direct outgoing associations have to be traversed- Returns:
- an iterator for direct (without inherited) outgoing association ends of the given class. On error, 0 is returned.
- See Also:
getIteratorForAllOutgoingAssociationEnds(long)
, on iterators, on meta-levels
-
getIteratorForAllIngoingAssociationEnds
long getIteratorForAllIngoingAssociationEnds(long rClass)
Obtains an iterator for all (including inherited) ingoing association ends of the given class.
Note (adapters): A repository adapter may implement only one of the functionsgetIteratorForAllIngoingAssociationEnds
andgetIteratorForDirectIngoingAssociationEnds
. The unimplemented function will be implemented via another by TDA Kernel.
Note (M3): The function works also for associations at Level M3.- Parameters:
rClass
- a reference to a class, whose ingoing associations (including inherited) have to be traversed- Returns:
- an iterator for all (including inherited) ingoing association ends of the given class. On error, 0 is returned.
- See Also:
getIteratorForDirectIngoingAssociationEnds(long)
, on iterators, on meta-levels
-
getIteratorForDirectIngoingAssociationEnds
long getIteratorForDirectIngoingAssociationEnds(long rClass)
Obtains an iterator for direct (without inherited) ingoing association ends of the given class.
Note (adapters): A repository adapter may implement only one of the functionsgetIteratorForAllIngoingAssociationEnds
andgetIteratorForDirectIngoingAssociationEnds
. The unimplemented function will be implemented via another by TDA Kernel.
Note (M3): The function works also for associations at Level M3.- Parameters:
rClass
- a reference to a class, whose direct ingoing associations have to be traversed- Returns:
- an iterator for direct (without inherited) ingoing association ends of the given class. On error, 0 is returned.
- See Also:
getIteratorForAllIngoingAssociationEnds(long)
, on iterators, on meta-levels
-
getInverseAssociationEnd
long getInverseAssociationEnd(long rAssociationEnd)
Obtains a reference to the inverse association end of the given association end (if association is bidirectional or a bidirectional part of an advanced association).
Note (M3): The function works also for association ends at Level M3.- Parameters:
rAssociationEnd
- a reference to a known association end, for which the inverse end has to be obtained- Returns:
- a reference to the inverse association end. On error or if the association end does not have the inverse, 0 is returned.
- See Also:
- on advanced associations, on meta-levels
-
getSourceClass
long getSourceClass(long rTargetAssociationEnd)
Obtains a reference to the source class of the given directed or bidirectional association (or part of an advanced association) specified by its target end. Any of the association ends can be considered a target end, when calling this function.- Parameters:
rTargetAssociationEnd
- an association end of some association; this association end will be considered a target end- Returns:
- a reference to the source class of the given association specified by its target end.
- See Also:
- on advanced associations
-
getTargetClass
long getTargetClass(long rTargetAssociationEnd)
Obtains a reference to the class corresponding to the given association end of some directed, bidirectional, or advanced association. For bidirectional and advanced associations, any of the two association ends can be considered a target end, when calling this function.- Parameters:
rTargetAssociationEnd
- an association end of some association; this association end will be considered a target end- Returns:
- a reference to the class corresponding to the given association end.
- See Also:
- on advanced associations
-
getRoleName
java.lang.String getRoleName(long rAssociationEnd)
Returns the role name of the given association end.- Parameters:
rAssociationEnd
- an association end of some directed, bidirectional, or advanced association- Returns:
- the role name of the given association end, or
null
on error. - See Also:
- on advanced associations
-
isComposition
boolean isComposition(long rTargetAssociationEnd)
Returns, whether the directed or bidirectional association (or a part of an advanced association) specified by its target association end is a composition (i.e., whether the source class objects are containers for the target class objects).
Note (M3): A reference at Level M3 can also be passed.- Parameters:
rTargetAssociationEnd
- an association end of some association; this association end will be considered a target end- Returns:
- whether the directed or bidirectional association (or a part of an advanced association) is a composition.
- See Also:
- on advanced associations, on meta-levels
-
isAdvancedAssociation
boolean isAdvancedAssociation(long r)
Checks, whether the given reference corresponds to an advanced association.
Note (M3): A reference at Level M3 can also be passed.- Parameters:
r
- a reference in question- Returns:
- whether the given reference corresponds to an advanced association.
On error,
false
is returned. - See Also:
- on advanced associations, on meta-levels
-
isAssociationEnd
boolean isAssociationEnd(long r)
Checks, whether the given reference corresponds to an association end.
Note (adapters): If not implemented in a repository adapter, TDA Kernel will implement it by means ofgetSourceClass
,getRoleName
andfindAssociationEnd
.
Note (M3): A reference at Level M3 can also be passed.- Parameters:
r
- a reference in question- Returns:
- whether the given reference corresponds to an association end.
On error,
false
is returned. - See Also:
- on advanced associations, on meta-levels
-
createLink
boolean createLink(long rSourceObject, long rTargetObject, long rAssociationEnd)
Creates a link of the given type (specified byrAssociationEnd
) between two objects.
Note (M3): An association end at Level M3 can also be passed. In this case, at least one of the source and target objects must be an element at the MΩ level. The semantics of such link then depends on a particular quasi-linguistic metamodel at Level M3.- Parameters:
rSourceObject
- a start object of the link; this object must be an instance of the source class for the given association endrTargetObject
- an end object of the link; this object must be an instance of the target class for the given association endrAssociationEnd
- a target association end that specifies the link type- Returns:
- whether the operation succeeded.
- See Also:
- on advanced associations, on meta-levels
-
createOrderedLink
boolean createOrderedLink(long rSourceObject, long rTargetObject, long rAssociationEnd, int targetPosition)
Creates a link of the given type (specified byrAssociationEnd
) between two objects at the given position. The target position normally should be from 0 to n, where n is the number of currently linked objects at positions from 0 to n-1. If the target position is outside [0..n], then the link is appended to the end.
Note (M3): An association end at Level M3 can also be passed. In this case, at least one of the source and target objects must be an element at the MΩ level. The semantics of such link then depends on a particular quasi-linguistic metamodel at Level M3.- Parameters:
rSourceObject
- a start object of the link; this object must be an instance of the source class for the given association endrTargetObject
- an end object of the link; this object must be an instance of the target class for the given association endrAssociationEnd
- a target association end that specifies the link typetargetPosition
- the position (starting from 0) of the target object in the list of linked objects of the source object;- Returns:
- whether the operation succeeded.
- See Also:
- on advanced associations, on meta-levels
-
deleteLink
boolean deleteLink(long rSourceObject, long rTargetObject, long rAssociationEnd)
Deletes a link of the given type (specified byrTargetAssociationEnd
) between the given two objects.
Note (M3): An association end at Level M3 can also be passed. In this case, at least one of the source and target objects must be an element at the MΩ level. The semantics of such link then depends on a particular quasi-linguistic metamodel at Level M3.- Parameters:
rSourceObject
- a start object of the link; this object must be an instance of the source class for the given association endrTargetObject
- an end object of the link; this object must be an instance of the target class for the given association endrAssociationEnd
- a target association end that specifies the link type- Returns:
- whether the operation succeeded.
- See Also:
- on advanced associations, on meta-levels
-
linkExists
boolean linkExists(long rSourceObject, long rTargetObject, long rAssociationEnd)
Checks whether the link of the given type (specified byrTargetAssociationEnd
) between the given two objects exists.
Note (adapters): If not implemented in a repository adapter, TDA Kernel will implement this function throughgetIteratorForLinkedObjects
.
Note (M3): An association end at Level M3 can also be passed. In this case, at least one of the source and target objects must be an element at the MΩ level. The semantics of such link then depends on a particular quasi-linguistic metamodel at Level M3.- Parameters:
rSourceObject
- a start object of the link; this object must be an instance of the source class for the given association endrTargetObject
- an end object of the link; this object must be an instance of the target class for the given association endrAssociationEnd
- a target association end that specifies the link type- Returns:
- whether the link exists. On error,
false
is returned. - See Also:
- on advanced associations, on meta-levels
-
getIteratorForLinkedObjects
long getIteratorForLinkedObjects(long rObject, long rAssociationEnd)
Returns an iterator for objects linked to the given start object by links of the given type.
Note (M3): The type of links may also be an association end at Level M3.- Parameters:
rObject
- a start object, for which the iterable objects are linked this object must be an instance of the source class for the given association endrAssociationEnd
- a target association end that specifies the type of links- Returns:
- an iterator for objects, linked to the given object by links of the given type, or 0 on error.
- See Also:
- on iterators, on advanced associations, on meta-levels
-
getLinkedObjectPosition
int getLinkedObjectPosition(long rSourceObject, long rTargetObject, long rAssociationEnd)
Returns the index (numeration starts from 0) of the target object in the list of objects linked to the source object by links of the given type.
Note (M3): The type of links may also be an association end at Level M3.- Parameters:
rSourceObject
- a source object; this object must be an instance of the source class for the given association endrTargetObject
- a target object; this object must be an instance of the target class for the given association endrAssociationEnd
- a target association end that specifies the type of links- Returns:
- the index (numeration starts from 0) of the given target object in the list of objects linked to the source object. On error or when the source and target objects are not linked by the given association, -1 is returned.
- See Also:
- on iterators, on advanced associations, on meta-levels
-
resolveIteratorFirst
long resolveIteratorFirst(long it)
Places the iterator to the position 0 and gets the element there.- Parameters:
it
- an iterator reference- Returns:
- the element at position 0 in the iterable list. If there are no elements or if an error occurred, 0 is returned.
- See Also:
resolveIteratorNext(long)
,freeIterator(long)
, on iterators
-
resolveIteratorNext
long resolveIteratorNext(long it)
Moves the iterator forward and gets the element at that position.- Parameters:
it
- an iterator reference- Returns:
- the element the iterator points to, after the iterator has been moved one step forward. If there are no elements or if an error occurred, 0 is returned.
- See Also:
resolveIteratorFirst(long)
,freeIterator(long)
, on iterators
-
getIteratorLength
int getIteratorLength(long it)
Places the iterator to the position 0 and returns the total number of elements to iterate through. CallresolveIteratorFirst
orresolveIterator
to move the iterator.
Note (adapters): If not implemented in a repository adapter, TDA Kernel traverses all the elements and stores them in a temporary list. Thus, the first call will take the linear execution time, while all subsequent calls will take the constant time. The same refers to theresolveIterator
function. If bothgetIteratorLength
andresolveIterator
are used, the temporary list is created only once.- Parameters:
it
- an iterator reference- Returns:
- the total number of elements to iterate through. On error returns 0 (thus, the return value still represents the number of iterations, which can be performed with this iterator).
- See Also:
resolveIterator(long, int)
,freeIterator(long)
, on iterators
-
resolveIterator
long resolveIterator(long it, int position)
Returns a reference to the element at the givenposition
(numeration starts from 0) and forwards the iterator toposition+1
.
Note (adapters): If not implemented in a repository adapter, TDA Kernel traverses all the elements and stores them in a temporary list. Thus, the first call will take the linear execution time, while all subsequent calls will take the constant time. The same refers to thegetIteratorLength
function. If bothgetIteratorLength
andresolveIterator
are used, the temporary list is created only once.- Parameters:
it
- an iterator referenceposition
- the position in the iterable list, where the interested element is located- Returns:
- a reference to the element at the given position, or 0 if the position is out of bounds, or if an error occurred.
- See Also:
getIteratorLength(long)
,freeIterator(long)
, on iterators
-
freeIterator
void freeIterator(long it)
Frees the memory associated with the given iterator reference.- Parameters:
it
- an iterator reference- See Also:
- on iterators
-
freeReference
void freeReference(long r)
Frees the memory associated with the given reference (if necessary).
-
serializeReference
java.lang.String serializeReference(long r)
Creates a string representation of the given reference, which survives the current session. For the next session, TDA kernel will use this string to get another reference to the same element by means ofdeserializeReference
. This is essential for storing inter-repository relations.- Parameters:
r
- the reference to serialize- Returns:
- a string representation of the given reference, which survives the current session, or
null
on error. - See Also:
deserializeReference(java.lang.String)
-
deserializeReference
long deserializeReference(java.lang.String r)
Obtains a reference to a serialized element from the given serialization. This is essential for loading inter-repository relations.- Parameters:
r
- the serialization of an element, for which to obtain a reference- Returns:
- a reference corresponding for the given serialization, or 0 on error.
- See Also:
serializeReference(long)
-
getIteratorForLinguisticClasses
long getIteratorForLinguisticClasses()
Returns an iterator for all quasi-linguistic classes at Level M3.
Note (M3): This function works only at Level M3.
- Returns:
- an iterator for all quasi-linguistic classes at Level M3.
- See Also:
- on meta-levels
-
getIteratorForDirectLinguisticInstances
long getIteratorForDirectLinguisticInstances(long rClass)
Returns an iterator for direct quasi-linguistic instances (not including instances of subclasses) at Level MΩ of the given class at Level M3.
Note (M3): This function takes a class at Level M3 and returns an iterator for elements at Level MΩ.- Parameters:
rClass
- a Level M3 class- Returns:
- an iterator for direct quasi-linguistic instances at Level MΩ of the given class at Level M3, or 0 on error.
- See Also:
- on meta-levels
-
getIteratorForAllLinguisticInstances
long getIteratorForAllLinguisticInstances(long rClass)
Returns an iterator for all quasi-linguistic instances (including instances of subclasses) at Level MΩ of the given class at Level M3.
Note (M3): This function takes a class at Level M3 and returns an iterator for elements at Level MΩ.- Parameters:
rClass
- a Level M3 class- Returns:
- an iterator for direct quasi-linguistic instances at Level MΩ of the given class (and its subclasses) at Level M3, or 0 on error.
- See Also:
- on meta-levels
-
getLinguisticClassFor
long getLinguisticClassFor(long r)
Returns a reference to the Level M3 class of the given quasi-ontological (Level MΩ) element. It is assumed that there may be at most one quasi-linguistic class at M3 for each quasi-ontological element at MΩ.- Parameters:
r
- a quasi-ontological (Level MΩ) element- Returns:
- a reference to the Level M3 class of the given quasi-ontological (Level MΩ) element. On error or if M3 is not supported by the underlying repository, 0 is returned.
- See Also:
- on meta-levels
-
isLinguistic
boolean isLinguistic(long r)
Checks, whether the given reference is associated with a Level M3 element. Can be used together withisClass
,isAssociationEnd
, etc. to get more details about the element.- Parameters:
r
- a reference in question- Returns:
- whether the given reference is associated with a Level M3 element.
On error,
false
is returned. - See Also:
- on meta-levels
-
callSpecificOperation
java.lang.String callSpecificOperation(java.lang.String operationName, java.lang.String arguments)
Calls a repository-specific operation (e.g., or MOF/ECore-like operation, an SQL statement, or a SPARQL statement). Arguments (if any) are encoded as a string delimited by means of the Unicode character U+001E (INFORMATION SEPARATOR TWO). For no-argument methodsarguments
must benull
.
For instance, a repository may accept the following calls:callSpecificOperation("SQL", "SELECT * FROM MY TABLE");
callSpecificOperation("myMethod", "[object-reference][u001E][argument1]...");
callSpecificOperation("", null);
For static MOF/ECore-like operations, the first argument should point to a class. For non-static operations the first argument should point to an object (that resemblesthis
pointer in Java).- Parameters:
operationName
- a repository-specific operation namearguments
- operation-specific arguments encoded as a string- Returns:
- the return value of the call encoded as a string, or
null
on error. - See Also:
- on encoding values
-
-