PNML

PNML.PNMLModule

Petri Net Markup Language, is an XML-based format. PNML.jl reads a pnml model and emits an intermediate representation (IR).

The intermediate representation (IR) represents the XML tree via julia data structures: dictionaries, NamedTuples, strings, numbers, objects, vectors. The exact mixture changes as the project continues.

The tags of the XML are used as keys and names as much as possible.

What is accepted as values is ~~often~~ a superset of what a given pntd schema specifies. This can be thought of as duck-typing. Conforming to the pntd is not the role of the IR.

The pnml standard has layers. This package has layers: PnmlNet, AbstractPetriNet

The core layer is useful and extendable. The standard defines extensions of the core, called meta-models, for

  • place-transition petri nets (integers) and
  • high-level petri net graphs (many-sorted algebra).

This package family adds non-standard continuous net (float64) support. Note that there is not yet any RelaxNG schema for our extensions.

On top of the concrete PnmlNet of the IR are net adaptions and interpertations. This is the level that Petri Net conformance can be imposed. It is also where other Net constructs can be defined over PnmlNets. Perhaps as new meta-models.

source
PNML.AbstractLabelType
abstract type AbstractLabel

Labels are attached to the Petri Net Graph objects. See AbstractPnmlObject.

Expected interface is for every concrete label to have at least these fields: - text - graphics - toolspecinfos - net

source
PNML.AbstractOperatorType
abstract type AbstractOperator <: PNML.AbstractTerm

Operators are part of the high-level pnml many-sorted algebra.

...can be a built-in constant or a built-in operator, a multiset operator which among others can construct a multiset from an enumeration of its elements, or a tuple operator. Each operator has a sequence of sorts as its input sorts, and exactly one output sort, which defines its signature.

See NamedOperator and ArbitraryOperator.

source
PNML.AbstractPnmlObjectType
abstract type AbstractPnmlObject

Objects of a Petri Net Graph are pages, arcs, nodes.

Expected interface is for every concrete object to have at least these fields: - id - namelabel - graphics - extralabels - toolspecinfos

source
PNML.AbstractTermType
abstract type AbstractTerm

Terms are part of the multi-sorted algebra that is part of a High-Level Petri Net.

Concrete terms are Variable and Operator found within the <structure> element of a label. They are parsed into PnmlExpr as TermInterface expressions thar are evaluated during the enabling and firing rule.

Notably, a Term is not a PnmlLabel (or a PNML Label).

References

See also Declaration, Labels.SortType, AbstractDeclaration.

Term_(logic):

A first-order term is recursively constructed from constant symbols, variables and function symbols.

Besides in logic, terms play important roles in universal algebra, and rewriting systems.

more convenient to think of a term as a tree.

A term that doesn't contain any variables is called a ground term

When the domain of discourse contains elements of basically different kinds, it is useful to split the set of all terms accordingly. To this end, a sort (sometimes also called type) is assigned to each variable and each constant symbol, and a declaration...of domain sorts and range sort to each function symbol....

Type_theory

term in logic is recursively defined as a constant symbol, variable, or a function application, where a term is applied to another term

if t is a term of type σ → τ, and s is a term of type σ, then the application of t to s, often written (t s), has type τ.

Lambda terms:

The term redex, short for reducible expression, refers to subterms that can be reduced by one of the reduction rules.

See Metatheory and SymbolicUtils

source
PNML.AbstractVariableType
abstract type AbstractVariable <: PNML.AbstractTerm

Variables are part of the high-level pnml many-sorted algebra.

source
PNML.AnnotationType
abstract type Annotation <: PNML.AbstractLabel

Label that may be displayed. Differs from an Attribute Label by possibly having a Graphics field. We do not implement a separate Attribute type since graphics is optional.

source
PNML.AnyElementType
struct AnyElement{T}
  • tag::Symbol

  • elements::Any

Hold AbstractDict holding zero or more well-formed XML elments. See also ToolInfo and PnmlLabel.

Creates a tree where the root is tag, leaf node values are Union{String, SubString{String}}, and interior nodes values are Union{XmlDictType, Vector{XmlDictType}}

See XmlDictType.

source
PNML.ArcType

Edge of a Petri Net Markup Language graph that connects place and transition.

mutable struct Arc{T<:PNML.Expressions.PnmlExpr, N<:PNML.AbstractPnmlNet} <: PNML.AbstractPnmlNode
  • id::Symbol

  • source::Base.RefValue{Symbol}

  • target::Base.RefValue{Symbol}

  • inscription::PNML.Labels.Inscription

  • arctypelabel::PNML.Labels.ArcType

  • namelabel::Union{Nothing, PNML.Labels.Name}

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • extralabels::OrderedCollections.LittleDict{Symbol, Any, KS, VS} where {KS<:Union{Tuple{Vararg{Symbol}}, AbstractVector{Symbol}}, VS<:Union{Tuple, AbstractVector{Any}}}

  • net::PNML.AbstractPnmlNet

source
PNML.BooleanConstantType
BooleanConstant("true"|"false")
BooleanConstant(true|false)

A built-in operator constructor (constants are 0-ary operators).

Examples

    c = BooleanConstant("true");
    c == BooleanConstant(true)
    c() == true
source
PNML.CoordinateType
struct Coordinate
  • x_::Float32

  • y_::Float32

Cartesian Coordinate are positive decimals. Ranges from 0 to 999.9.

source
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}

  • useroperators::Dict{Symbol, Any}

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

source
PNML.DotConstantType

The only element of DotSort is DotConstant. This is a 0-arity opertor term that evaluates to 1.

source
PNML.FEConstantType
FEConstant

Finite enumeration constant and its containing sort.

"...these FEConstants are part of the declaration of the FiniteEnumeration sort. On the other hand, each of these FEConstants defines a 0-ary operation, i. e. is a declaration of a constant."

Usage

fec = FEConstant(:anID, "somevalue", sortref)
fec() == :anID
fec.name = "somevalue"
source
PNML.FiniteIntRangeConstantType
struct FiniteIntRangeConstant{T<:Integer} <: PNML.AbstractOperator

Must refer to a value between the start and end of the respective FiniteIntRangeSort.

source
PNML.HLAnnotationType
abstract type HLAnnotation <: PNML.AbstractLabel

Annotation label that adds <structure>.

source
PNML.LabelParserType
struct LabelParser
  • tag::Symbol

  • func::Union{Function, Type}

Maps a Symbol to a callable for parsing an XML label <tag>'s well-formed contents. The parser will be called as func(node, pntd) and return a label object.

See fill_builtin_labelparsers! for some built-in label parsers.

source
PNML.NumberConstantType
NumberConstant{T<:Number, S}

Builtin operator that has arity=0 means the same result every time, a constant. Restricted to NumberSorts, those Sorts whose eltype isa Number.

source
PNML.OperatorType

PNML Operator as Functor

tag maps to func, a functor/function Callable. Its arity is same as length of inexprs and insorts

source
PNML.PageType
mutable struct Page{PNTD<:PNML.PnmlTypes.AbstractPnmlType, N<:PNML.AbstractPnmlNet} <: PNML.AbstractPnmlObject
  • net::PNML.AbstractPnmlNet

  • pntd::PNML.PnmlTypes.AbstractPnmlType

  • id::Symbol

  • namelabel::Union{Nothing, PNML.Labels.Name}

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • extralabels::OrderedCollections.LittleDict{Symbol, Any, KS, VS} where {KS<:Union{Tuple{Vararg{Symbol}}, AbstractVector{Symbol}}, VS<:Union{Tuple, AbstractVector{Any}}}

  • netsets::PNML.PnmlNetKeys

Contain all places, transitions & arcs. Pages are for visual presentation. There must be at least 1 Page for a valid pnml model.

PNTD binds the other type parameters together to express a specific PNG. See PnmlNet

source
PNML.PlaceType
mutable struct Place{N<:PNML.AbstractPnmlNet} <: PNML.AbstractPnmlNode
  • id::Symbol

  • initialMarking::PNML.Labels.Marking

  • sorttype::PNML.Labels.SortType

  • namelabel::Union{Nothing, PNML.Labels.Name}

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • extralabels::OrderedCollections.LittleDict{Symbol, Any, KS, VS} where {KS<:Union{Tuple{Vararg{Symbol}}, AbstractVector{Symbol}}, VS<:Union{Tuple, AbstractVector{Any}}}

  • net::PNML.AbstractPnmlNet

Place node of a Petri Net Markup Language graph.

Each place has an initial marking that has a basis matching sorttype. M is a "multiset sort denoting a collection of tokens". A "multiset sort over a basis sort is interpreted as "the set of multisets over the type associated with the basis sort".

source
PNML.PnmlConfigType

Configuration with default values that can be overidden by a LocalPreferences.toml.

Options

  • indent_width::Int: Indention of nested lines.
  • text_element_optional::Bool: There are pnml files that break the rules & do not have <text> elements.
  • warn_on_fixup::Bool: When an missing value is replaced by a default value, issue a warning.
  • warn_on_namespace::Bool: There are pnml files that break the rules & do not have an xml namespace.
  • warn_on_unclaimed::Bool: Issue warning when PNML label does not have a parser defined. While allowed, there will be code required to do anything useful with the label.
  • warn_on_unimplemented::Bool: Issue warning to highlight something unimplemented. Expect high volume of messages.
  • verbose::Bool: Print information as runs.
