Submit your research to the International Journal "Notes on Intuitionistic Fuzzy Sets". Contact us at nifs.journal@gmail.com

Call for Papers for the 27th International Conference on Intuitionistic Fuzzy Sets is now open!
Conference: 5–6 July 2024, Burgas, Bulgaria • EXTENDED DEADLINE for submissions: 15 APRIL 2024.

GNTicker Trace Protocol: Difference between revisions

From Ifigenia, the wiki for intuitionistic fuzzy sets and generalized nets
Jump to navigation Jump to search
Line 144: Line 144:


; Description
; Description
: Clients should use STEP in order to execute a number of GN steps of a previously loaded GN. If the parameter is omitted, a default value of 1 is presumed by default. If all the steps are executed correctly, the server responds with an XML document, describing all events in the GN during these steps. The STEP method does not require a message body.
: Clients should use <tt>STEP</tt> in order to execute a number of GN steps of a previously loaded GN. If the parameter is omitted, a default value of 1 is presumed by default. If all the steps are executed correctly, the server responds with an XML document, describing all events in the GN during these steps. The <tt>STEP</tt> method does not require a message body.


; Example
; Example

Revision as of 22:23, 26 April 2009

GNTicker Trace Protocol (GNTP) is designed to allow two-way communication between the GNTicker server (TS) and its clients. The main tasks which can be accomplished using GNTP are:

  • Sending a generalized net definition to the TS
  • Receiving events for token movement, entrance, leaving or merging from the TS
  • Performing a number of steps of the GN execution
  • Executing the GN until a specific event occurs, with an upper bound of the number of steps
  • Providing client-initiated (active) input in the form of a token, which can be placed in a fixed input place of the GN
  • Providing server-initiated (passive) input in the form of a string or double value with a query string
  • Client or server initiated halting of the execution
  • Error reporting from the TS on all requests

General principles

GNTP uses the design of the Hypertext Transfer Protocol for the presentation layer and XML for the application layer. GNTP messages are requests (issued by the client) and responses (issued by the server). Each message consists of the message preamble (protocol version and method name or response code), optional message headers and message body. The message body, if non-empty, is usually an XML document. The namespace used by the XML documents is the GN definitions namespace: http://www.clbme.bas.bg/GN, which is defined in the following XML schema.

A request to the TS should be formed according to the following template:

<GNTP-request> ::=	GNTP/<protocol-version>\r\n
			<method-name> <method-parameters>\r\n
			(<header>\r\n)*
			\r\n
			<request-body>

<protocol-version> ::=	<decimal-digit>.<decimal-digit>

<method-name> ::=	<capital-latin-letter> | 
			<capital-latin-letter><method-name>

<method-parameters> ::=	<decimal-number> |
			<decimal-number> <method-parameters>

<header> ::=		<header-name>: <header-value>

The GNTP headers will be presented in Headers. The method syntax will be presented in Methods. A response from the TS should be formed according to the following template:

<GNTP-response> ::= 
			GNTP/<protocol-version>\r\n
			<response-code> <response-details>\r\n
			(<header>\r\n)*
			\r\n
			<response-body>

<response-code> ::=
			<response-class><response-type>

<response-class> ::=	<decimal-digit>

<response-type> ::=	<decimal-digit><decimal-digit>

<response-details> ::=	<ANSI-string>

The response codes and details will be presented in Response codes.

Headers

Content-Length

Syntax
Content-Length: <decimal-number>
Description
Specifies the size of the message body in bytes. This header SHOULD be used in requests and responses every time, when the message body is nonempty.
Example
Content-Length: 173

Content-Type

Syntax
Content-Type: <media-type>
Description
Specifies the media type (MIME type) of the message body. This header is optional, if not specified "text/xml" type is presumed by default.
Note: only XML messages are supported up to now.
Example
Content-Type: text/xml

Methods

INIT

Syntax
	INIT
Description
The INIT method should be the first method, which a client should use. A client should use the INIT method to send a GN definition to the server. Only one INIT method should be sent to the server by the client. Each new GN execution requires a new connection to the server. The message body is an XML definition of a generalized net starting with a <gn> element and conforming to GNschema.xsd.
Example
	GNTP/0.1
	INIT
	Content-Length: 492
	
	<?xml version = "1.0"?>
	
	<gn xmlns = "http://www.clbme.bas.bg/GN" name = "MinimalGN">
	   <transitions>
		  <transition id = "Z1">
			 <inputs>
				<input ref = "L1"/>
			 </inputs>
			 <outputs>
				<output ref = "L2"/>
			 </outputs>
			 <predicates/>
		  </transition>
	   </transitions>
	   <places>
		  <place id = "L1" priority = "1"/>
		  <place id = "L2" priority = "1"/>
	   </places>
	   <tokens/>
	   <functions/>
	</gn>
Comment
A minimal GN is loaded in the server.

HALT

Syntax
	HALT
Description
Clients should use the HALT method to initiate halt of the GN execution. The client has to wait for the server to respond and close the connection. The HALT method should be used only after an INIT method. The HALT method does not require a message body.
Example
	GNTP/0.1
	HALT
