Graphics are elided from this discussion

Everywhere there are ToolInfos in this discussion one may assume that there is also an optional Graphics possible.

While we parse graphics XML into "containers of strings" and Coordinates no further use is implemented or planned. And no discussion of use is present.

Core Layer

An intermediate representation (IR) of the XML model usable to form networks. Many different flavors of Petri Nets are expected to be implemented using the IR.

XML attribute names and child element tag names are used as keys. The pnml standard/schemas do not use colliding names.

The core is implemented under the assumption the the input pnml file is valid. All tags are assumed to be meaningful to the resulting network. The pnmlcore schema requires undefined tags on objects will be considered pnml labels.

The IR is capable of handling arbitrary labels.

Many label tags from higherlevel pnml schemas are recognized by the IR core parser. They will be parsed for pnmlcore nets. Users are expected to use a meta-model if they want specific behavior.

Some parts of pnml are complicated.

The crude structure required by the pnmlcore schema:

PnmlModel

  • Net
    • Pages
      • Places, Marking, Toolinfos, unclaimed labels [SortType] [Capacity]
      • Transitions, Condition, Toolinfos, unclaimed labels [TransitionRate]
      • Arcs, Inscription, Toolinfos, unclaimed labels [ArcType]
      • Toolinfos [Labels.TokenGraphics]
      • Labels unclaimed, [Declaration]
      • Subpages
    • Name Label
    • Toolinfos
    • Labels

This implementation will be a superset of what is in the standard.

Concepts from High-Level Petri Nets will be present in the Core layer.

Declaration Dictionaries

The XML file format allows declarations to be declared in <net> and <page> elements.

All Declaration labels for a net share the same DeclDict. It is net-level data even when in a <page>.

XML XPath is used to gather this information before parsing the rest of the elements. Allows using DeclDict while parsing.

PNML.DeclDictType
struct DeclDict
  • namedsorts::Dict{Symbol, Any}

  • arbitrarysorts::Dict{Symbol, Any}

  • partitionsorts::Dict{Symbol, Any}

  • multisetsorts::Dict{Symbol, Any}

  • productsorts::Dict{Symbol, Any}

  • namedoperators::Dict{Symbol, Any}

  • arbitraryoperators::Dict{Symbol, Any}

  • partitionops::Dict{Symbol, Any}

  • feconstants::Dict{Symbol, Any}

  • usersorts::Dict{Symbol, Any}

  • useroperators::Dict{Symbol, Any}

Collection of dictionaries holding various kinds of PNML declarations. Each keyed by REFID symbols.

source

Net Data Dictionaries

This is where the graph node storage resides.

PnmlNetData contains ordered collections of the graph node objects, indexed by REFID symbols.

PNML.PnmlNetDataType
struct PnmlNetData
  • place_dict::OrderedCollections.OrderedDict{Symbol, Any}

  • transition_dict::OrderedCollections.OrderedDict{Symbol, Any}

  • arc_dict::OrderedCollections.OrderedDict{Symbol, Any}

  • refplace_dict::OrderedCollections.OrderedDict{Symbol, Any}

  • reftransition_dict::OrderedCollections.OrderedDict{Symbol, Any}

Collect each of the PnmlNodess & Arcs of a Petri Net Graph into one collection. Accessed via pnml ID key or iterate over values of an OrderedDict.

In the 'pnml' standard there is a Page structure that can be removed by flatten_pages!, removing some display-related information, leaving a functional Petri Net Graph as described in this structure. It is intended to be a per-PnmlNet database that is mutated as each page is parsed.

See PnmlNetKeys for page-level pnml ID of "owners" net data.

source

The XML file format distributes a <net> over one or more <page>s. As the pages are parsed, the nodes are appended to a PnmlNetData dictionary and a PnmlNetKeys set.

The PnmlNetData dictionaries maintain insertion order.

Each graph node may have labels attached. What labels depends on the PnmlTypes

ID Sets

PnmlNetKeys contains ordered sets of REFID symbols.

PNML.PnmlNetKeysType
struct PnmlNetKeys
  • page_set::OrderedCollections.OrderedSet{Symbol}

  • place_set::OrderedCollections.OrderedSet{Symbol}

  • transition_set::OrderedCollections.OrderedSet{Symbol}

  • arc_set::OrderedCollections.OrderedSet{Symbol}

  • reftransition_set::OrderedCollections.OrderedSet{Symbol}

  • refplace_set::OrderedCollections.OrderedSet{Symbol}

Per-page structure of OrderedSets of pnml IDs for each "owned" Page and other AbstractPnmlObject.

source

Each PnmlNetKeys set maintains insertion order.

Uses REFIDs to keep track of which page owns which graph nodes or sub-page. We always use the flatten_pages! version. Testing of non-flattened nets is very minimal.

Warning

After flatten_pages! the PnmlNetKeys of the only remaining page are assumed to be the same as the keys of corresponding PnmlNetData dictionary.