Previous Up Next

Appendix E  Predefined Query Classes

This chapter gives an overview of the query classes which are predefined in a standard ConceptBase installation. The names of parameters of the queries are set in typewriter font. Most of the queries listed here are used by the ConceptBase user interface CBIva to interaction with the CBserver. A normal user typically formulates queries herself. In fact, most queries listed below are very simple and directly representation as query class. An exception are the functions for computation and counting. They cannot be expressed by simple query classes but extend the expressiveness of the system.

E.1  Query classes and generic query classes

These queries can also be used in the constraints of other queries.

E.1.1  Instances and classes

ISINSTANCE:
Checks whether obj is instance of class. The result is either TRUE or FALSE.
IS_EXPLICIT_INSTANCE:
Same as before, but returns TRUE only if obj is an explicit instance of class.
find_classes:
Lists all objects of which objname is an instance.
find_instances:
Lists all instances (implicit and explicit) of class.
find_explicit_instances:
Same as before, but only explicit instances are returned.

E.1.2  Specializations and generalizations

ISSUBCLASS:
Checks whether sub is subclass of super. The result is either TRUE or FALSE.
IS_EXPLICIT_SUBCLASS:
Same as before, but returns TRUE only if sub is an explicit subclass of super.
find_specializations:
Lists the subclasses of class. If ded is TRUE, then the result will also include implicit subclasses, if ded is FALSE only explicit information will be included.
find_specializations:
Same as before, but for super classes.

E.1.3  Attributes

IS_ATTRIBUTE_OF:
Returns TRUE if src has an attribute of the category attrCat which has the value dst.
IS_EXPLICIT_ATTRIBUTE_OF:
Same as before, but only for explicit attributes.
find_all_explicit_attribute_values:
Lists all attribute values of objname that are explicitely defined.
find_iattributes:
Lists the attributes that go into class.
find_referring_objects:
Lists the objects that have an explicit attribute link to class.
find_referring_objects2:
Lists the objects that have an explicit attribute link to objname and for which the attribute link is an instance of cat.
find_all_referring_objects2:
Same as before, but including implicit attributes.
find_attribute_categories:
Lists all the attribute categories that may be used for objname. This is a lookup of all attributes of all classes of objname.
find_incoming_attribute_categories:
In contrast to the previous query, this query returns all attribute categories that go into objname (i.e. attribute categories for which objname can be used as an attribute value).
find_attribute_values:
Lists all objects that are attribute values of objname in the attribute category cat.
find_explicit_attribute_values:
Same as before, but only for explicit attributes.

E.1.4  Links between objects

find_incoming_links:
Lists the links that go into objname and are instance of category. Note that all types of links are returned, including attributes, instance-of-links and specialization links.
find_incoming_links_simple:
Same as before, but without the parameter category.
find_outgoing_links:
Lists the links that come out of objname and are instance of category. Note that all types of links are returned, including attributes, instance-of-links and specialization links.
find_outgoing_links_simple:
Same as before, but without the parameter category.
get_links2:
Return the links between src and dst.
get_links3:
Return the links between src and dst that are instance of cat.

E.1.5  Other queries

find_object:
This query just returns the object given as parameter objname, if it exists. Thus it can be used to check whether objname exists, but there is a builtin query exists which does the same. The query is mainly useful in combination with a user-defined answer format (e.g. the Graph Editor is using this query to retrieve the graphical representation of the object).
AvailableVersions:
Lists the instances of Version with the time since when they are know. This query is used by the user interface to use a different rollback time (Options → Select Version).
listModule:
Lists the the content of a module as Telos frames, see also section 5.8.

E.2  Functions

Functions may also be used within other queries. You may define your own functions (see section 2.5).

E.2.1  Computation and counting

COUNT:
counts the instances of a class, this may be also a query class
SUM:
computes the sum of the instances of a class (must be reals or integers)
AVG:
computes the average of the instances of a class (must be reals or integers)
MAX:
gives the maximum of the instances of a class (wrt. the order of < and >, see section 2.2)
MIN:
gives the minimum of the instances of a class (wrt. the order of < and >, see section 2.2)
COUNT_Attribute:
counts the attributes in the specified category of an object
SUM_Attribute:
computes the sum of the attributes in the specified category of an object (must be reals or integers)
AVG_Attribute:
computes the average of the attributes in the specified category of an object (must be reals or integers)
MAX_Attribute:
gives the maximum of the attributes in the specified category of an object (wrt. the order of < and >, see section 2.2)
MIN_Attribute:
gives the minimum of the attributes in the specified category of an object (wrt. the order of < and >, see section 2.2)
PLUS:
computes the sum of two reals or integers
MINUS:
computes the difference of two reals or integers
MULT:
computes the product of two reals or integers
DIV:
computes the quotient of two reals or integers
IPLUS:
computes the sum of two integers; result is an integer number
IMINUS:
computes the difference of two integers; result is an integer number
IMULT:
computes the product of two integers; result is an integer number
IDIV:
computes the quotient of two integers and then truncates the quotient to the largest integer number smaller than or equal to the quotient

ConceptBase realizes the arithmetic functions via its host Prolog system SWI-Prolog. Integer numbers on Linux are represented as 64-bit numbers, yielding a maximum range from −264−1 to 264−1. SWI-Prolog supports by default under Windows and Linux64 arbitrarily long integers. Real numbers are implemented by SWI-Prolog as 64-bit double precision floating point numbers. ConceptBase uses 12 decimal digits.

E.2.2  String manipulation

ConcatenateStrings:
concatenates two labels, typically strings; the two arguments can be expressions that are concatenated after their evaluation
ConcatenateStrings3:
concatenates three labels; arguments may not be expressions
ConcatenateStrings4:
concatenates four labels; arguments may not be expressions
concat:
same as ConcatenateStrings
StringToLabel:
removes the quotes of a string and returns it as a label (not an object), useful if labels should be passed as a parameter of a query
toLabel:
evaluates the argument and that creates an individual object with the canonical representation of the argument result; the canonical representation is an alphanumeric where special characters are replaces by substrings like "C30_" for special characters

For example, the expression toLabel(concat("*",1+2)) will return C42_3. The substring "C42_" is the canonical representation (ASCII number) of "*". The subexpression 1+2 is evaluated to 3.

E.3  Builtin query classes

These queries must not be used within other queries as they do not return a list of objects. They may only be used directly from client programs.

exists:
Checks whether objname exists and returns yes or no.
get_object:
Returns the frame representation of objname. This query may be either called with just one parameter (objname) or with four parameters (objname, dedIn, dedIsa, dedWith). The ded*-parameters are boolean flags that indicate whether implicit (deduced) information should also be included in the frame representation. Note that the order of the parameters hast to be the same as listed above.
get_object_star:
Returns the frame representation for all objects with a label that match the given wildcard expression. Only simple wildcards with a star (*) at the end are allowed.
rename:
Renames an object from oldname to newname. This is a low-level operation directly on the symbol table that works directly on the symbol table. It only checks whether newname is not already used as label for a different object, no other consistency checks are performed. The parameters have to be given in the order newname, oldname.

Previous Up Next