Package jason.stdlib
Class add_annot
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.add_annot
- All Implemented Interfaces:
InternalAction
,Serializable
@Manual(literal=".add_annot(belief,annotation,result)",
hint="adds an annotation to a literal",
argsHint={"the literal where the annotation is to be added","the annotation","the resulting unification of the annotation addition"},
argsType={"literal or list","atom","literal or list"},
examples={".add_annot(a,source(jomi),B): B unifies with a[source(jomi)]",".add_annot(a,source(jomi),b[jomi]): fails because the result of the addition does not unify with the third argument",".add_annot([a1,a2], source(jomi), B): B unifies with [a1[source(jomi)], a2[source(jomi)]]"},
seeAlso="jason.stdlib.add_nested_source")
public class add_annot
extends DefaultInternalAction
Internal action: .add_annot
.
Description: adds an annotation to a literal.
Parameters:
- + belief(s) (literal or list): the literal where the annotation
is to be added. If this parameter is a list, all literals in the list
will have the annotation added.
- + annotation (structure): the annotation.
- +/- annotated beliefs(s) (literal or list): this argument
unifies with the result of the annotation addition.
Examples:
-
.add_annot(a,source(jomi),B)
:B
unifies witha[source(jomi)]
. -
.add_annot(a,source(jomi),b[jomi])
: fails because the result of the addition does not unify with the third argument. -
.add_annot([a1,a2], source(jomi), B)
:B
unifies with[a1[source(jomi)], a2[source(jomi)]]
.
Note: instead of using this internal action, you can use
direct unification.
.add_annot(a,source(jomi),B)
can
be replaced by B = a[source(jomi)]
;
.add_annot(X,source(jomi),B)
can be replaced by B =
X[source(jomi)]
.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Term
addAnnotToList
(Unifier unif, Term l, Term annot) static InternalAction
create()
execute
(TransitionSystem ts, Unifier un, Term[] args) Executes the internal action.int
int
Methods inherited from class jason.asSemantics.DefaultInternalAction
canBeUsedInContext, checkArguments, destroy, prepareArguments, suspendIntention
-
Constructor Details
-
add_annot
public add_annot()
-
-
Method Details
-
create
-
getMinArgs
public int getMinArgs()- Overrides:
getMinArgs
in classDefaultInternalAction
-
getMaxArgs
public int getMaxArgs()- Overrides:
getMaxArgs
in classDefaultInternalAction
-
execute
Description copied from interface:InternalAction
Executes the internal action. It should return a Boolean or an Iterator. A true boolean return means that the IA was successfully executed. An Iterator result means that there is more than one answer for this IA (e.g. see member internal action). - Specified by:
execute
in interfaceInternalAction
- Overrides:
execute
in classDefaultInternalAction
- Throws:
Exception
-
addAnnotToList
- Throws:
JasonException
-