Message-format Layer Prolog API (Version 1.20) ============================================== The "message_format" module is for composing and decomposing messages. It is only recommended if you do not have to send/receive any message. Otherwise please use the "messaging" module. Message Composition & Manipulation ---------------------------------- 1. Contextual-info Composition mf_compose_context( ?Version, ?Conv_id, ?Origin, ?Destination, -Time_stamp, -Context) Compose the message contextual-info from given components or build a template for receiving messages. When composing a message, "Conv_id" should be instantiated. The programmer has the freedom to use anything for "Conv_id". If "Conv_id" is left uninstantiated, it will be filled in by calling "generate_id/1" when the message is sent. In composing a message matching template, "Conv_id" can be left uninstantiated. For most cases, "Time_stamp" should be left uninstantiated. It will be filled in when the message is sent. 2. CCQL Message-core Composition mf_compose_ccql_core( ?Performative, -Arguments, -Core) Compose the CCQL message-core from given components or build a template for receiving messages. "Arguments" is a list in the form: [arg1:value1, arg2:value2, ...] If the message is used as a receiving template, it is suggested to leave "Arguments" uninstantiated. 3. Message Composition mf_compose_message(?Context,?Core,-Message) Compose a message from the contextual-info and the message-core. "Message" is the message composed. "Context" is the contextual-info composed by mf_compose_context/6. "Core" is the message-core composed by mf_compose_ccql_core/5. mf_compose_message( ?Original, ?Destination, ?Performative, ?Arguments, -Message) This is a handy way of composing a message from the major CCQL components with most information filled in by the system. "Original" and "Destination" are the original and destination names in the contextual part. They DO NOT correspond to the sender & reciever argument in the CCQL message core, although in most cases they should be the same. The programmer should set the appropriate sender & receiver values in the argument list by "mf_set_argument/2/3". 4. Message Decomposition mf_decompose_message( ?Context, ?Core, +Message) Decompose a message into the contextual-info & CCQL message-core. mf_decompose_message( ?Original, ?Destination, ?Performative, ?Arguments, +Message) Decompose a message into the corresponding CCQL message components. "Arguments" is a list in the form: [arg1:value1, arg2:value2, ...] As in mf_compose_message/5, "Original" & "Destination" correspond to the values in the contextual-info part. To get the sender & receiver value in the CCQL message core, use "mf_get_argument/2". 5. Contextual-info Decomposition mf_decompose_context( ?Version, ?Conv_id, ?Origin, ?Destination, ?Time_stamp, +Context) Decompose a contextual-info part into the corresponding components. 6. CCQL Message-core Decomposition mf_decompose_ccql_core( ?Performative, ?Arguments, +Core) Decompose a CCQL message-core into the corresponding CCQL components. Getting/Setting Argument Value ------------------------------ 1. Get Argument Value mf_get_argument(+Source,?Template) Get argument value(s) from either a message or an argument-list. "Source" can be a message (i.e. contextual + core) or an argument-list decomposed from a message. The matching "Template" can be a "arg:value" pair or a list of "arg:value" pairs. 2. Set Argument Values mf_set_argument(+Value_pairs,-Argument_list) Create a new argument-list from the "Value_pairs". "Value_pairs" can be a single "arg:value" or a list in the form: [arg1:value1, arg2:value2, ...] mf_set_argument(+Old_args,+Value_pairs,-New_args) Update argument value in "Old_args" to give the new list "New_args". As in mf_set_argument/2, "Value_pairs" can be a single "arg:value" pair or a list in the form: [arg1:value1, arg2:value2, ...].