source
PNML.PnmlModelType
struct PnmlModel{T<:AbstractDict}
  • nets::AbstractDict

  • namespace::String

One or more Petri Nets.

source
PNML.PnmlMultisetType
pnmlmultiset(basis::SortRef, x::T, multi::Int=1) -> PnmlMultiset{T, N <: APN}

Construct as a multiset with one element, x, with default multiplicity of 1.

PnmlMultiset wraps a Multisets.Multiset{T} where T is the basis sort element type.

Some Operatorsand [Variables`](@ref) create/use a multiset. Thre are constants (and 0-arity operators) defined that must be multisets since HL markings are multisets.

See Bag for expression that returns this data structure.

"multix" is text representation of the<numberof>operator that produces a multiset. As does<all>` operator.

source
PNML.PnmlNetType
mutable struct PnmlNet{PNTD<:PNML.PnmlTypes.AbstractPnmlType} <: PNML.AbstractPnmlNet

One Petri Net of a PNML model.

  • type

  • id

  • idregistry: The meta-model type this net implements.

  • pagedict

  • netdata

  • page_idset

  • ddict

  • declaration

  • namelabel

  • toolspecinfos

  • extralabels

  • labelparser

  • toolparser: Collection that associates a tool name & version with a callable parser. The parser turns <toolspecific name="" version=""> into ToolInfo objects.

source
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
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
PNML.REFIDType

Alias for Symbol that refers to something with an ID Symbol.

source
PNML.RefPlaceType

Reference Place node of a Petri Net Markup Language graph. For connections between pages.

struct RefPlace{N<:PNML.AbstractPnmlNet} <: PNML.ReferenceNode

r

  • id::Symbol

  • ref::Symbol

  • namelabel::Union{Nothing, PNML.Labels.Name}

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • extralabels::OrderedCollections.LittleDict{Symbol, Any, KS, VS} where {KS<:Union{Tuple{Vararg{Symbol}}, AbstractVector{Symbol}}, VS<:Union{Tuple, AbstractVector{Any}}}

  • net::PNML.AbstractPnmlNet

source
PNML.RefTransitionType

Refrence Transition node of a Petri Net Markup Language graph. For connections between pages.

struct RefTransition{N<:PNML.AbstractPnmlNet} <: PNML.ReferenceNode
  • id::Symbol

  • ref::Symbol

  • namelabel::Union{Nothing, PNML.Labels.Name}

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • extralabels::OrderedCollections.LittleDict{Symbol, Any, KS, VS} where {KS<:Union{Tuple{Vararg{Symbol}}, AbstractVector{Symbol}}, VS<:Union{Tuple, AbstractVector{Any}}}

  • net::PNML.AbstractPnmlNet

source
PNML.ToolParserType
struct ToolParser{T<:Union{Function, Type}}
  • toolname::String

  • version::String

  • func::Union{Function, Type}

Holds a parser callable for a <toolspecific> tag's well-formed contents.

Will be in an iteratable collection that maps tool name & version to a parser callable. See toolspecific_content_fallback(node, pntd).

source
PNML.TransitionType

Transition node of a Petri Net Markup Language graph.

mutable struct Transition{N<:PNML.AbstractPnmlNet} <: PNML.AbstractPnmlNode
  • id::Symbol

  • condition::PNML.Labels.Condition

  • namelabel::Union{Nothing, PNML.Labels.Name}

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • extralabels::OrderedCollections.LittleDict{Symbol, Any, KS, VS} where {KS<:Union{Tuple{Vararg{Symbol}}, AbstractVector{Symbol}}, VS<:Union{Tuple, AbstractVector{Any}}}

  • vars::Set{Symbol}

  • varsubs::Vector{NamedTuple}: Cache of variable substitutons for this transition

  • net::PNML.AbstractPnmlNet

source
PNML.VariableType
struct Variable{N<:PNML.AbstractPnmlNet} <: PNML.AbstractVariable
  • refvariable::Symbol

  • net::PNML.AbstractPnmlNet

Variable refers to a VariableDeclaration. Example input: <variable refvariable="varx"/>.

#TODO examples of use, modifying and accessing

source
Base.:*Method

n*B for PnmlMultisets is the scalar multiset product.

source
Base.:*Method

A*B for PnmlMultisets is forwarded to Multiset.

source
Base.:+Method

A+B for PnmlMultisets is the disjoint union of enclosed multiset.

source
Base.:-Method

A-B for PnmlMultisets is the disjoint union of enclosed multiset.

source
Base.:<Method

A<B for PnmlMultisets is forwarded toMultiset.

source
Base.:<=Method

A<=B for PnmlMultisets is forwarded to Multiset.

source
Base.:>Method

A>B for PnmlMultisets is forwarded toMultiset.

source
Base.:>=Method

A>=B for PnmlMultisets is forwarded to Multiset.

source
PNML._attributeMethod

XMLDict uses symbols as keys for XML attributes. Value returned is a string.

source
PNML._opsMethod

Return iterator over operator dictionaries of Declaration Dictionaries.

source
PNML._sortsMethod

Return iterator over sort dictionaries of Declaration Dictionaries.

source
PNML.accum_tr_var_binding_sets!Method
accum_tr_var_binding_sets!(tr_var_binding_set, arc_var_binding_set) -> Bool

Collect variable bindings, intersecting among arcs. Return enabled status of false if any variable does not have a substitution.

source
PNML.adjacent_placeFunction
adjacent_place(net::PnmlNet, arc::Arc) -> Place
adjacent_place(netdata::PnmlNetData, source,::Symbol target::Symbol) -> Place

Adjacent place of an arc is either the source or target.

source
PNML.allpagesMethod
allpages(net::PnmlNet|dict::OrderedDict) -> Iterator

Return iterator over all pages in the net. Maintains insertion order.

source
PNML.append_page!Method

Append selected fields of r to fields of l. Some, like Names and xml, are omitted because they are scalar values, not collections.

pagedict & netdata (holding the arc and pnml nodes) are per-net data that is not modified here. netsets hold pnml IDs "owned"

source
PNML.arcFunction

Return arc with id if found, otherwise nothing.

source
PNML.arcMethod

Return Arc from 'src' to 'tgt' or nothing. Useful for graphs where arcs are represented by a tuple or pair (source,target).

source
PNML.arcsFunction
arcs(n::PnmlNet) -> iterator
arcs(p::AbstractPetriNet) -> iterator

Return iterator over arc ids.

source
PNML.basisFunction
basis(x, ddict) -> SortRef

Return SortRef referencing a NamedSort, ArbitrarySort or PartitionSort declaration. MultisetSort, Multiset, List have a basis. Default basis is sortof Place marking & sorttype, arc inscriptions have a basis.

source
PNML.basisMethod
basis(ms::PnmlMultiset) -> SortRef

Multiset basis sort is accessed through a SortRef that holds a REFID index into decldict(net). MultisetSorts not allowed here. Nor loops in sort references.

source
PNML.conditionsFunction
conditions(net::PnmlNet) -> Iterator

Iterate over REFID => condition(transaction) pairs of net. This is the same order as transactions.

source
PNML.declarationsMethod
declarations(dd::DeclDict) -> Iterator

Return an iterator over all the declaration dictionaries' values.

source
PNML.deref!Method
deref!(net::PnmlNet; trim, verbose)

Remove reference nodes from arcs.

Operates on the PnmlNetData at the net level. Expects that the PnmlNetKeys of the firstpage will have to be cleaned as part of flatten_pages!,

Axioms

  1. All ids in a network are unique in that they only have one instance in the XML.
  2. A chain of reference Places (or Transitions) always ends at a Place (or Transition).
  3. All ids are valid.
  4. No cycles.
source
PNML.deref_placeMethod
deref_place(net, id[], trim::Bool] ) -> Symbol

Return id of referenced place. If trim is true (default) the reference is removed.

source
PNML.deref_transitionMethod
deref_transition(net, id[, trim::Bool] ) -> Symbol

Return id of referenced transition. If trim is true (default) the reference is removed.

source
PNML.dict_showFunction
dict_show(io::IO, x)

Internal helper for things that contain XmlDictType.

source
PNML.enabledFunction
enabled(::PnmlNet, marking) -> Vector{Bool}

Return vector of booleans where true means the matching transition is enabled at current marking. Has the same order as the transitions dictionary. Used in the firing rule.

Update tr.vars Set and tr.varsubs, NamedTuple.

source
PNML.fill_builtin_labelparsers!Method
fill_builtin_labelparsers!(net::APN) -> Nothing
fill_builtin_labelparsers!(labelparser::AbstractDict) -> Nothing

Fill context with the base built-in label parsers.

source
PNML.fill_builtin_toolparsers!Method
fill_builtin_toolparsers!(net::APN) -> Nothing
fill_builtin_toolparsers!(toolparsers::AbstractDict) -> Nothing

Fill context with the base built-in tool parsers.

source
PNML.fill_sort_tag!Method
fill_sort_tag!(net::APN, tag::Symbol, sort, dict) -> SortRef

If not already in the declarations dictionary dict, add sort with key of tag.

Register the tag and create and return an SortRef holding tag.

source
PNML.find_netMethod
find_net(model, id::Symbol) -> Any

