This document specifies the SCA's performative interface, and the languages for describing agent services. The performative interface includes functions to facilitate sending and receiving messages within the UMDL society of agents. The languages for describing services are very expressive, and are therefore relatively complex compared to performatives. They have a Lisp-like flavor, and use symbols from the UMDL ontology and the Loom description logic system. The languages for classifications and queries are similar, but distinct. Service descriptions fit into the :content field of the UMDL performatives used to request a classification or query.
Contents Performative Interface Classification Queries Service Description Languages Classification Loom Grammar Queries Loom Grammar SCA Predicates SCA Wrappers
The SCA is packaged with a library of interface functions. Include the header file sca.interface.H in source which sends or receives messages to/from the SCA, and link using the library libsca.interface.a.
Some developers may prefer to forego use of the convenient functions in the sca.interface library. Because the KQML philosophy calls for KQML to be a level of common language understood by all participating agents, we don't treat the interface library as an inviolable package. Instead, this document describes the internal KQML structure as well as the packaged interface functions.
void addSCAClassifyInfo ( const char* requested_label, const char* service_description, const char* reply_with, PerfArg &pa);
The requested-label will be the name the classifier associates with the service-description, except under either of these conditions:
Then use send_tell() to send a performative to the SCA with the PerfArg pa as the argument.
Internal KQML. The :content field of the PerfArg should be a PerfArg with :name requested-label, and :description service-description.
PerfArgValue getSCAServiceLabel(const PerfArg& pa);An empty PerfArgValue is returned if there is no label (which should never happen).
Use recv_error() for when the service description is not successfully classified. To extract an explanation of the error use:
PerfArgValue getSCAErrorMessage(const PerfArg& pa);An empty PerfArgValue is returned if there is no message.
Internal KQML. The recommended service label, or the error message, is found in the :content field of the PerfArg.
void addSCAQueryInfo ( const char* variables, const char* service_description, const char* reply_with, PerfArg &pa);The variables argument must be a list of variables referenced within the query service-description (see Service Description Language for Queries). The reply_with identifier will be returned in the :reply-to field of the reply performative. Then use send_ask_about() to send the performative to the SCA with pa as both arguments.
Internal KQML. The :content field of the PerfArg should be a PerfArg with :variables variables, and :description service-description.
int getSCANumBindingSets(const PerfArg& pa);Use the following function to extract a value bound to some variable in a particular answer (binding_set).
PerfArgValue getSCABinding ( const PerfArg& pa, int binding_set, const char* variable);Binding sets are indexed starting with 0. If the binding set or variable doesn't exist the function returns an empty PerfArgValue.
Internal KQML. An error message is found in the :content field of the PerfArg. For successful queries, the PerfArg's content field contains a PerfArg which is a list of PerfArgs, each one of which has a slot for each variable. For example, if two binding sets are returned, and the variable list was (?x ?y), the reply PerfArg would have the following structure:
Reply Binding set Perfarg label PerfArg label Variable label Value ------------- ------------- -------------- ----- :content 0 ?x x1 ?y y1 1 ?x x2 ?y x3
Examples:
task-planning-for-schools
BOOK_DELIVERY
The following example of a service description is typical. It is a conjunctive expression in which the first phrase identifies the kind of service that will be provided, and following phrases add detail by specifying the values of attributes associated with the service concept.
Example:
(:and recommend-dlcollection
Loom retrieval operates on instances, not concepts. The SCA therefore asserts service descriptions to be instances as well as concepts. It also asserts that each role is filled by a "generic instance" of the value restriction. For example, the service defined just above is instantiated as an instance with an audience that is an instance of the middle-school concept. This permits retrieval of services for middle-schools. In short, for most purposes SCA clients do not need to worry about Loom's internal distinction between concepts and instances.
concept-expr ::= ConceptName | ( {:AND | :OR} concept-expr+ ) | ( :ONE-OF {Number+ | InstanceId+} ) | ( :THROUGH Number Number ) | ( {:AT-LEAST | :AT-MOST | :EXACTLY} Integer relation-expr ) | ( {:ALL | :SOME | :THE} relation-expr ConceptName ) | ( {:FILLED-BY | :NOT-FILLED-BY} relation-expr {InstanceId | Constant}+ ) | ( {:SAME-AS | :SUBSET} relation-expr relation-expr ) | ( {< | > | <= | >= | = | <>} relation-expr {relation-expr | Number} ) | ( :RELATES relation-expr relation-expr {relation-expr | Constant} ) | ( :SATISFIES ( ?Var ) query-expr ) | set-expr ;The concept-forming operators have the following semantics:
Example:
(?service ?topic)
Predicates are Lisp functions which are either true or false for every combination of bindings considered by the query. Wrappers, in comparison, are not invoked for every possible set of bindings, but are invoked only once for the entire query. In other words, whereas predicates are inside of Loom queries, wrappers are outside the Loom query. Thus, the :wrapper keyword can be used only once in a service description, and it must be the first element of the list. Since predicates and wrappers are functions, these symbols must be preceded by the Lisp prefix #'. Symbols in the remainder of :predcall phrases are arguments to the predicate or wrapper function, and so are defined by the syntax of the function. Typically they must be preceded by the Lisp quote symbol '.
Examples: (:and (recommend-dlcollection ?service) (recommend-dlcollection.has.audience ?service middle-school) (recommend-dlcollection.has.topic ?service ?topic)) (:and (recommend-dlcollection ?service) (recommend-dlcollection.has.audience ?service middle-school) (:predcall #'same-filler-or-none ?service 'recommend-dlcollection.has.topic 'science)) (:wrapper #'most-specific '(:and (recommend-dlcollection ?service) (recommend-dlcollection.has.audience ?service ?audience) (school ?audience)) '((middle-school ?audience)))
query-expr ::= ( {:AND | :OR} query-expr+ ) | ( {:NOT | :FAIL} query-expr ) | ( :IMPLIES query-expr query-expr ) | ( {:FOR-SOME | :FOR-ALL} ( ?Var+ ) query-expr ) | ( :COLLECT ( ?Var ) query-expr ) | ( concept instance ) | ( relation instance+ value ) | ( :SAME-AS instance instance ) | ( :SUBSET instance instance ) | ( :PREDCALL LispPredicate value+ ) | ( :ABOUT instance about-clause* )
about-clause ::= concept | ( concept ) | ( relation value ) | ( :FILLED-BY relation value+ ) | ( {:AT-LEAST | :AT-MOST | :EXACTLY} Integer relation ) | ( {:ALL | :SOME | :THE} relation concept )The query-expression operators have the following semantics:
Accepts a set of bindings if the slot-relation filler for the concept-instance is the same as filler-value, or if the slot is not filled with another value.
Example: (:and (recommend-dlcollection ?service) (:predcall #'same-filler-or-none ?service 'recommend-dlcollection.has.topic 'science))
In this example the concept instance ?service is accepted if the recommend-dlcollection.has.topic slot is filled with the value science, or is not filled at all.
Accepts a set of bindings if concept-instance has no filler for any slot whose relation is not in slot-relations-list,
Example: (:and (recommend-dlcollection ?service) (:predcall #'only-expected-fillers ?service '(recommend-dlcollection.has.topic recommend-dlcollection.has.conceptual-level)))
In this example the concept instance ?service is accepted if no slot besides recommend-dlcollection.has.topic is filled.
Currently the following wrapper functions are available:
These wrapper functions return services that are increasingly general (subsume) or increasingly specific (subsumed by) the start-from-service. These are each bound to the first variable in the variables list. The returned list does not include the start-from-service. Subsumption is a partial order, and the relative location of services that do not subsume each other is undetermined. The end-with-service argument is the most general service that will be included in the list. If other services are equivalently general, they may be omitted.
Example: (?service) (:wrapper #'increasingly-general 'tpa1 'recommend-dlcollection)
This wrapper function returns a definition of a concept that would subsume each of the concepts included in list-of-services. If desired, this definition can then be classified. The new definition is for the least-common-subsuming concept subject to a language restriction. Since Loom's concept language includes OR, the unrestricted least-common-subsuming concept would be the (uninteresting) disjunction of the input concepts. Only elements of concept definitions that fit the following form are considered:
{ (and [direct superconcepts]* [(ALL relation value-restrictions)]* }
We define the inclusive concept, which may be new, as having:
1. The intersection of superconcepts.
2. Only roles with relations shared by all.
3. The intersection of role value restriction superconcepts.
For an algorithm with a language bias that permits equality constraints, see Cohen and Hirsh in Machine Learning 17 (1994).
Example: (?new-def) (:wrapper #'define-inclusive-concept '(tpa1 tpa2 tpa3))
These wrapper functions permit fine tuning to find increasingly general or specific services, in cases where the attributes of interest are known. They find sets of bindings that satisfy the hard-constraints-query-expression, and rank them according to how well they satisfy the list of soft constraints. Use a typical query expression as the hard constraint to identify any agent service that would be satisfactory. Then use the soft constraints to identify an agent service that would be ideal.
Each element of soft-constraints-list must be of the form (concept variable). The set of bindings returned is that which is closest to satisfying the constraints. The semantic distance with respect to specificity or generality is measured by the path distance in the taxonomy between the preferred concept and the actual filler.
If some soft constraints are more important than others, the priorities-list argument can be used to weight the relative impact of each soft constraint. The priorities-list should have the same length as the soft-constraints-list, and must contain numeric values. Only their relative value is important. The default priority weight for any soft constraint for which it is not specified is 1.
Because some areas of the ontology may be more densely developed than others, it may be desirable to fine-tune the multiplicative factor with which concept generality/specificity is penalized for each step of inheritance in the ontology. The attenuation-factors-list should have the same length as the soft-constraints-list, and should contain numeric values in the interval (0, 1). The default attenuation factor for any soft constraint for which it is not specified is currently 0.7.
Example: (?service ?audience ?topic) (:wrapper #'most-specific-subsuming '(:and (recommend-dlcollection ?service) (recommend-dlcollection.has.audience ?service ?audience) (school ?audience) (recommend-dlcollection.has.topic ?service ?topic) (science ?topic)) '((middle-school ?audience) (earth-science ?topic)) :priorities '(2 1) :attenuation-factors '(0.6 0.8))
In this example the hard constraint query selects only recommend-dlcollection services for audiences which are schools, and whose topic is science. Then, candidates are ranked according to how specific their audience is to middle-school, and how specific their topic is to earth-science. The audience constraint is considered to be twice as important as the topic constraint (within the limits set by the hard constraint). Also, because (hypothetically) the ontology differentiates topics more densely than audiences, the topic constraint is penalized less for each required inheritance link than is the audience constraint.