Invocation

The general invocation command is: java -jar jar_name [options] [pnmlFile1 pnmlFfile2 ...]. Run the application with -h or --help to get help.

Standalone mode

The default execution mode is standalone. In this mode, the application expects arguments, which should be PNML documents to be converted into dot. You may specify one or many.

Service result

In standalone mode, here is an overview of the result message; this case when the transformation was successful:

  • HTTP/1.1 200 OK
  • Message: Your PNML document was transformed into dot.
  • Model type: Place/Transition Net.
  • Output dot file: [canonical path to]/philo.dot

Server mode

To run in server mode with default port and temporary working directory: java -jar jar_name -p2d -s. The -p2d option specified PNML to dot conversion. It is the default, and the one which is supported by now. The conversion from dot to PNML is not yet implemented. So you may omit that option.

Unless you specify them, a default port will be used (10005), and a temporary working directory will be created. Its name is ./pnml2dottmp. The server logs will be located in ./pnml2dottmp/logs/.

You can also specify the delay you want conversion tasks not to exceed. When that delay is over, the server cancels the tasks in such a situation. Before they stop, they will send you a message with status code HTTP/1.1 408 Request Timeout.

Service result

In server mode, here is an example of a result message, this case when the conversion was successful.

  • HTTP/1.1 200 OK
  • Message: Your PNML document was transformed into dot.
  • Model type: Place/Transition Net.
  • DOT GRAPH FOLLOWS
  • [the dot graph]

Using one of Graphviz programs to draw your Petri net

Since some nets may have their nodes explicitly positioned in the PNML document, you may want to use neato in that case, because it can use the positioning information we pass on in the dot file. Look for the pattern pos="x,y!" in the dot file, where x and y are numbers. Although neato primarily draws undirected graphs, we have successfully used it to draw the P/T philo.pnml model.

In that case, call neato for example like this: neato -n -Tpng -O philo.dot. Neato will use the positioning information already provided to build the graph. It will produce the output file philo.dot.png. Of course you can explicitly specify another name for the output file (-o option).

The dot program, which draws directed graphs, will not use the positioning information, since by nature it tries to achieve an optimal layout for your graph based on your directives. And some times, for small graphs (like the PNML file access policy example) it is the best. But in our case, for more large graphs where we want to conserve place invariants, the most important directive is the positioning of nodes, when we have this information. Since dot does not use this information at all, it might be worth trying neato.

HTTP status codes

The results returned by the server use HTTP status codes in their first line to tell you if the service was successful or if something went wrong. They are followed by a message.

If the service was successful, then the delimiter DOT GRAPH FOLLOWS will appear before you read the actual dot graph.

Here are the HTTP status codes this application uses:

HTTP/1.1 200 OK Service successful
HTTP/1.1 202 Accepted For later use
(Asynchronous invocation)
HTTP/1.1 400 Bad Request Malformed request
HTTP/1.1 403 Forbidden Access rights problem
HTTP/1.1 404 Not Found A resource is missing
HTTP/1.1 408 Request Timeout Task exceeded its delay
HTTP/1.1 413 Request Entity Too Large File too large to be handled
HTTP/1.1 415 Unsupported Media Type Unsupported Petri net type,
Not a PNML file
HTTP/1.1 500 Internal Server Error Internal problem
HTTP/1.1 503 Service Unavailable Cannot serve request