Return PnmlNet having id or nothing.

source
PNML.find_netsFunction

Return nets matching pntd type given as string, symbol or pnmltype instance.

source
PNML.fireMethod
fire(incidence, enabled, marking) -> ArbitraryOperator

Return the marking vector after firing transition: marking + incidence * enabled

marking values added to product of incidence' matrix and firing vector enabled.

source
PNML.flatten_pages!Function
flatten_pages!(net::PnmlNet[; options])

Merge page content into the 1st page of the net.

Options

  • trim::Bool Remove refrence nodes (default true). See deref!.
  • verbose::Bool Print breadcrumbs See CONFIG.
source
PNML.get_arc_var_binding_set!Method
get_arc_var_binding_set!(arc_var_binding_set, arc_vars, placesort, mark, net) -> Bool

Fill arc_var_binding_set with an entry for each key in arc_vars. Return true if no variables are present or all variables have at least 1 substition. Indicates that transition is able to fire (enabled fro selection to fire).

source
PNML.get_labelFunction
get_label(x, tag::Union{Symbol, String, SubString{String}}) -> PnmlLabel

Return first label of x with a matching tagvalue.

source
PNML.get_labelMethod
get_label(x, tag) -> Maybe{AbstractLabel}

x is anyting that supports 'labels'. tag is the tag of the xml label element.

source
PNML.has_keyFunction
has_key(net::AbstractPnmlnet, dict, key::Symbol) -> Bool

Where dict is the access method for a dictionary in DeclDict.

source
PNML.has_keyMethod
has_key(net::AbstractPnmlnet, dict, key::Symbol) -> Bool

Where dict is the access method for a dictionary in DeclDict.

source
PNML.incidence_matrixFunction
incidence_matrix(petrinet) -> Matrix

When token identity is collective, marking and inscription values are Numbers and matrix C[arc(transition,place)] = inscription(arc(transition,place)) - inscription(arc(place,transition)) is called the incidence_matrix.

High-level nets have tokens with individual identity, perhaps tuples of them, usually multisets of finite enumerations, can be other sorts including numbers, strings, lists. Symmetric nets are restricted, and thus easier to deal with and reason about.

source
PNML.initial_markingsFunction
initial_markings(petrinet) -> Tuple{Pair{id(place),value_type(marking(place))}

Tuple of Pair(placeid, initialmarking value).

High-level P/T Nets use cardinality of its multiset place marking value. Really, the implementation should be the same as for PTNet.

Other HL Nets use multisets.

source
PNML.input_matrixFunction
input_matrix(petrinet::AbstractPetriNet) -> Matrix{value_type(Inscription, ::APNTD))}
input_matrix(petrinet::PnmlNet) -> Matrix{value_type(Inscription, ::APNTD)}

Create and return a matrix ntransitions x nplaces.

source
PNML.inscription_valueFunction

inscription_value(a::Maybe{Arc}, def, varsub) -> T

If a is nothing return def else evaluate inscription expression with varsub, where def is a default value of same sort as adjacent place. and varsub is a possibly empty variable substitution.

Used to create arrays where the default value is used when there is no arc between an place and transition of the net.

source
PNML.inscriptionsFunction
inscriptions(net::PnmlNet) -> Iterator

Iterate over REFID => inscription(arc) pairs of net. This is the same order as arcs.

source
PNML.isarbitrarysortMethod
isarbitrarysort(
    x::PNML.SortRefImpl.var"typeof(SortRefImpl)"
) -> Bool

Check if a value is an SortRef variant of ArbitrarySortRef.

Arguments

  • x: Value to check (for SortRef input returns true if ArbitrarySortRef, for others returns false).

Returns

  • true if x is a SortRef with ArbitrarySortRef variant, false otherwise.
source
PNML.ismultisetsortMethod
ismultisetsort(
    x::PNML.SortRefImpl.var"typeof(SortRefImpl)"
) -> Bool

Check if a value is an MultisetSortRef variant of SortRef.

Arguments

  • x: Value to check (for SortRef input returns true if MultisetSortRef, for others returns false).

Returns

  • true if x is a SortRef with MultisetSortRef variant, false otherwise.
source
PNML.isnamedsortMethod
isnamedsort(
    x::PNML.SortRefImpl.var"typeof(SortRefImpl)"
) -> Bool

Check if a value is an NamedSortRef variant of SortRef.

Arguments

  • x: Value to check (for SortRef input returns true if NamedSortRef, for others returns false).

Returns

  • true if x is a SortRef with NamedSortRef variant, false otherwise.
source
PNML.isoperatorMethod
isoperator(tag::Symbol) -> Bool

Predicate to identify operators in the high-level pntd's many-sorted algebra abstract syntaxt tree.

Note: It is not the same as Meta.isoperator. Both work on Symbols. Not expecting any conflict.

  • integer
  • multiset
  • boolean
  • tuple
  • builtin constant
  • useroperator
source
PNML.ispartitionsortMethod
ispartitionsort(
    x::PNML.SortRefImpl.var"typeof(SortRefImpl)"
) -> Bool

Check if a value is an PartitionSortRef variant of SortRef.

Arguments

  • x: Value to check (for SortRef input returns true if PartitionSortRef, for others returns false).

Returns

  • true if x is a SortRef with PartitionSortRef variant, false otherwise.
source
PNML.ispidMethod
ispid(x::Symbol)

Return function to be used like: any(ispid(:asym), iterablewithpid).

source
PNML.isproductsortMethod
isproductsort(
    x::PNML.SortRefImpl.var"typeof(SortRefImpl)"
) -> Bool

Check if a value is an ProductSortRef variant of SortRef.

Arguments

  • x: Value to check (for SortRef input returns true if ProductSortRef, for others returns false).

Returns

  • true if x is a SortRef with ProductSortRef variant, false otherwise.
source
PNML.isusersortMethod
isusersort(
    x::PNML.SortRefImpl.var"typeof(SortRefImpl)"
) -> Bool

Check if a value is an UserSortRef variant of SortRef.

Arguments

  • x: Value to check (for SortRef input returns true if UserSortRef, for others returns false).

Returns

  • true if x is a SortRef with UserSortRef variant, false otherwise.
source
PNML.labeled_placesMethod
labeled_places(net::PnmlNet, marking_vector)

Return Vector of placeid=>markingvalue of that pace.

source
PNML.labelsFunction
labels(x) -> Iterateable

Return iterator of labels attached to x.

source
PNML.make_netFunction

Create empty net with builtins installed for use in test scaffolding.

source
PNML.mcontainsMethod
mcontains(a::PnmlMultiset, b::PnmlMultiset) -> Bool

Forwarded to Multiset.issubset(multiset(b), multiset(a)).

source
PNML.multiplicityMethod
multiplicity(ms::PnmlMultiset, x) -> Integer
multiplicity(ms::Number, x) -> Number
source
PNML.nameFunction
name(x) -> String

Return name String. Default to empty string.

source
PNML.nameMethod
name(x) -> String

If x has a namelabel,return its text, else return any name field. Default to string()

source
PNML.netdataFunction
netdata(x) -> PnmlNetData

Access PnmlNet-level data structure.

source
PNML.netsMethod
nets(model::PnmlModel) -> Any

Return all nets of model.

source
PNML.operatorMethod

Lookup operator with id in DeclDict.::Symbol May be namedop, feconstant, etc

source
PNML.operatorMethod
operator(dd::DeclDict, id::Symbol) -> AbstractOperator

Return operator TermInterface expression for id. toexpr(::AbstractOpExpr, varsub, ddict) = :(useroperator(ddict, REFID)(varsub))

Operator Declarations include: :namedoperator, :feconstant, :partitionelement, :arbitraryoperator with types NamedOperator, FEConstant, PartitionElement, ArbitraryOperator. These define operators of different types that are placed into separate dictionaries.

#! AbstractDeclarations and AbstractTerms are "parallel" semi-overlapping hierarchies #! in the UML, with AbstractTerms divided into AbstractOperators and AbstractVariables.

#! AbstractTerms overlap with OperatorDeclaration and VariableDeclaration . #! AbstractSorts overlap with SortDeclaration.

#! Consider OperatorDeclaration, SortDeclaration to be generators of concrete subtypes of #! AbstractOperator, AbstractSort. #! Without multiple inheritance, this cannot be expressed in a Julia type hiearchy.

#! What the 'parse_*' of these <declaration> XML elements produce is #! a concrete AbstractOperator, AbstractSort.

#! VariableDeclaration and Variable are not hiearchies. #! A Varaible is a reference to a VariableDeclaration, #! The variable declaration is a id, name, sort triplet. #! Where the sort is a SortRefImpl or a sort declaration.

useroperator(REFID) is used to locate the operator definition, when it is found in feconstants(), is a callable returning a FEConstant literal.

`toexpr(::FEConstantEx, varsub, ddict) = :(useroperator(ddict, REFID)(varsub))`

The FEConstant operators defined by the declaration do not have a distinct type name in the standard. Note that a FEConstant's value in the standard is its identity. We could use objectid(::FEConstant), REFID or name for output value. Output sort of op is FEConstant.

Other OperatorDeclaration dictionarys also hold TermInterface expressions accessed by

`toexpr(::PnmlExpr, varsub, ddict) = :(useroperator(ddict, REFID)(varsub))`

