Package jason.stdlib
package jason.stdlib
Internal actions of Jason.
BDI
desire
: check agent's desires.drop_desire
: remove one agent's desire.drop_all_desires
: remove agent's desires.intend
: check agent's intentions.drop_intention
: remove one agent's intention.drop_all_intentions
: remove all agent's intentions.intention
: get details of the state of Jason intentions.succeed_goal
: abort some goal with success.fail_goal
: abort some goal with failure.drop_event
: remove one event.drop_all_events
: remove events in the interpreter.suspend
: suspend intentions.resume
: resume suspended intentions.suspended
: check agent's suspended goals.
Belief base
abolish
: removes some beliefs.belief
: consults some beliefs.findall
: finds all answers for a query.setof
: finds a set of answers for a query.count
: counts the number of solutions of some query.namespace
: checks whether the argument is a name space.relevant_rules
: gets a list of rules.list_rules
: prints out the rules in the current belief base.
Plan Library
add_plan
: add new plans.remove_plan
: remove a plan.plan_label
: get the label of a plan.relevant_plans
: get a list of plans.relevant_plan
: backtracking based version of .relevant_plans.list_plans
: print out the plans in the current plan library.
Communication
send
: send messages.broadcast
: broadcast messages.my_name
: get the agent's name.all_names
: get the names of all agents in the system.df_register
: register a service in the Directory Facilitator.df_deregister
: removes a service in the Directory Facilitator.df_search
: search for a service in the Directory Facilitator.df_subscribe
: subscribe for new providers of a service in the Directory Facilitator.
Lists, Sets and other collections
member
: list members.length
: size of lists.empty
: check whether the list is empty.concat
: concat lists.delete
: delete members of a lists.reverse
: reverse lists.shuffle
: shuffle the elements of a list.nth
: nth element of a lists.max
: maximum value of a lists.min
: minimum value of a lists.sort
: sort lists.list
: check whether an argument is a list.suffix
: suffixes of a list.prefix
: prefixes of a list.sublist
: sublists of a list.difference
: difference of sets.intersection
: intersection of sets.union
: union of sets.
Java Sets
Java Sets can be manipulated in Jason by some internal actions (these sets are represented by a variable). Example:.set.create(S); // S = {} .set.add(S,a); // S = {a} .set.add_all(S,[5,b,p(2),a]); // S = {5,a,b,p(2)} .set.remove(S,b); // S = {5,a,p(2)} .set.union(S,[a,1]); // S = {1,5,a,p(2)} .length(S,X); // X = 4 .type(S,T); // T = set .set.difference(S,[1,a]); // S = {5,p(2)} .findall(K, .member(K,S), LL) // LL = [5,p(2)] .set.add(S,5); .set.intersection(S,V); // S = {5} for ( .member(V,S) ) { // iteration .print(K,V); }. .set.clear(S); // S = {}Java Queues
Java Queues can be manipulated in Jason by some internal actions (these queues are represented by a variable). Example:.queue.create(Q); // Q = [] .queue.add(Q,a); // Q = [a] .queue.add(Q,b); // Q = [a, b] .queue.add_all(Q,[c,d,e]); // Q = [a, b, c, d, e] .queue.head(Q,H); // H = a .queue.remove(Q,H); // H = a, Q = [b, c, d, e] .length(Q,X); // X = 4 .type(Q,T); // T = queue for ( .member(V,Q) ) { // iteration .print(V); }. .queue.clear(Q); .queue.create(Q,priority); // Q = [] queue with priority (the queue is kept sorted) .queue.add(Q,d); // Q = [d] .queue.add(Q,c); // Q = [c, d] .queue.add_all(Q,[b,d,a]); // Q = [a, b, c, d, e] .queue.head(Q,H); // H = aJava Maps
Java Maps can be manipulated in Jason by some internal actions (these maps are represented by a variable). Example:.map.create(M); // M = {} .map.put(M,a,10); // M = {a->10} .map.put(M,b,ok); // M = {a->10, b->ok} .map.put(M,a,20); // M = {a->20, b->ok} .length(M,X); // X = 2 .type(M,T); // T = map .map.key(M,a) // true .map.key(M,V) // unifies V with all keys of M .map.value(M,10) // true .map.value(M,V) // unifies V with all values of M .findall(K, .map.key(M,K), LL) // LL = [a,b] .findall(V, .map.value(M,V), LL) // LL = [20,ok] .findall([K,V], .map.key(M,K) invalid input: '&' .map.get(M,K,V), LL) // LL = [[a,30],[d,ok(3)]] .map.get(M,a,V); // V = 20 .map.get(M,c,V); // fail .map.get(M,c,V,0); // V = 0 .map.remove(M,a,V); // M = {b->ok} V = 20 for ( .map.key(M,K) invalid input: '&' .map.get(M,K,V) ) { // iteration .print(K,V); }. .map.clear(M); // M = {}
String
length
: size of strings.concat
: append strings.delete
: delete characters of a string.reverse
: reverse strings.nth
: nth element of a string.substring
: test substrings of strings.string
: check whether an argument is a string.suffix
: suffixes of a string.prefix
: prefixes of a string.term2string
: convert terms to strings and vice-versa.lower_case
: lower case strings.upper_case
: upper case strings.replace
: replace strings.
Execution control
Meta programming
atom
: check whether an argument is an atom (p).structure
: check whether an argument is a structure (p(t1,t2), [a,b]).literal
: check whether an argument is a literal (p(t1,t2), ~p(t1,t2), p(t1,t2)[a1,a2]).list
: check whether an argument is a list ([a,b]).ground
: check whether an argument is ground.number
: check whether an argument is a number (1, 2.3).string
: check whether an argument is a string ("s").type
: gets the type of a term.add_nested_source
: add a source in a literal.eval
: evaluates a logical expression.
Miscellaneous
at
: add a future event.wait
: wait some event.create_agent
: create a new agent.save_agent
: store the beliefs and plans into a file.create_agent
: create a new agent.kill_agent
: kill an agent.clone
: clone an agent.stopMAS
: stop all agents.version
: gets the Jason version.date
: get the current date.time
: get the current time.fail
: an action that always fails.perceive
: force perception.range
: backtrack values in a range (used in for).random
: produces random numbers.math.set_random_seed
: sets the seed of Jason's random number generator.include
: imports a source code at run time.printf
: formated print.
-
ClassDescriptionInternal action:
.abolish
.Internal action:.add_annot
.Internal action:.add_nested_source
.Internal action:.add_plan
.Internal action:.all_names
.Internal action:.asserta
.Internal action:.assertz
.Internal action:.at
.Internal action:.atom
.Internal action:.belief(Bel)
.Internal action:.broadcast
.Internal action:.concat
.Internal action:.count
.Internal action:.create_agent
.Internal action:.current_intention
.Internal action:.date(YY,MM,DD)
.Internal action:.delete
.Internal action:.desire(D, [ I ])
.Internal action:.df_deregister(S [,T])
.Internal action:.df_register(S [,T])
.Internal action:.df_search(S [,T] , L)
.Internal action:.df_subscribe(S [,T])
.Internal action:.difference(S1,S2,S3)
.Internal action:.drop_all_desires
.Internal action:.drop_all_events
.Internal action:.drop_all_intentions
.Internal action:.drop_desire(D)
.Internal action:.drop_event(D)
.Internal action:.drop_future_intention(I)
.Internal action:.drop_intention(I)
.Internal action:.empty
.Internal action:.eval(Var,Logical Expression)
.Internal action:.fail
.Internal action:.fail_goal(G)
.Internal action:.findall(Term,Query,List)
.Internal action:.for(formula) { plan_body }
.Implementation of .fork (used for |invalid input: '&'| and ||| operators).used by test libInternal action:.ground
.Implementation of if.Internal action:.include
.Internal action:.intend(G, [ I ] )
.Internal action:.intention( ID, STATE, STACK, [current])
.Internal action:.internal_action
.Internal action:.intersection(S1,S2,S3)
.injected by .forkInternal action:.kill_agent
.Internal action:.length
.Internal action:.list
.Internal action:.list_files
.Internal action:.list_plans
.Internal action:.list_rules
.Internal action:.literal
.Internal action:.log(level, args...)
.Implementation of while.Internal action:.lower_case(S1,S2)
.Manual for internal actionsInternal action:.max
.Internal action:.member(T,L)
.Internal action:.min
.Internal action:.my_name
.Internal action:.namespace
.Internal action:.namespace_get_prop
.Internal action:.namespace_set_prop
.Internal action:.nano_time
.Internal action:.nth
.Internal action:.number
.Internal action:.perceive
.Internal action:.plan_label(P,L)
.Internal action:.prefix(P,L)
.Internal action:.print
.Internal action:.printf(format, args...)
.Internal action:.println
.Internal action:.puts
.Internal action:.random(N)
.Internal action:.range(Var,Start,End, Step)
.Internal action:.relevant_plan
.Internal action:.relevant_plans
.Internal action:.relevant_rules
.Internal action:.remove_plan
.replace the variable by unused named, to avoid clash.Internal action:.replace(S1,S2,S3,S4)
.Internal action:.resume(G)
.Internal action:.reverse
.Internal action:.save_agent
.Internal action:.send
.Internal action:.set_random_seed(N)
.Internal action:.setof(Term,Query,List)
.Internal action:.shuffle(List,Result)
.Internal action:.signal
.Internal action:.sort
.Internal action:.stopMAS
.Internal action:.string
.Internal action:.structure
.Internal action:.sublist(S,L)
.Internal action:.substring
.Internal action:.succeed_goal(G)
.Internal action:.suffix(S,L)
.Internal action:.suspend(G)
.Internal action:.suspended(G, R)
.Internal action:.term2string(T,S)
.Internal action:.time(HH,MM,SS,MS)
.Internal action:.type
.Internal action:.union(S1,S2,S3)
.Internal action:.upper_case(S1,S2)
.Internal action:.verbose
.Internal action:.version(V)
.Internal action:.wait(E,T)
.