SIS - Application Programmatic Interface, Reference Manual - ICS ...
SIS - Application Programmatic Interface, Reference Manual - ICS ...
SIS - Application Programmatic Interface, Reference Manual - ICS ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>SIS</strong>-<strong>Application</strong> <strong>Programmatic</strong> <strong>Interface</strong>, <strong>Reference</strong> <strong>Manual</strong><br />
3 Functionality of the query and update<br />
functions<br />
The answer to most of the queries on an object is a set of objects, that is the query for<br />
the instances of an object A is a set of all the objects that are instances of object A, the<br />
query for the superclasses of an object B is a set of all the objects that are superclasses<br />
of object B etc. So, for most queries, there is an object that the query applies on and<br />
an answer set, the result of the query.<br />
In order to avoid long traffic through the sockets, those functions, which should return<br />
a set of answers, operate like this: When called, they calculate the answer and locate it<br />
into an answer set. The return value is APIFail(-1) if the query failed or a positive<br />
integer on success. This positive integer is the identifier of the answer set (hereafter<br />
will also be called temporary set). Most of these queries take as argument an integer,<br />
which specifies the object where the query is going to apply on. If this argument is 0<br />
the query is applied on the current node otherwise it is applied on each object in the<br />
answer set with identifier the one passed as argument.<br />
Before calling a query function asking to apply on the current node, an object must be<br />
set as current node with the set_current_node() or set_current_node_id() function.<br />
With the use of temporary set at the server site, the client doesn't get the answer<br />
immediately but only when this is asked explicitly with some other function. This<br />
gives the possibility for the querying functions to apply on to the objects that exist<br />
into a temporary set. The answer is calculated by the server and then located into<br />
another temporary set and the identifier of this new set is returned. With this<br />
possibility the client doesn't have to get intermediate results, which can reside at the<br />
server site for further processing.<br />
4 Name stack<br />
At the beginning of a query session there is no current node. Before calling any<br />
querying function, a current node must have been set.<br />
In TELOS language, links are objects themselves and may have their own links, so<br />
there is the possibility to set as current node a link object but since the logical names<br />
of the attributes of a class are unique for the class but not for the whole <strong>SIS</strong> base (two<br />
different classes may have attributes with the same logical name) there is a name<br />
scope problem with the set_current_node() function.<br />
For this reason an object stack is maintained. At the beginning of a query the stack is<br />
empty. When the stack is empty the call of set_current_node() function must have as<br />
argument the logical name of a node object (the name scope is the whole <strong>SIS</strong> base)<br />
and then this object is pushed onto the stack (at the top). Any subsequent call of<br />
set_current_node() function has as name scope the current node, that is the object at<br />
the top of stack. So it has to have as argument the logical name of a link of the current<br />
node and this link object is pushed onto the stack.<br />
With this mechanism the stack is either empty or contains objects where the first (at<br />
the bottom) is a class object and the others are link objects and each of them is<br />
attribute of the object located one level below on the stack.<br />
August 2002/v2.2.2 -7- <strong>ICS</strong>-FORTH