where PnmlExpr is the TermInterface to match OperatorDeclaration. With output sort to match OperatorDeclaration .

#TODO named operator input variables and their sorts

#TODO partition element

#TODO arbitrary opearator

#TODO built-in operators

source
PNML.operatorsMethod
operators(net::APN)-> Iterator

Iterate over each operator in the operator subset of declaration dictionaries .

source
PNML.operatorsMethod
operators(dd::DeclDict)-> Iterator

Iterate over each operator in the operator subset of declaration dictionaries .

source
PNML.output_matrixFunction
output_matrix(petrinet::AbstractPetriNet) -> Matrix{value_type(Inscription, ::APNTD)}
output_matrix(petrinet::PnmlNet) -> Matrix{value_type(Inscription, ::APNTD)}

Create and return a matrix ntransitions x nplaces.

source
PNML.pagesFunction
pages(net::PnmlLabel|page::Page) -> iterator

Return iterator of pages directly owned by that object.

See allpages for an iterator over all pages in the PNML network model. When there is only one page in the net, or all pages are owned by the 'net' itself, 'allpages' and 'pages` behave the same.

Maintains order (insertion order).

source
PNML.pidFunction
pid(x) -> Symbol

Return pnml id symbol of x. An id's value is unique in the XML model of PNML. REFID is used for refrences to pnml ids.

source
PNML.pnml_hl_operatorMethod
pnml_hl_operator(tag::Symbol) -> Callable(::Vector{AbstractTerm})

Return callable with a single argument, a vector of inputs.

source
PNML.pnml_hl_outsortMethod
pnml_hl_outsort(tag::Symbol; insorts::Vector{UserSortRef}) -> SortRef

Return sort that operator tag returns.

source
PNML.pnmlmultisetFunction
pnmlmultiset(basis::SortRef, x, multi::Int=1; net) -> PnmlMultiset
pnmlmultiset(basis::SortRef, x::Multisets.Multiset; net) -> PnmlMultiset
pnmlmultiset(basis::SortRef; net) -> PnmlMultiset

Constructs a PnmlMultiset containing a multiset and a sort from either

  • a sortref, one element and a multiplicity, default = 1, denoted "1'x",
  • a sortref and Multiset
  • or just a sortref (not a multisetsort), uses all sortelements, each with multiplicity 1.

Are mapping to Multisets.jl implementation: Create empty Multiset{T}() then fill. If we have an element we can use typeof(x) to deduce T. If we have a basis sort definition we use eltype(basis) to deduce T.

Usages

  • ⟨all⟩ wants all sortelements
  • default marking, inscription want one element or zero elements (elements can be tuples),

we always find a sort to use, And use dummy elements for their typeof for empty multisets.

Expect to be called from a @matchable Terminterface, thusly:

  • eval(toexpr(Bag(basis, x, multi; net), variable_substitutions))
  • eval(toexpr(Bag(basis); net), variable_substitutions))
source
PNML.postsetMethod
postset(net, id) -> Iterator

