ConceptBase has some limited capabilities to form complex expressions from generic query classes. The idea is to combine them like complex function class, e.g. f(g(x),h(y)). The difference is however that queries stand for predicates and the complex query calls are thus formally ouside first order logic and consequently outside Datalog. Still, the feature is so useful that we provide it. A complex query call is like an ordinary parameterized query call except that the parameters can themselves be query calls. For example, COUNT[What_SI_Manager[10000/salary]/class] counts the instances of a parameterized query call.
Syntactically, query calls can be arbitrarily deep, e.g.
Union[Intersec[EmpMinSal[800/minsal]/X,
EmpMaxSal[1400/maxsal]/Y]/X,
Integer/Y]
ConceptBase does perform the usual type check on the parameters by analyzing the instantiation of the core class of a query call. For example, the core class of EmpMinSal[800/minsal] is EmpMinSal. Thus, ConceptBase will check whether EmpMinSal is an instance of the class expected for the parameter X.
Complex query calls can also occur in formulas and lead to a new expressiveness:
QueryClass EmployeeWith2RichCoworkers isA Employee with
constraint
c2: $ exists i/Integer
(i in COUNT[RichCoworker[~this/worker]/class])
and (i = 2)$
end