Comment
The current GN execution is halted and the memory for the GN is freed.

STEP

Syntax
	STEP [<number-of-steps>]
	<number-of-steps> ::=	<decimal-number>
Description
Clients should use STEP in order to execute a number of GN steps of a previously loaded GN. If the parameter is omitted, a default value of 1 is presumed by default. If all the steps are executed correctly, the server responds with an XML document, describing all events in the GN during these steps. The STEP method does not require a message body.
Example
	GNTP/0.1
	STEP 10
Comment
The loaded GN is executed for ten steps and events are returned in response.

STEPUNTIL

Syntax
	STEPUNTIL <event-name> <number-of-steps> [<token-ids>]

	<event-name> ::=	ENTRANCE|MOVEMENT|EXIT|MERGE

	<number-of-steps> ::=	<decimal-number>

	<token-ids> ::=		<token-id>|<token-id> <token-ids>

	<token-id> ::= 		<identifier>
Description
Executes a GN until a step, where a specific token event occurs. Events are correspondingly entrance of a token, movement of a token, exit of a token or merging of a token. Note that the whole last step is performed, i.e. execution is not stopped immediately when the event occurs but only after the step is completed. The <number-of-steps> specifies the maximum number steps which are performed, while waiting for the event. It is a required argument to avoid infinite cycles. If a list of token IDs is specified, then only the token with IDs in the list are monitored for the selected event. The STEPUNTIL method has to be executed after an INIT method. The STEPUNTIL method does not require a message body.
Example
	GNTP/0.1
	STEPUNTIL EXIT 100 MessageToken ErrorToken
Comment
The GN is executed until at least one of the tokens MessageToken or ErrorToken leaves the GN, or until 100 steps are completed.

TOKENS

Syntax
	TOKENS
Description
Clients should use the TOKENS method to insert tokens in the GN in the time of execution. Therefore, the TOKENS method should be used for active input in the GN. This method requires an XML message body with a <tokens> element, as described in GNschema.xsd. The TOKENS method can be executed only after the INIT method.
Example
	GNTP/0.1
	TOKENS
	Content-Length: 252
	
	<?xml version = "1.0"?>
	<tokens xmlns = "http://www.clbme.bas.bg/GN">
	  <token id = "PriceToken" host = "L1">
	    <char name = "Product" type = "string">PS/2 mouse</char>
	    <char name = "Pricce" type = "double">3.50</char>
	  </token>
	</tokens>
Comment
In this example the client requests to insert a token with ID "PriceToken" into the place with ID "L1". The token has two characteristics - a string characteristic "Product" with value "PS/2 mouse" and a double characteristic "Price" with value 3.50.

INPUT

Syntax
	INPUT [<number-of-inputs>]

	<number-of-inputs> ::= <decimal-number>
Description
The INPUT method should be used by the client when the last response by the TS requires input. Therefore, the INPUT method provides passive input in the GN. The TS initiates passive input with a Class 3 response code. The response body of a Class 3 response is an XML with an <input-request> element, containing <value> elements, conforming to GNschema.xsd. This body should be used as a template by the client and filled with client-provided data. The difference is that the result should be enclosed in an <input-response> element.
The INPUT method should be executed only immediately after a Class 3 response; it is also the only allowed method after such a response code. As with all other methods, INPUT has to be executed only after the INIT method.
Example
	GNTP/0.1
	INPUT
	Content-Length: 214
	
	<?xml version = "1.0"?>
	<input-response xmlns = "http://www.clbme.bas.bg/GN">
	     <item name = "Product" type = "string">Mouse pad</char>
	     <item name = "Price" type = "double">1.00</char>
	</input-response>
Comment
A client responds to a server Class 3 response code, which required two values: a string value with a query string "Product" and a double value with a query string "Price".

SAVE

Syntax
	SAVE
Description
The SAVE method should be used by the client to receive the current state of the GN. The server responds with a GN definition conforming to GNschema.xsd. If the GN model has already performed a number of steps, the current time of the GN is indicated by the time attribue in the <gn> tag.
As with all other methods, SAVE has to be executed only after an INIT method and when the previous respose code was Class 2.
Example

Client:

	GNTP/0.1
	SAVE

Server:

	GNTP/0.1
	200 Request completed successfully
	Content-Length: 504
	
	<?xml version = "1.0"?>
	
	<gn xmlns = "http://www.clbme.bas.bg/GN" name = "MinimalGN" time = "10">
	   <transitions>
		  <transition id = "Z1">
			 <inputs>
				<input ref = "L1"/>
			 </inputs>
			 <outputs>
				<output ref = "L2"/>
			 </outputs>
			 <predicates/>
		  </transition>
	   </transitions>
	   <places>
		  <place id = "L1" priority = "1"/>
		  <place id = "L2" priority = "1"/>
	   </places>
	   <tokens/>
	   <functions/>
	</gn>
Comment
A client queries the server for the current state of the GN model being executed. The server responds with a Class 2 success code and a GN, which has been executed for 10 steps.

Response codes

Class 1 - Invalid request

Class 2 - Successfully completed request

Class 3 - More information needed

Class 4 - Message body errors

Class 5 - GNTicker interpreter errors

References