Iterate ids of output (arc's target) for source transition or place id.

See PNet.out_inscriptions and PNet.transition_function`).

source
PNML.presetMethod
preset(net, id) -> Iterator

Iterate ids of input (arc's source) for output transition or place id.

See PNet.in_inscriptions and PNet.transition_function.

source
PNML.ratesFunction
rates(net::PnmlNet) -> [id(transition) => rate_value(transition)]

Return a vector of transitionid=>ratevalue.

We allow all PNML nets to be stochastic Petri nets. See rate_value.

source
PNML.refidFunction
refid(x) -> REFID

Return reference id symbol. Multiple objects may hold the same refid value.

source
PNML.save_config!Method
save_config!(config::PnmlConfig)

Save a configuration to your LocalPreferences.toml file using Preferences.jl. The saved preferences will be automatically loaded next time you do using PNML

Examples

julia> using PNML

julia> PNML.CONFIG[].verbose = true;

julia> PNML.CONFIG[].warn_on_unclaimed = true;     # Customize some defaults

julia> PNML.save_config!(PNML.CONFIG[]); # Will be automatically read next time you `using PNML`
source
PNML.sortdefinitionFunction
sortdefinition(::NamedSort) -> Sort

Return concrete sort attached to a sort declaration object.

Dictionaries in a network-level DeclDict hold, among other things, NamedSort, ArbitrarySort and PartitionSort declarations. These declarations add an ID and name to a concrete sort, with the ID symbol used as the dictionary key.

source
PNML.sortelementsFunction
sortelements(x, net) -> Iterator

Return iterator over elements of the sort of x in net.

source
PNML.sortelementsMethod
sortelements(ms::PnmlMultiset, net::APN) -> iterator

Iterates over elements of the basis sort. May not be a finite sort!

source
PNML.sortofFunction
sortof(x[, net]) -> AbstractSort

Return the sort of an object or type.

Often implemented as sortdefinition(namedsort(net, sortref(x))). Default implementation is identity.

We provide a sort for some Julia types: Integer, Int64, Float64. Used for PTNet.

source
PNML.sortrefFunction
sortref(x) -> SortRef

Return a REFID wrapped in a SortRef ADT.

Things that have a sortref include: Place, Arc, Inscription, Marking, MultisetSort, SortType, NumberConstant, Int64, Integer, Float64, FEConstant, FiniteIntRangeConstant, DotConstant, BooleanConstant, PnmlMultiset, Operator, Variable,

source
PNML.sourceMethod
source(arc) -> Symbol

Return identity symbol of source of arc.

source
PNML.sufficient_tokens!Function
sufficient_tokens!(enabled_dict, mark_dict, net::AbstractPnmlNet)

Update each enabled transition's state in enabled_dict by testing that all its input places have enough tokens.

source
PNML.tagFunction
tag(x) -> Symbol

Return tag symbol. Multiple objects may hold the same tag value. Often used to refer to an XML tag.

source
PNML.targetMethod
target(arc) -> Symbol

Return identity symbol of target of arc.

source
PNML.to_sortMethod
to_sort(sortref::SortRef, ddict::DeclDict) -> AbstractSort

Return concrete sort from net using the REFID in sortref,

source
PNML.transition_guard!Function
transition_guard!(enabled_dict, mark_dict, net::AbstractPnmlNet)

Update each enabled transition's state in enabled_dict by testing its condition.

source
PNML.unwrap_pmsetMethod
unwrap_pmset(mark) -> Multiset

If marking wraps a PnmlMultiset, extract a singleton.

source
PNML.valueFunction
value(x)

Return value of x. Can be a wrapped value or a derived value. May return an Expr that returns the value when eval'ed.

source
PNML.value_typeFunction
value_type(::Type{<AbstractLabel}, ::APNTD) -> Type

Return the Type of a label's value.

source
PNML.varsubsFunction
varsubs(transition) -> Vector{NamedTuple}

Access the variable substitutions of a transition.

Variable substitutions depend on the current marking. Cache value in transition field as part of enabling rule phase of a Petri net lifecycle.

source
PNML.verify!Function
verify!(errors::Vector{String}, x, verbose::Bool, net::APN)
source
PNML.verifyMethod

Error if any diagnostic messages are collected. Especially intended to detect semantc error.

source
PNML.verify_ids!Method
verify_ids!(errors, str, iterable, net::APN) -> Vector{String}

Iterate over iterable testing that pid is registered in net. str used in message appended to errors vector of strings.

source
PNML.versionFunction

"Version of tool for this tool specific information element and its parser."

source
PNML.vertex_data!Method

Fill dictionary where keys are pnml ids, values are tuples of vertex code, place or transition.

source
PNML.zero_markingMethod

Return zero-valued object with same basis and eltype as place's marking.

Used in enabling and firing rules to deduce type of Arc's adjacent_place.

source
PNML.SortRefImplModule
SortRefImpl

SortRefImpl is the name of the Module created by Moshi @data to hold an ADT.

Each variant has a REFID Symbol that indexes one of the dictionaries in the network's declaration dictionary collection (DeclDict).

The REFID will be in the network's IDRegistry.

UserSortRef is created from <usersort declaration="id" />.

We use NamedSortRef -> ConcreteSort to add a name and REFID to built-in sorts, thus making them accessable. This extends this decoupling (symbols instead of sorts) to anonymous sorts that are inlined.

source

PNML.PnmlTypes

PNML.PnmlTypesModule

Petri Net Type Definition (pntd) URI mapped to AbstractPnmlType subtype singleton.

source
PNML.PnmlTypes.pntd_mapConstant

Map from Petri Net Type Definition (pntd) URI to Symbol. Allows multiple strings to map to the same pntd.

There is a companion map pnmltype_map that takes the symbol to a type object.

The URI is a string and may be the full URL of a pntd schema, just the schema file name, or a placeholder for a future schema.

For readability, the 'pntd symbol' should match the name used in the URI with inconvinient characters removed or replaced. For example, '-' is replaced by '_'.

source
PNML.PnmlTypes.AbstractPnmlTypeType
abstract type AbstractPnmlType

Abstract root of a dispatch type based on Petri Net Type Definitions (pntd).

Each Petri Net Markup Language (PNML) <net> element will have a single URI as a required 'type' XML attribute. That URI should refer to a RelaxNG schema defining the syntax and semantics of the XML model. See ISO 15909-2, http://www.pnml.org/ for details.

Selected abbreviations and URIs that do not resolve to a valid schema file are suported by this tool. See pntd_map.

Refer to pntd_symbol and pnmltype for how to get from the URI to a singleton.

source
PNML.PnmlTypes.HLCoreNetType
struct HLCoreNet <: PNML.PnmlTypes.AbstractHLCore

HLCoreNet can be used for generic high-level nets. We try to implement and test all function at `PnmlCoreNet level, but expect to find use for a concrete type at this level for testing high-level extensions.

source
PNML.PnmlTypes.HLPNGType
struct HLPNG <: PNML.PnmlTypes.AbstractHLCore

High-Level Petri Net Graphs (HLPNGs) are the most intricate High-Level Petri Net schema. It extends SymmetricNet, including with

  • declarations for sorts and functions (ArbitraryDeclarations)
  • sorts for Integer, String, and List
source
PNML.PnmlTypes.PTNetType
struct PTNet <: PNML.PnmlTypes.AbstractPnmlCore

Place-Transition Petri Nets add small extensions to core PNML. Integer-valued initialMarking and inscription.

The grammer file is ptnet.pnml so we name it PTNet. Note that 'PT' is often the prefix for XML tags specialized for this net type.

source
PNML.PnmlTypes.PnmlCoreNetType
struct PnmlCoreNet <: PNML.PnmlTypes.AbstractPnmlCore

The most minimal concrete Petri Net.

Used to implement and test the core PNML support. Covers the complete graph infrastructure including labels attached to nodes and arcs.

source
PNML.PnmlTypes.SymmetricNetType
struct SymmetricNet <: PNML.PnmlTypes.AbstractHLCore

Symmetric Petri Net is the best-worked use case in the primer and ISO 15909 standard part 2.

source
PNML.PnmlTypes.add_nettype!Method
add_nettype!(
    dict::AbstractDict,
    s::Symbol,
    pntd::PNML.PnmlTypes.AbstractPnmlType
) -> AbstractDict

Add or replace mapping from Symbol s to APNTD singleton pntd.

source
PNML.PnmlTypes.pnmltypeFunction
pnmltype(pntd::APNTD) -> pntd
pnmltype(uri::AbstractString) -> APNTD
pnmltype(s::Symbol; pnmltype_map) -> APNTD

Map either a text string or a symbol to a dispatch type object.

While that string may be a URI for a pntd, we treat it as a simple string without parsing. The PnmlTypes.pnmltype_map and PnmlTypes.pntd_map are both assumed to be correct here.

Unknown or empty uri will map to symbol :pnmlcore. Unknown symbol throws a DomainError exception.

Examples

jldoctest; setup=:(using PNML; using PNML: pnmltype, pntd_symbol)
julia> pnmltype(PnmlCoreNet())
PnmlCoreNet()

julia> pnmltype("nonstandard")
PnmlCoreNet()

julia> pnmltype(:symmetric)
SymmetricNet()
source
PNML.PnmlTypes.pntd_symbolMethod
pntd_symbol(s::AbstractString) -> Symbol

Map string s to a pntd symbol using pntd_map. Any unknown s is mapped to :pnmlcore. Returned symbol is a key of pnmltype_map.

Examples

julia> PNML.PnmlTypes.pntd_symbol("foo")
:pnmlcore
source

PNML.IDRegistrys

PNML.IDRegistrys.reset_reg!Method
reset_reg!(
    registry::PNML.IDRegistrys.IDRegistry
) -> PNML.IDRegistrys.IDRegistry

Empty the set of id symbols. Use case is tests.

source

PNML.Sorts

PNML.SortsModule

Part of the high-level pnml many-sorted algebra. See SortType.

NamedSort is a SortDecl (SortDeclaration) that gives a name and id to a Sort.

The pnml standard sometimes uses overlapping language. And explains little, expecting one to be knowledgeable about colored petri nets.

From the 'primer': built-in sorts of Symmetric Nets are the following: booleans, integerrange, finite enumerations, cyclic enumerations, products, dots and partitions.

And more sorts for HLPNG: integer, strings, list

With additions we made: real.

Oh, also ArbitrarySorts.

#! XXX The eltype is expected to be a concrete subtype of Number such as Int, Bool or Float64.

Extras

Notes:

  • NamedSort is a Declarations.SortDeclaration
  • HLPNG adds ArbitrarySort.
  • PartitionSort is called "Partition" in the standard.
  • SortRef holds the id symbol of a concrete sort.
  • We use sorts even for non-high-level nets.
  • Expect eltype(::AbstractSort) to return a concrete subtype of Number.
source
PNML.Sorts.BoolSortType

Built-in sort whose eltype is Bool

Operators: and, or, not, imply

Functions: equality, inequality

source
PNML.Sorts.CyclicEnumerationSortType
struct CyclicEnumerationSort <: PNML.Sorts.EnumerationSort

Orderedcollection of REFIDs into feconstant(net).

Operations differ between EnumerationSorts. All wrap a tuple of symbols and metadata, allowing attachment of Partition/PartitionElement.

See ISO/IEC 15909-2:2011/Cor.1:2013(E) defect 11 power or nth successor/predecessor

MCC2023/SharedMemory-COL-100000 has cyclic enumeration with 100000 <feconstant> elements.

source
PNML.Sorts.DotSortType
DotSort

Built-in sort whose eltype is Bool, the smallest Integer subtype that can represent one.

source
PNML.Sorts.ProductSortType
struct ProductSort{N, P<:PNML.AbstractPnmlNet} <: PNML.AbstractSort

An ordered collection of sorts. The elements of the sort are tuples of elements of each sort.

ISO 15909-1:2019 Concept 14 (color domain) finite cartesian product of color classes. Where sorts are the syntax for color classes and ProductSort is the color domain.

source
PNML.Sorts.make_sortrefFunction
make_sortref(net, dict, sort, seed, id, name) ->  SortRef`
  • dict is a method/callable that returns an AbstractDict a DeclDict attached to net.
  • sort ia a concrete sort that is to be in dict.
  • seed is passed to gensym if id is nothing and no sort is already in dict.
  • id is a Symbol and the string name are nothing and "" unless there is a wrapper providing such information,

Uses fill_sort_tag!.

Return concrete SortRef matching dict, wrapping id.

source
PNML.Sorts.refsMethod
refs(sort::EnumerationSort) -> Vector{REFID}

Return Vector of FEConstant REFIDs.

source
PNML.Sorts.sortsFunction
sorts(ps::ProductSort) -> Iterator
sorts(psr::SortRef, net::APN) -> Iterator

Return iterator over SortRefs to sorts in the product of sorts.

source
PNML.sortelementsMethod
sortelements(sort::EnumerationSort, ::APN) -> Iterator

Return iteratable ordered collection of keys into feconstant(net) dictionary.

source

PNML.Declarations

PNML.Declarations.AbstractDeclarationType
abstract type AbstractDeclaration

Declarations define objects/names that are used for high-level terms in conditions, inscriptions, markings. The definitions are attached to PNML nets and/or pages using a PNML Label defined in a <declarations> tag.

  • id
  • name
  • net
source
PNML.Declarations.ArbitraryOperatorType
struct ArbitraryOperator{N<:PNML.AbstractPnmlNet} <: PNML.Declarations.OperatorDeclaration
  • id::Symbol

  • name::Union{SubString{String}, String}

  • declaration::Symbol

  • net::PNML.AbstractPnmlNet

...arbitrary sorts and operators do not come with a definition of the sort or operation;

they just introduce a new symbol.

Like ArbitrarySort, does not have an associated algebra, not usable by SymmetricNet.

source
PNML.Declarations.ArbitrarySortType
struct ArbitrarySort{N<:PNML.AbstractPnmlNet} <: PNML.Declarations.SortDeclaration
  • id::Symbol

  • name::Union{SubString{String}, String}

  • net::PNML.AbstractPnmlNet

Arbitrary sorts that can be used for constructing terms are reserved for/supported by HLPNG in the pnml standard.

...arbitrary sorts and operators do not come with a definition of the sort or operation;

they just introduce a new symbol.

Like ArbitraryOperator, does not have an associated algebra, not usable by SymmetricNet.

source
PNML.Declarations.NamedOperatorType
struct NamedOperator{T, N<:PNML.AbstractPnmlNet} <: PNML.Declarations.OperatorDeclaration
  • id::Symbol

  • name::Union{SubString{String}, String}

  • parameter::Vector{PNML.Declarations.VariableDeclaration}

  • def::Any

  • net::PNML.AbstractPnmlNet

See UserOperator.

Vector of VariableDeclaration for parameters (ordered), and duck-typed AbstractTerm for its body.

source
PNML.Declarations.NamedSortType
struct NamedSort{S<:PNML.AbstractSort, N<:PNML.AbstractPnmlNet} <: PNML.Declarations.SortDeclaration
  • id::Symbol

  • name::Union{SubString{String}, String}

  • def::PNML.AbstractSort

  • net::PNML.AbstractPnmlNet

Declaration of a NamedSort gives an id and name to a concrete instance of a built-in AbstractSort. The sort defined in the XML file may be shared with other named sorts.

See MultisetSort, PartitionSort, PartitionSort. These are all Declaration subtypes in the UML2/RelaxNG parts of ISO 15909-2:2011 which has a strong Java bias. The text on the standard states they are also sort-like. We use a different type system.

source
PNML.Declarations.PartitionElementType
PartitionElement(id::Symbol, name, Vector{IDREF}, REFID)
  • id::Symbol

  • name::Union{SubString{String}, String}

  • terms::Vector{Symbol}

  • partition::Symbol

Establishes an equivalence class over a Declarations.PartitionSort's emumeration. See also FiniteEnumerationSort. Gives a name to an element of a partition. The element is an equivalence class.

PartitionElement is different from FiniteEnumeration, CyclicEnumeration, FiniteIntRangeSort in that it holds UserOperators, not FEConstants. The UserOperator refers to the FEConstants of the sort over which the partition is defined. NB: FEConstants are 0-arity operators. UserOperator is how operation declarations are accessed.

NB: The "PartitionElementOf" operator maps each element of the FiniteEnumeration (referenced by the partition) to the PartitionElement (of the partition) to which it belongs.

PartitionElementOf(partition, feconstant) -> PartitionElement partitionelementof(partition, feconstant) -> PartitionElement

PartitionElementOf is passed a REFID of the partition whose PartitionElement membership is being queried.

Each PartitionElement contains a collection of REFIDs to UserOperators which refer to a finite sort's (FiniteEnumeration, CyclicEnumeration, FiniteIntRangeSort) FEConstant by REFID.

Test for membership by iterating over each partition element, and over each term.

source
PNML.Declarations.PartitionSortType
struct PartitionSort{N<:PNML.AbstractPnmlNet} <: PNML.Declarations.SortDeclaration
  • id::Symbol

  • name::Union{SubString{String}, String}

  • def::PNML.SortRefImpl.var"typeof(SortRefImpl)"

  • elements::Vector{PNML.Declarations.PartitionElement}

  • net::PNML.AbstractPnmlNet

Partition sort declaration is a finite enumeration that is partitioned into sub-ranges of enumerations. Is the sort at the partition or the element level (1 sort or many sorts?)

Like NamedSort, will add an id and name to a sort, may be accessed by UserSortRef indirection.

source
PNML.Declarations.UnknownDeclarationType
struct UnknownDeclaration{N<:PNML.AbstractPnmlNet} <: PNML.Declarations.AbstractDeclaration
  • id::Symbol

  • name::Union{SubString{String}, String}

  • nodename::Union{SubString{String}, String}

  • content::PNML.AnyElement

  • net::PNML.AbstractPnmlNet

source
PNML.Declarations.VariableDeclarationType
struct VariableDeclaration{N<:PNML.AbstractPnmlNet} <: PNML.Declarations.AbstractDeclaration
  • id::Symbol

  • name::Union{SubString{String}, String}

  • sort::PNML.SortRefImpl.var"typeof(SortRefImpl)"

  • net::PNML.AbstractPnmlNet

Variable declaration <variabledecl> adds a name string and sort to the id shared with <variable> terms in non-ground terms.

EXAMPLE

variabledecls[id] = VariableDeclaration(id, "human name", sort)

source

PNML.PnmlGraphics

PNML.Labels.PnmlGraphicsModule
PnmlGraphics holds CSS-like data. Can be attached to 'AbstractPnmlObject`s and

Annotation label parts of PnmlNets.

source
PNML.Labels.PnmlGraphics.FontType

Font attributes as strings.

struct Font
  • family::String

  • style::String

  • weight::String

  • size::String

  • align::String

  • rotation::String

  • decoration::String

source
PNML.Labels.PnmlGraphics.GraphicsType

PNML Graphics can be attached to 'AbstractPnmlObjects andAnnotation` label parts of Pnml models.

struct Graphics{T<:Float32}
  • dimension::PNML.Coordinate

  • fill::PNML.Labels.PnmlGraphics.Fill

  • font::PNML.Labels.PnmlGraphics.Font

  • line::PNML.Labels.PnmlGraphics.Line

  • offset::PNML.Coordinate

  • positions::Vector{PNML.Coordinate}

source

PNML.Labels

PNML.Labels.ArcTypeType
struct ArcType <: PNML.Annotation
  • text::String

  • arctype::PNML.ArcTypeEnum.T

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

Arc type label.

source
PNML.Labels.ConditionType
(c::Condition)(args) -> Bool

Use args, a dictionary of variable substitutions into the expression to return a Bool.

source
PNML.Labels.ConditionType
struct Condition{T<:PNML.Expressions.PnmlExpr, N<:PNML.AbstractPnmlNet} <: PNML.HLAnnotation
  • text::Union{Nothing, String}

  • term::PNML.Expressions.PnmlExpr

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • vars::Vector{Symbol}

  • net::PNML.AbstractPnmlNet

Label a Transition with an boolean expression used to determine when/if the transition fires.

There may be other things evaluating to boolean used to determine transition firing filters, including: priority labels, inhibitor arc, place capacity labels, time/delay labels. ```

source
PNML.Labels.DeclarationType
struct Declaration <: PNML.Annotation
  • text::Union{Nothing, String}

  • ddict::PNML.DeclDict

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

Label of a <net> or <page> that holds zero or more declarations. The declarations are used to define parts of the many-sorted algebra used by High-Level Petri Nets.

All the declarations in the <structure> are placed into a single per-net dictionary collection ddict. The text, graphics, and toolspecinfos fields are expected to be nothing, but are present because, being labels, it is allowed.

source
PNML.Labels.HLLabelType
struct HLLabel{PNTD} <: PNML.HLAnnotation
  • text::Union{Nothing, String}

  • structure::Union{Nothing, PNML.AnyElement}

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

High-level pnml labels are expected to have <text> and <structure> elements. This concrete type is for "unclaimed" labels in a high-level petri net.

source
PNML.Labels.InscriptionType
struct Inscription{T<:PNML.Expressions.PnmlExpr, N<:PNML.AbstractPnmlNet} <: PNML.HLAnnotation
  • text::Union{Nothing, String}

  • term::PNML.Expressions.PnmlExpr

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • vars::Vector{Symbol}

  • net::PNML.AbstractPnmlNet

Labels an Arc with a expression term .

Inscription(t::PnmlExpr)() is a functor evaluating the expression and returns a value of the eltype of sort of inscription.

source
PNML.Labels.MarkingType
struct Marking{T<:PNML.Expressions.PnmlExpr, N<:PNML.AbstractPnmlNet} <: PNML.Annotation
  • term::PNML.Expressions.PnmlExpr

  • text::Union{Nothing, String}

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • net::PNML.AbstractPnmlNet

Label of Place.

Is a functor that returns the value. ```

source
PNML.Labels.MarkingMethod

Evaluate Marking instance by evaluating term expression.

Place/Transition Nets (and ContinuousNet) use collective token identity (map to Number). High-level Nets (SymmetricNet, HLPNG) use individual token identity (colored petri nets).

There is a multi-sorted algebra definition mechanism defined for HL Nets. HL Net Marking values are a ground terms of this multi-sorted algebra.

Used to initialize a marking vector that will then be updated by firing a transition.

source
PNML.Labels.NameType
struct Name <: PNML.Annotation
  • text::String

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

Name is for display, possibly in a tool specific way.

source
PNML.Labels.NupnToolType
struct NupnTool
  • nplaces::Int64

  • ntransitions::Int64

  • narcs::Int64

  • nunits::Int64

  • root::Symbol

  • safe::Bool

  • units::Vector{PNML.Labels.NupnUnit}

NupnTool is <toolspecific> content. Will be attached to a ToolInfo. Wraps an AnyElement.

source
PNML.Labels.PnmlLabelType
struct PnmlLabel{T, N<:PNML.AbstractPnmlNet} <: PNML.Annotation
  • tag::Union{SubString{String}, String, Symbol}

  • elements::Any

  • net::PNML.AbstractPnmlNet

Wrap a PNML Label as parsed by XMLDict. Use the XML tag as identifier.

Used for "unclaimed" labels that do not have, or we choose not to use, a dedicated parse method. Claimed labels will have a type/parser defined to make use of the structure defined by the pntd schema.

See also AnyElement which allows any well-formed XML, while PnmlLabel is restricted to PNML Labels.

source
PNML.Labels.PriorityType
struct Priority{T<:PNML.Expressions.PnmlExpr, N<:PNML.AbstractPnmlNet} <: PNML.Annotation
  • text::Union{Nothing, String}

  • term::PNML.Expressions.PnmlExpr

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • net::PNML.AbstractPnmlNet

Real valued label. An expected use is as a static transition Priority. Expected XML: <priority> <text>0.3</text> </priority>.

Dynamic priority is a function with arguments of net marking and transition.

source
PNML.Labels.RateType
struct Rate{T<:PNML.Expressions.PnmlExpr, N<:PNML.AbstractPnmlNet} <: PNML.Annotation
  • text::Union{Nothing, String}

  • term::PNML.Expressions.PnmlExpr

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • net::PNML.AbstractPnmlNet

Real valued label. An expected use is as a transition rate. Expected XML: <rate> <text>0.3</text> </rate>.

source
PNML.Labels.SortTypeType
struct SortType{N<:PNML.AbstractPnmlNet} <: PNML.Annotation
  • text::Union{Nothing, String}

  • sort_::PNML.SortRefImpl.var"typeof(SortRefImpl)"

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • net::PNML.AbstractPnmlNet

A places's <type> label wraps a UserSortRef that holds a REFID to the sort of a place, hence use of sorttype. It is the type (or set) concept of the many-sorted algebra.

For high-level nets there will be a declaration section with a rich language of sorts using UserSortFRef, NamedSort, PartitionSort or ArbitrarySort defined in the xml input.

For other PnmlNet's they are used internally to allow common implementations.

defines the type by referring to some sort; by the fixed interpretation of built-in sorts,

this sort defines the type of the place.

By the fixed interpretation of sorts, this implicitly refers to a set, which is the type of that place.

"refers to set" excludes multiset (as stated elsewhere in standard)

this is a sort, not a term, so no variables or operators.

The initial marking function M0 is defined by the label Marking of the places. ... this is a ground term of the corresponding multiset sort.

Ground terms have no variables and can be evaluated outside of a transition firing rule.

source
PNML.Labels.TimeType
struct Time{T<:PNML.Expressions.PnmlExpr, N<:PNML.AbstractPnmlNet} <: PNML.Annotation
  • text::Union{Nothing, String}

  • term::PNML.Expressions.PnmlExpr

  • graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}

  • toolspecinfos::Union{Nothing, Vector{PNML.Labels.ToolInfo}}

  • net::PNML.AbstractPnmlNet

