PNML Documents Validation


About Petri nets having multiple arcs

In contrast to the mathematical definition of Petri nets (N=(S, T, F)), Petri net tools often allow multiple arcs between the same nodes. Therefore, the transfer format (i.e. PNML) does not forbid such multiple arcs. However, when using PNML to exchange PNML files among different tools, users need to be aware of that Petri nets with such multiple arcs might not be accepted by other tools, or interpreted in different ways.

In general, the interpretation of such multiple arcs is to just add the inscriptions of these acrs, using the correct sum operator for the respective Petri net type: addition (plus) on numbers for P/T nets; the respective multiset addition for HLPNGs.

Validation tools

There are many tools to validate XML files against their RELAX NG grammar. In the case of PNML, below is a summary of the tools you can use.

PNML Framework's ecosystem

We are providing PNML Document Checker (PNML DoC), a free and open source tool to validate PNML Documents against the ISO/IEC 15909-2 specification. PNML DoC relies on PNML Framework to do so. It can check for the presence of multiple arcs, and it can also remove them (two separate options). It is also able to remove all graphical information attached to the Petri net objects in the PNML, which reduces the size of the PNML file.

We recommend using this tool to validate your PNML documents. If you feel that it is missing some important feature, please let us know.

XML Lint

xmllint is part of the very useful Libxml2 toolkit for XML processing. It supports RELAX NG, so you can also use it to check PNML Documents via this Shell script we provide.

The check is performed against PNML grammar only. Validation against PNML Schematron rules (see below) is not enabled since the support of Schematron by xmllint seems, for the moment, not compatible with these.

This script assumes that you have xmllint and perl installed, and an Internet connectivity (it fetches the grammar from this site). So please, make sure these three requirements are met.

Apple's Automator Service

If you are a Mac user, then you can use the same script we have turned into a Service, via the contextual menu on your PNML Documents.

Just download, uncompress and install this workflow into your $HOME/Library/Services/ folder. Then you can start using it right away on your PNML Documents in Finder!

Right-click on your PNML Documents (one or several) in Finder, then select the service Validate PNML Document(s). After a while, the validation report should be opened in Safari.

The same three requirements as stated above apply for the correct operation of this service.

Further validation with Schematron

You may also want to use the Schematron rules we have provided to validate Core models, P/T nets and Symmetric nets PNML Documents. The Schematron rules specify most of the OCL constraints found in the metamodels of the PNML standard.


PNML Framework uses Jing, a RELAX NG validator by James Clark, to validate a PNML Document against its grammar. Jing can be used either as a library or as a command-line tool. So, it is a pretty useful tool you may add to your PNML toolkit.

You are advised to turn ID validation off on PNML files, if you are directly using Jing. This issue is related to our anyElement definition, and xsd:ID - xsd:IDREF compatibility issues with RELAX NG. We use the anyElement construct for ToolSpecific definition, to allow any well-formed XML to be included. The following blog article discusses this issue.

With ID validation turned on with Jing, you may get an error about conflicting ID types. So just turn it off, or have a specific program check ID uniqueness and IDREFs coherence for you. Using PNML DoC, you should not have to bother about this, since we take care of that.