Real valued label. An expected use is for a Time Petri net. Expected XML: <time> <text>0.3</text> </time>.

Dynamic time is a function with arguments of net marking and transition.

source
PNML.Labels.TokenGraphicsType
struct TokenGraphics
  • positions::Vector{PNML.Coordinate}

TokenGraphics is <toolspecific> content. Will be attached to a ToolInfo that also holds the tool name and version. Combines the <tokengraphics> and <tokenposition> elements.

source
PNML.Labels.ToolInfoType
struct ToolInfo{T, N<:PNML.AbstractPnmlNet}
  • toolname::String

  • version::String

  • info::Any

  • net::PNML.AbstractPnmlNet

A <toolspecific> tag holds well formed XML that is parsed into an AnyElement.

source
PNML.Labels._matchFunction
_match(tx, namerex::Regex, versionrex::Regex) -> Bool

Return true if both toolname and version match. Default is any version. Applies to ToolInfo, ToolParser, and other objects with a name and version method.

source
PNML.Labels.def_sort_elementMethod
def_sort_element(x, net)

Return an arbitrary element of sort x. All sorts are expected to be iteratable and non-empty, so we return first. Uses include default inscription value and default initial marking value sorts.

x can be anything with a sortelements(x, net) method that returns an iterator with length. See AbstractSort, SortType.

source
PNML.Labels.defaultFunction
default(::Type{T<:AbstractLabel}, pntd::APNTD, net::APN) -> T

Return a default instance of label T for pntd.

source
PNML.Labels.defaultMethod
default(
    _::Type{<:PNML.Labels.Marking},
    pntd::PNML.PnmlTypes.AbstractPnmlType,
    placetype::PNML.Labels.SortType,
    net::PNML.AbstractPnmlNet
) -> PNML.Labels.Marking{T} where T<:(PNML.Expressions.Bag{_A, Int64} where _A)

Return default marking value based on APNTD. Has meaning of empty, as in zero. For high-level nets, the marking is an empty multiset whose basis matches placetype. Others have a marking that is a Number.

source
PNML.Labels.delay_valueMethod
delay_value(
    t;
    tag,
    valtype,
    content_parser,
    default_value
) -> Tuple{Any, Float64, Union{Bool, Float64}}

Return transition delay label value as interval tuple: ("closure-string", left, right) Missing delay labels default to ("closed", 0.0, 0.0) a.k.a. zero.

All net types may have a delay. Expected label content copied from MathML. Only non-negative. ℝ⁺ static transition #TODO define term Supports

  • ("closed-open", 0.0, ∞) -> [0.0, ∞)
  • ("open-closed", 2.0, 6.0 -> (2.0, 6.0]
  • ("open", 2.0, 6.0) -> (2.0, 6.0)
  • ("closed", 2.0, 6.0) -> [2.0, 6.0]
source
PNML.Labels.get_toolinfosFunction
get_toolinfos(infos, toolname[, version]) -> Maybe{ToolInfo}

Return first toolinfo in iteratable collection infos having a matching toolname and version.

source
PNML.Labels.get_toolinfosMethod
get_toolinfos(infos, toolname::Regex, version::Regex) -> Iterator

infos may be a ToolInfo or collection of ToolParser, both have a name and version. Return iterator over infos matching toolname and version regular expressions.

source
PNML.Labels.label_valueMethod
label_value(n::AbstractPnmlNode, tag::Symbol, type) -> x::type

If there is a label tag in n.extralabels, return its value, else return a default value of the correct Type type.

source
PNML.Labels.priority_valueMethod
priority_value(t) -> Real

Return value of a Priority label. Missing priority labels are defaulted to one.

Expected label XML: <priority> <text>0.3</text> </priority>

Arguments

`t` is anything that supports `get_label(t, tag)`.
source
PNML.Labels.rate_valueMethod
rate_value(t) -> Real

Return value of a Rate label. Missing rate labels are defaulted to zero.

Expected label XML: <rate> <text>0.3</text> </rate>

Arguments

`t` is anything that supports `get_label(t, tag)`.
source
PNML.Labels.textMethod

Return text field. All labels are expected to have one that may be nothing or an empty string.

source
PNML.Labels.time_valueMethod
time_value(t) -> Real

Return value of a Time label. Missing time labels are defaulted to one.

Expected label XML: <time> <text>0.3</text> </time>

Arguments

`t` is anything that supports `get_label(t, tag)`.
source
PNML.Labels.validate_toolinfosMethod
validate_toolinfos(infos, dd) -> Bool

Validate each ToolInfo in the iterable infos collection.

Note that each info will contain an AbstractDict representing well-formed XML.

source
PNML.nameMethod

Name of tool for this tool specific information element.

source

PNML.Parser

PNML.Parser.ParseInscriptionTermType
ParseInscriptionTerm( Functor

Holds source & target parameters for parsing an inscription. The sort of the inscription must match the place sorttype. Input arcs (source is a transition) and output arcs (source is a place) called as (pit::ParseInscriptionTerm)(::XMLNode, ::APNTD)

source
PNML.Parser.add_toolinfo!Method
add_toolinfo!(collection, node, pntd, parse_contex) -> collection

Parse and add ToolInfo to infos collection, return infos.

The UML from the pnml primer (and schemas) use <toolspecific> as the tag name for instances of the type ToolInfo.

source
PNML.Parser.add_toolinfoMethod
add_toolinfo(infos::Maybe{collection}, node::XMLNode, pntd, parse_contex) -> collection

Allocate storage for infos on first use. Then add to infos.

source
PNML.Parser.allchildrenFunction
allchildren(node::XMLNode, tag::AbstractString) -> Vector{XMLNode}

Return vector of el's immediate children with tag.

source
PNML.Parser.alldecendentsFunction
alldecendents(node::XMLNode, tag::AbstractString) -> Vector{XMLNode}

Return vector of node's immediate children and decendents with tag.

source
PNML.Parser.attributeFunction
attribute(node::EzXML.Node, key::AbstractString) -> String
attribute(
    node::EzXML.Node,
    key::AbstractString,
    msg::String
) -> String

Return XML attribute value.

source
PNML.Parser.fill_decl_dict!Method
fill_decl_dict!(net::APN, node::XMLNode, pntd::APNTD) -> Nothing

Add a <declaration><structure><declarations> to DeclDict. <declaration> may be attached to <net> and/or <page> elements. Are network-level values even if attached to pages.

source
PNML.Parser.firstchildFunction
firstchild(node::XMLNode, tag::AbstractString) -> Maybe{XMLNode}

Return first immediate child of el that is a tag or nothing.

source
PNML.Parser.nupn_contentMethod
nupn_content(node::XMLNode, pntd::APNTD) -> NupnTool

Parse ToolInfo content. Example:

<toolspecific tool="nupn" version="1.1">
    <size places="P" transitions="T" arcs="A"/>
    <structure units="U" root="R" safe="S">
        <unit id="I">
            <places>PL</places>
            <subunits>UL</subunits>
        </unit>
    </structure>
    </toolspecific>
source
PNML.Parser.parse_arcMethod
parse_arc(node::XMLNode, pntd::APNTD) -> Arc

Construct an Arc with labels specialized for the APNTD.

source
PNML.Parser.parse_arctypeMethod
parse_arctype(
    node::EzXML.Node,
    pntd::PNML.PnmlTypes.AbstractPnmlType;
    net,
    parentid
)

Return ArcType label holding <text> value. With optional <toolspecific> & <graphics> information.

source
PNML.Parser.parse_conditionMethod
parse_condition(::XMLNode, ::APNTD; net::APN) -> Condition

Label of transition node. Used in the enabling function.

Details

ISO/IEC 15909-1:2019(E) Concept 15 (symmetric net) introduces Φ(transition), a guard or filter function, that is and'ed into the enabling function. 15909-2 maps this to <condition> expressions.

Later concepts add filter functions that are also and'ed into the enabling function.

  • Concept 28 (prioritized Petri net enabling rule)
  • Concept 31 (time Petri net enabling rule)

We support PTNets having <condition> with same syntax as High-level nets. Condition has <text> and <structure> elements, with all meaning in the <structure> that holds an expression evaluating to a boolean value.

One field of a Condition holds a boolean expression, AbstractBoolExpr. Another field holds information on variables in the expression.

source
PNML.Parser.parse_declaration!Function

Fill DeclDict from one or more <declaration> labels.

Expected format: <declaration> <structure> <declarations> <namedsort/> <namedsort/> ...

Assume behavior with the meaning in a <structure> for all nets.

Note the use of both declaration and declarations. We allow repeated declaration (without the s) here. All fill the same DeclDict. See fill_decl_dict!

source
PNML.Parser.parse_feconstantsMethod
parse_feconstants(::XMLNode, ::APNTD, ::SortRef; net::APN) -> Vector{Symbol}

Place the constants into feconstants(net) dictionary and return vector of finite enumeration constant REFIDs.

Access as 0-ary operator indexed by REFID

source
PNML.Parser.parse_fifoinitialMarkingMethod
parse_fifoinitialMarking(
    node::EzXML.Node,
    default_sorttype::Union{Nothing, PNML.Labels.SortType},
    pntd::PNML.PnmlTypes.AbstractHLCore;
    net,
    parentid
)

FIFO initial marking labels are expected to have a <structure> child containing ground terms. Sort of marking term must be the same as placetype, the place's SortType.

NB: Will coexist with hlinitialMarkings. See also parse_initialMarking, parse_hlinitialMarking.

source
PNML.Parser.parse_graphicsMethod
parse_graphics(
    node,
    pntd
) -> PNML.Labels.PnmlGraphics.Graphics{Float32}

Arcs, Annotations and Nodes have different graphics semantics. Return a Graphics holding the union of possibilities.

source
PNML.Parser.parse_hlinitialMarkingMethod
parse_hlinitialMarking(
    node::EzXML.Node,
    default_sorttype::Union{Nothing, PNML.Labels.SortType},
    pntd::PNML.PnmlTypes.AbstractHLCore;
    net,
    parentid
)

High-level initial marking labels are expected to have a <structure> child containing a ground term. Sort of marking term must be the same as placetype, the places SortType.

NB: Used by PTNets that assume placetype is DotSort(). See also parse_initialMarking, parse_fifoinitialMarking.

source
PNML.Parser.parse_hlinscriptionMethod
parse_hlinscription(
    node::EzXML.Node,
    source::Symbol,
    target::Symbol,
    pntd::PNML.PnmlTypes.AbstractHLCore;
    net,
    parentid
)

hlinscriptions are expressions.

source
PNML.Parser.parse_inscriptionMethod
parse_inscription(
    node::EzXML.Node,
    source::Symbol,
    target::Symbol,
    pntd::PNML.PnmlTypes.AbstractPnmlType;
    net,
    parentid
)

Ignore the source & target symbols.

source
PNML.Parser.parse_label_contentMethod
parse_label_content(node::XMLNode, termparser, pntd; net) -> NamedTuple

Parse top-level label node using a termparser callable applied to a <structure> element Return named tuple of: text, exp, sort, graphics, toolspecinfos, vars

Top-level labels are attached to nodes, such as: marking, inscription, condition. Each having a termparser.

Returns vars, a tuple of PNML variable REFIDs. Used in the muti-sorted algebra of High-level nets.

source
PNML.Parser.parse_nameMethod
parse_name(
    node::EzXML.Node,
    pntd::PNML.PnmlTypes.AbstractPnmlType;
    net,
    parentid
)

Return Name label holding <text> value. With optional <toolspecific> & <graphics> information.

source
PNML.Parser.parse_namedoperatorMethod
parse_namedoperator(
    node::EzXML.Node,
    pntd::PNML.PnmlTypes.AbstractPnmlType;
    net
)

Declaration of an operator expression in many-sorted algebra.

An operator of arity 0 is a constant (ground-term, literal). When arity > 0, the parameters are variables, using a NamedTuple for values.

source
PNML.Parser.parse_namedsortMethod
parse_namedsort(
    node::EzXML.Node,
    pntd::PNML.PnmlTypes.AbstractPnmlType;
    net
)

Declaration that wraps a Sort, adding an ID and name.

source
PNML.Parser.parse_netMethod
parse_net(node::XMLNode[; options...]) -> PnmlNet

PnmlNet created from an <net> XMLNode.

Arguments

  • pntd_override::Maybe{AbstractPnmlType}
source
PNML.Parser.parse_page!Method
parse_page!(net, page_idset, page_node, pntd) -> Nothing

Call _parse_page! to create a page with its own netsets. Add created page to parent's page_idset and pagedict(net).

source
PNML.Parser.parse_partitionelement!Method
parse_partitionelement!(elements::Vector{PartitionElement}, node::XMLNode rid::REFID; net::APN)

Parse a <partitionelement> XML node, add FEConstant refids to the element and append element to the vector.

source
PNML.Parser.parse_placeMethod
parse_place(
    node::EzXML.Node,
    pntd::PNML.PnmlTypes.AbstractPnmlType,
    net::PNML.AbstractPnmlNet
) -> Place
source
PNML.Parser.parse_sorttypeMethod
parse_sorttype(
    node::EzXML.Node,
    pntd::PNML.PnmlTypes.AbstractPnmlType;
    net,
    parentid
)

Annotation Label that defines the "sort" of tokens held by the place and semantics of the marking. NB: The "type" of a place from many-sorted algebra is different from the Petri Net "type" of a net or "pntd". Neither is directly a julia type. Nor a pnml sort.

We allow all pntd's places to have a <type> label. Non-high-level net places are expecting a numeric sort: eltype(sort) <: Number.

source
PNML.Parser.parse_sorttype_termMethod
parse_sorttype_term(::XMLNode, ::APNTD; net::APN) -> PnmlExpr, SortRef, Tuple

The PNML <type> of a <place> is a "sort" of the high-level many-sorted algebra. Because we are using the HL implementation with the other meta-models, we support it in all nets.

The term here is a concrete sort. It is possible to have an inlined concrete sort that is anonymous. We place all these concrete sorts in the decldict(net)` and pass around a SortRef.

See parse_sorttype for the rest of the AnnotationLabel structure.

source
PNML.Parser.parse_structureMethod
parse_structure(
    node::EzXML.Node,
    pntd::PNML.PnmlTypes.AbstractPnmlType;
    net
)

For future support of structure elements in non-High-Level nets.

source
PNML.Parser.parse_termMethod
parse_term(node::XMLNode, ::APNTD; ddict) -> (PnmlExpr, sort, vars)
parse_term(::Val{:tag}, node::XMLNode, ::APNTD; ddict) -> (PnmlExpr, sort, vars)

node is a child of a <structure>, <subterm> or <def> element with a nodename of tag.

All terms have a sort, #TODO ... document this XXX

Will be using TermInterface.jl to build an expression tree (AST) that can contain: operators, constants (as 0-arity operators), and variables.

AST expressions are evaluated for: - place initial marking vector, - enabling rule and - firing rule where condition and inscription expressions may contain non-ground terms (using variables).

source
PNML.Parser.parse_textMethod
parse_text(
    node::EzXML.Node,
    _::PNML.PnmlTypes.AbstractPnmlType
) -> String

Return the stripped string of <text> node's content.

source
PNML.Parser.parse_variabledeclMethod
parse_variabledecl(node::XMLNode, pntd::APNTD; net::APN) -> VariableDeclaration

Variable declarations associate an id, name and sort. Stored in DeclDict with key of id.

Variable declarationss may appear in the definition of an operator as well as directly in a declaration.

'<variabledecl>s' are referenced by '<variable>s' in terms.

Variables are used during enabling/firing a transition to identify tokens removed from input place markings, added to output place markings.

Variables are used to substitute tokens into expressions when evaluating terms.

source
PNML.Parser.subtermsMethod
subterms(node, pntd; vars) -> Vector{PnmlExpr}, Tuple{REFID}

Unwrap each <subterm> and parse into a PnmlExpr term. Collect expressions in a Vector and accumulate variable REFIDs in a Tuple.

source
PNML.Parser.xmldictMethod
xmldict(node::XMLNode) -> Union{XmlDictType, String, SubString{String}}

Return well formed XML as parsed by XMLDict.xml_dict. Symbols for attribute key, strings for element/child keys and strings for value of leaf.

See: anyelement, AnyElement,PnmlLabel

source

PNML.Expressions

PNML.Expressions.PnmlTupleExType
PnmlTupleEx(args::Vector)

PnmlTupleEx TermInterface expression object wraps an ordered collection of PnmlExpr objects. There is a related ProductSort: an ordered collection of sorts. Each tuple element will have the same sort as the corresponding product sort.

NB: ISO 15909 Standard considers Tuple to be an Operator.

source
PNML.Expressions.substituteMethod
substitute(expr, dict)

Recursivly substitute a VariableEx with its the value from var. The values in var will be ground terms of a place's sorttype. These values are from the current marking vector. ```

source
PNML.Expressions.toexprFunction
toexpr(ex::PnmlExpr, varsubs::NamedTuple{Symbol,Any}, net) -> Expr

Return Expr constructed from ex. Call toexpr on any contained terms. varsubs used to replace variables in expressions.

source

Index