PNML
PNML.PNML
— ModulePetri 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, LabelledArrays, 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 PnmlNet
s. Perhaps as new meta-models.
PNML.CONFIG
— ConstantSee PnmlConfig
for default values.
PNML.Maybe
— TypeAlias for Union{T
, Nothing
}.
PNML.XDVT
— TypeXMLDict.xml_dict
XMLDict Value Type is value or Vector of values from .
PNML.AbstractLabel
— Typeabstract type AbstractLabel
Labels are attached to the Petri Net Graph objects. See AbstractPnmlObject
.
Expected interface is for every concrete label to have fields: - text - graphics - tools - declarationdicts
PNML.AbstractOperator
— Typeabstract 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
.
PNML.AbstractPnmlNet
— Typeabstract type AbstractPnmlNet
PNML.AbstractPnmlNode
— Typeabstract type AbstractPnmlNode{PNTD} <: PNML.AbstractPnmlObject
Petri Net Graph nodes are Place
, Transition
. They are the source or target of an Arc
PNML.AbstractPnmlObject
— Typeabstract type AbstractPnmlObject
Objects of a Petri Net Graph are pages, arcs, nodes.
Expected interface is for every concrete object to have fields: - id - namelabel - graphics - labels - tools
PNML.AbstractSort
— TypeAbstractSort
PNML.AbstractTerm
— Typeabstract 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
.
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....
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 τ.
The term redex, short for reducible expression, refers to subterms that can be reduced by one of the reduction rules.
See Metatheory and SymbolicUtils
PNML.AbstractVariable
— Typeabstract type AbstractVariable <: PNML.AbstractTerm
Variables are part of the high-level pnml many-sorted algebra.
PNML.Annotation
— Typeabstract 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.
PNML.AnyElement
— Typestruct AnyElement
tag::Union{SubString{String}, String, Symbol}
elements::Union{SubString{String}, String, OrderedCollections.LittleDict{Union{String, Symbol}, Any, KS, VS} where {KS<:Union{Tuple{Vararg{Union{String, Symbol}}}, AbstractVector{Union{String, Symbol}}}, VS<:Union{Tuple, AbstractVector{Any}}}}
Hold well-formed XML. 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{DictType, Vector{DictType}}
See DictType
.
PNML.Arc
— TypeEdge of a Petri Net Markup Language graph that connects place and transition.
mutable struct Arc{I<:Union{PNML.Labels.HLInscription, PNML.Labels.Inscription}} <: PNML.AbstractPnmlObject
id::Symbol
source::Base.RefValue{Symbol}
target::Base.RefValue{Symbol}
inscription::Union{PNML.Labels.HLInscription, PNML.Labels.Inscription}
namelabel::Union{Nothing, PNML.Labels.Name}
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
labels::Union{Nothing, Vector{PNML.Labels.PnmlLabel}}
declarationdicts::PNML.DeclDict
PNML.BooleanConstant
— TypeBooleanConstant("true"|"false", decldict) is a built-in operator (constants are 0-ary operators).
c = BooleanConstant(true, decldict); c() == true
PNML.Context
— TypeStart as Singleton
PNML.Coordinate
— Typestruct Coordinate
x_::Float32
y_::Float32
Cartesian Coordinate are positive decimals. Ranges from 0 to 999.9.
PNML.Coordinate
— MethodConstruct a Coordinate from mixed Int, Float64.
PNML.DeclDict
— Typestruct DeclDict
variabledecls::Dict{Symbol, Any}
: HoldsVariableDeclaration
. AVariable
is used to locate the declaration's name and sort.
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.
PNML.DictType
— TypeDictionary passed to XMLDict.xml_dict
as dict_type
. See unparsed_tag
.
PNML.DotConstant
— TypeThe only element of DotSort
is DotConstant
.
PNML.FEConstant
— TypeFEConstant
Finite enumeration constant.
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", decldict)
fec() == :anID
fec.name = "somevalue"
PNML.FiniteIntRangeConstant
— Typestruct FiniteIntRangeConstant{T<:Integer} <: PNML.AbstractOperator
Must refer to a value between the start and end of the respective FiniteIntRangeSort
.
PNML.HLAnnotation
— Typeabstract type HLAnnotation <: PNML.AbstractLabel
Annotation label that adds <structure>.
PNML.LabelParser
— Typestruct LabelParser
tag::Symbol
func::Union{Function, Type}
Maps a Symbol
to a parser callable for a <labeltag>
tag's well-formed contents. The parser will be called as func(node, pntd) and return
PNML.MalformedException
— Typestruct MalformedException <: PNML.PnmlException
msg::String
PNML.MissingIDException
— Typestruct MissingIDException <: PNML.PnmlException
msg::String
Use exception to allow dispatch and additional data presentation to user.
PNML.NumberConstant
— TypeNumberConstant{T<:Number, S}
Builtin operator that has arity=0 means the same result every time, a constant. Restricted to NumberSorts, those Sort
s whose eltype
isa Number
.
PNML.Operator
— TypePNML Operator as Functor
tag maps to func, a functor/function Callable. Its arity is same as length of inexprs and insorts
PNML.Page
— Typemutable struct Page{PNTD<:PNML.PnmlTypes.PnmlType} <: PNML.AbstractPnmlObject
net::Base.RefValue{<:PNML.AbstractPnmlNet}
pntd::PNML.PnmlTypes.PnmlType
id::Symbol
namelabel::Union{Nothing, PNML.Labels.Name}
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
labels::Union{Nothing, Vector{PNML.Labels.PnmlLabel}}
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
PNML.ParseContext
— TypeParseContext
idregistry::PNML.PnmlIDRegistrys.PnmlIDRegistry
ddict::PNML.DeclDict
labelparser::Vector{PNML.LabelParser}
toolparser::Vector{PNML.ToolParser}
PNML.Place
— Typemutable struct Place{PNTD, M} <: PNML.AbstractPnmlNode{PNTD}
pntd::Any
id::Symbol
initialMarking::Any
sorttype::PNML.Labels.SortType
namelabel::Union{Nothing, PNML.Labels.Name}
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
labels::Union{Nothing, Vector{PNML.Labels.PnmlLabel}}
declarationdicts::PNML.DeclDict
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".
PNML.PnmlConfig
— TypeConfiguration 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.
PNML.PnmlException
— Typeabstract type PnmlException <: Exception
PNML.PnmlModel
— Typemutable struct PnmlModel
nets::Tuple{Vararg{PnmlNet}}
namespace::String
One or more Petri Nets.
PNML.PnmlMultiset
— Typepnmlmultiset(basis::SortRef, x::T, multi::Int=1) -> PnmlMultiset{T}
Construct as a multiset with one element, x
, with default multiplicity of 1.
PnmlMultiset wraps a Multisets.Multiset{T} where T
is the sort element type.
Some Operators
and [
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.
PNML.PnmlNet
— Typemutable struct PnmlNet{PNTD<:PNML.PnmlTypes.PnmlType} <: PNML.AbstractPnmlNet
type::PNML.PnmlTypes.PnmlType
id::Symbol
pagedict::OrderedCollections.OrderedDict{Symbol, Page{PNTD}} where PNTD<:PNML.PnmlTypes.PnmlType
netdata::PNML.PnmlNetData
page_set::OrderedCollections.OrderedSet{Symbol}
declaration::PNML.Labels.Declaration
namelabel::Union{Nothing, PNML.Labels.Name}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
labels::Vector{PNML.Labels.PnmlLabel}
idregistry::PNML.PnmlIDRegistrys.PnmlIDRegistry
One Petri Net of a PNML model.
PNML.PnmlNetData
— Typestruct 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 PnmlNodes
s & Arc
s 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.
PNML.PnmlNetKeys
— Typestruct 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 OrderedSet
s of pnml IDs for each "owned" Page
and other AbstractPnmlObject
.
PNML.PnmlTuple
— TypeISO 15909 Standard considers Tuple to be an Operator.
The <tuple>
operator is used to wrap an ordered collection of AbstractTerm
instances. When evaluated each term will have the same sort as corresponding element of a ProductSort.
PnmlTupleEx
is the PnmlExpr
that produces an expression calling pnmltuple
to create a Julia Tuple
after evaluating all arguments.
PNML.REFID
— TypeAlias for Symbol that refers to something with an ID Symbol.
PNML.RefPlace
— TypeReference Place node of a Petri Net Markup Language graph. For connections between pages.
struct RefPlace <: PNML.ReferenceNode
id::Symbol
ref::Symbol
namelabel::Union{Nothing, PNML.Labels.Name}
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
labels::Union{Nothing, Vector{PNML.Labels.PnmlLabel}}
declarationdicts::PNML.DeclDict
PNML.RefTransition
— TypeRefrence Transition node of a Petri Net Markup Language graph. For connections between pages.
struct RefTransition <: PNML.ReferenceNode
id::Symbol
ref::Symbol
namelabel::Union{Nothing, PNML.Labels.Name}
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
labels::Union{Nothing, Vector{PNML.Labels.PnmlLabel}}
declarationdicts::PNML.DeclDict
PNML.ReferenceNode
— Typeabstract type ReferenceNode <: PNML.AbstractPnmlObject
For common behavior shared by RefPlace
, RefTransition
used to connect Page
together.
PNML.SortRef
— TypeSortRef
Reference concrete sort (<:AbstractSort (or following that informal interface)) using a REFID
Symbol
that indexes one of the dictionaries in the network's declaration dictionary (DeclDict
).
The REFID
will be in the network's PnmlIDRegistry
.
Note the similarity to UserSort
and <usersort declaration="id" />
We use the UserSort
-> NamedSort
-> 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.
PNML.ToolParser
— Typestruct ToolParser
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)
.
PNML.Transition
— TypeTransition node of a Petri Net Markup Language graph.
mutable struct Transition{PNTD, C} <: PNML.AbstractPnmlNode{PNTD}
pntd::Any
id::Symbol
condition::Any
namelabel::Union{Nothing, PNML.Labels.Name}
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
labels::Union{Nothing, Vector{PNML.Labels.PnmlLabel}}
vars::Set{Symbol}
varsubs::Vector{NamedTuple}
: Cache of variable substutions for this transitiondeclarationdicts::PNML.DeclDict
PNML.UserOperator
— Typestruct UserOperator <: PNML.AbstractOperator
declaration::Symbol
declarationdicts::PNML.DeclDict
User operator wraps a REFID
to a OperatorDeclaration
.
PNML.Variable
— Typestruct Variable <: PNML.AbstractVariable
refvariable::Symbol
declarationdicts::PNML.DeclDict
Variable refers to a VariableDeclaration
. Example input: <variable refvariable="varx"/>.
#TODO examples of use, modifying and accessing
Base.:*
— Methodn*B
for PnmlMultisets is the scalar multiset product.
Base.:*
— MethodA*B
for PnmlMultisets is forwarded to Multiset
.
Base.:+
— MethodA+B
for PnmlMultisets is the disjoint union of enclosed multiset.
Base.:-
— MethodA-B
for PnmlMultisets is the disjoint union of enclosed multiset.
Base.:<
— MethodA<B
for PnmlMultisets is forwarded Multiset
.
Base.:<=
— MethodA<=B
for PnmlMultisets is forwarded Multiset
.
Base.:>
— MethodA>B
for PnmlMultisets is forwarded Multiset
.
Base.:>=
— MethodA>=B
for PnmlMultisets is forwarded Multiset
.
PNML._attribute
— MethodXMLDict uses symbols as keys. Value returned is a string.
PNML._cvt_inscription_value
— MethodConvert inscription value of PN_HLPNG from multiset to cardinality of the multiset.
PNML._get_op_dict
— MethodReturn operator dictionary containing key id
.
PNML._op_dictionaries
— MethodReturn tuple of operator dictionary fields in the Declaration Dictionaries.
PNML._ops
— MethodReturn iterator over operator dictionaries of Declaration Dictionaries.
PNML._sort_dictionaries
— MethodReturn tuple of sort dictionary fields in the Declaration Dictionaries.
PNML._sorts
— MethodReturn iterator over sort dictionaries of Declaration Dictionaries.
PNML.accum_varset!
— MethodCollect/intersect binding of one arc variable binding set.
PNML.accum_varsets!
— Methodaccum_varsets!(bvs, arc_bvs) -> Bool
Collect variable bindings, intersecting among arcs. Return enabled status of false if any variable does not have a substitution.
PNML.adjacent_place
— Functionadjacent_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
.
PNML.all_arcs
— FunctionPNML.allpages
— Methodallpages(net::PnmlNet|dict::OrderedDict) -> Iterator
Return iterator over all pages in the net. Maintains insertion order.
PNML.append_page!
— MethodAppend 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"
PNML.arbitraryop
— MethodLookup arbitraryop with id
in DeclDict.
PNML.arbitraryops
— MethodReturn dictionary of ArbitraryOperator
PNML.arbitrarysort
— MethodLookup arbitrarysort with id
in DeclDict.
PNML.arbitrarysorts
— MethodReturn dictionary of ArbitrarySort
PNML.arc
— FunctionReturn arc with id
if found, otherwise nothing
.
PNML.arc
— MethodReturn Arc
from 's' to 't' or nothing
. Useful for graphs where arcs are represented by a tuple(source,target).
PNML.arc_idset
— FunctionReturn iterator over arc ids.
PNML.arc_type
— Functionarc_type(pntd) -> Type(<:Arc)
PNML.arcs
— Functionarcs(n::PnmlNet) -> iterator
arcs(p::AbstractPetriNet) -> iterator
Return iterator over arc ids.
PNML.basis
— Functionbasis(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
.
PNML.basis
— Methodbasis(ms::PnmlMultiset) -> AbstractSort
Multiset basis sort is accessed through a SortRef that holds an REFID
index into decldict
, can be used to (B type parameter) is a REFID to a UserSort that references a NamedSort. Which gives a name and id to a built-in Sorts, ProductSorts, or other UserSorts. MultisetSorts not allowed here. Nor loops in sort references.
PNML.binding_value_sets
— Methodbinding_value_sets(net::PnmlNet, marking) -> Vector{Dict{REFID,Any}}
Return dictionary with transaction ID is key and value is binding set for variables of that transition. Each variable of an enabled transition will have a non-empty binding.
PNML.cardinality
— Methodcardinality(ms::PnmlMultiset, x) -> Integer
PNML.condition
— FunctionReturn condition's value of transition
.
PNML.condition
— Methodcondition(::Transition) -> Condition
Return condition label.
PNML.condition_type
— Functioncondition_type(x) -> Type(<:Condition)
PNML.conditions
— Functionconditions(net::PnmlNet) -> Iterator
Iterate over REFID => condition(transaction) pairs of net
. This is the same order as transactions
.
PNML.coordinate_type
— Functioncoordinate_type(x) -> Type(Coordinate)
PNML.declarations
— Methoddeclarations(dd::DeclDict) -> Iterator
Return an iterator over all the declaration dictionaries' values.
PNML.decldict
— Functiondecldict(x) -> DeclDict
PnmlNet
,Page
and Declaration
labels have bindings to the net-level DeclDict
.
PNML.deref!
— Methodderef!(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
- All ids in a network are unique in that they only have one instance in the XML.
- A chain of reference Places (or Transitions) always ends at a Place (or Transition).
- All ids are valid.
- No cycles.
PNML.deref_place
— Methodderef_place(net, id[], trim::Bool] ) -> Symbol
Return id of referenced place. If trim is true
(default) the reference is removed.
PNML.deref_transition
— Methodderef_transition(net, id[, trim::Bool] ) -> Symbol
Return id of referenced transition. If trim is true
(default) the reference is removed.
PNML.dict_show
— Functiondict_show(io::IO, x)
Internal helper for things that contain DictType
.
PNML.enabled
— Functionenabled(::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.
PNML.feconstant
— MethodLookup feconstant with id
in DeclDict.
PNML.feconstants
— MethodReturn dictionary of FEConstant
PNML.fill_nonhl!
— Methodfill_nonhl!(ctx::ParseContext; idreg::PnmlIDRegistry) -> DeclDict
Fill a DeclDict with built-ins and defaults (that may be redefined).
PNML.fill_sort_tag!
— Methodfill_sort_tag!(ctx::ParseContext, tag::Symbol, sort) -> fill_sort_tag!(ctx, tag, sort, dict)
fill_sort_tag!(ctx::ParseContext, tag::Symbol, sort, dict) -> SortRef
If not already in the declarations dictionary dict
, add sort
with key of tag
.
dict
defaults to namedsorts
a callable returning a dictionary in the DeclDict.
Register the tag and create and return a SortRef
holding tag
.
PNML.find_net
— Methodfind_net(model, id::Symbol) -> Union{Nothing, PnmlNet}
Return PnmlNet
having id
or nothing
`.
PNML.find_nets
— FunctionReturn nets matching pntd type
given as symbol or pnmltype singleton.
PNML.find_valuekey
— FunctionLook for matching value in dictionary, return key or nothing.
PNML.fire
— Methodfire(incidence, enabled, marking) -> LVector
Return the marking vector after firing transition: marking + incidence * enabled
marking
values added to product of incidence'
matrix and firing vector enabled
.
PNML.firstpage
— MethodUsually the only interesting page.
PNML.flatten_pages!
— Functionflatten_pages!(net::PnmlNet[; options])
Merge page content into the 1st page of the net.
Options
PNML.func
— MethodCallable.
PNML.func
— MethodReturn callable parser of a ToolInfo.
PNML.get_arc_bvs!
— Methodget_arc_bvs!(arc_bvs, arc_vars, placesort, mark, ddict) -> Bool
Fill arc_bvs
with an entry for each key in arc_vars
. Return true
if no variables are present or all variables have at least 1 substution.
PNML.get_label
— Functionget_label(x, tag::Symbol) -> PnmlLabel
Return first label of x
with a matching tagvalue
.
PNML.has_arc
— FunctionReturn true
if any arc
has id
.
PNML.has_key
— Methodhas_key(dd::DeclDict, dict, key::Symbol) -> Bool
Where dict
is the access method for a dictionary in DeclDict
.
PNML.has_label
— Functionhas_label(x, tag::Union{Symbol, String, SubString{String}) -> Bool
Does x
have any label with a matching tag
.
PNML.has_labels
— Functionhas_labels(x) -> Bool
Does x have any labels.
PNML.has_name
— Functionhas_name(x) -> Bool
Return true if there is a name. Some declarations (inside a label) have a name. Nodes (nets, pages, places, transitions, arcs) may optionally have a name (as a label).
PNML.has_operator
— MethodDoes any operator dictionary contain id
?
PNML.has_place
— FunctionReturn true
if there is any place with id
?
PNML.has_refplace
— FunctionPNML.has_reftransition
— FunctionPNML.has_sort
— Methodhas_sort(x) -> Bool
Predicate testing applicability of sortof
.
PNML.has_transition
— FunctionIs there a transition with id
?
PNML.inc_indent
— FunctionIncrement the :indent
value by inc
.
PNML.incidence_matrix
— Functionincidence_matrix(petrinet) -> LArray
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.
PNML.indent
— MethodReturn blank string of current indent size in io
.
PNML.initial_marking
— FunctionReturn the initial marking of a place.
PNML.input_matrix
— Functioninput_matrix(petrinet::AbstractPetriNet) -> Matrix{value_type(inscription_type(net), typeof(net))}
input_matrix(petrinet::PnmlNet) -> Matrix{value_type(inscription_type(net), typeof(net))}
Create and return a matrix ntransitions x nplaces.
PNML.inscription
— FunctionReturn incription value of arc
.
PNML.inscription
— Methodinscription(arc::Arc) -> Union{Inscription,HLInscription}
Access inscription label of arc.
PNML.inscription
— MethodForward inscription
to arcdict
PNML.inscription_type
— Functioninscription_type(x) -> Type(<:Inscription)
PNML.inscription_value
— Functioninscription_value(::Type{T}, a::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.
PNML.inscriptions
— Functioninscriptions(net::PnmlNet) -> Iterator
Iterate over REFID => inscription(arc) pairs of net
. This is the same order as arcs
.
PNML.isbuiltinoperator
— Methodisbuiltinoperator(::Symbol) -> Bool
Is tag in builtin_operators()
?
PNML.isfiniteoperator
— Methodiisfiniteoperator(::Symbol) -> Bool
Is tag in finite_operators()
?
PNML.isoperator
— Methodisoperator(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
PNML.ispid
— Methodispid(x::Symbol)
Return function to be used like: any(ispid(:asym), iterablewithpid).
PNML.labelof
— Methodlabelof(x, sym::Symbol) -> Maybe{PnmlLabel}
x
is anyting that supports haslabel/getlabel, tag
is the tag of the xml label element.
PNML.labels
— Functionlabels(x) -> Iterateable
labels(x, tag::Union{Symbol, String, SubString{String}) -> Iterateable
Return iterator of labels attached to x
.
PNML.logfile
— MethodReturn file path string after creating intermediate directories.
PNML.marking_type
— Functionmarking_type(x) -> Type(<:Marking)
PNML.multiplicity
— Methodmultiplicity(ms::PnmlMultiset, x) -> Integer
multiplicity(ms::Number, x) -> Number
PNML.multiset
— Methodmultiset(ms::PnmlMultiset) -> Multiset
Access wrapped multiset.
PNML.multisetsort
— MethodLookup multisetsort with id
in DeclDict.
PNML.multisetsorts
— MethodReturn dictionary of MultisetSort
PNML.name
— Functionname(x) -> String
Return name String. Default to empty string.
PNML.name
— MethodName of tool.
PNML.namedop
— MethodLookup namedop with id
in DeclDict.
PNML.namedoperators
— MethodReturn dictionary of NamedOperator
PNML.namedsort
— MethodLookup namedsort with id
in DeclDict.
PNML.namedsorts
— MethodReturn dictionary of NamedSort
PNML.netdata
— Functionnetdata(x) -> PnmlNetData
Access PnmlNet-level data structure.
PNML.nets
— Methodnets(model::PnmlModel) -> Tuple{Vararg{PnmlNet}}
Return all nets
of model
.
PNML.nettype
— FunctionReturn the PnmlType
subtype representing the flavor (or pntd) of this kind of Petri Net Graph.
See also pnmltype
PNML.null_function
— MethodDummy function
PNML.number_value
— Methodnumber_value(::Type{T}, s) -> T
Parse string as a type T <: Number.
PNML.operator
— Methodoperator(dd::DeclDict, id::Symbol) -> AbstractOperator
Return operator TermInterface expression for id
. toexpr(::OpExpr, 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.
#! CORRECT AbstractOperator type hierarchy that has Operator
as concrete type.
#! AbstractDeclarations and AbstractTerms are "parallel" hierarchies in the UML, #! with AbstractTerms divided into AbstractOperators and AbstractVariables.
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 thier sorts
#TODO partition element
#TODO arbitrary opearator
#TODO built-in operators
PNML.operators
— Methodoperators(dd::DeclDict)-> Iterator
Iterate over each operator in the operator subset of declaration dictionaries .
PNML.output_matrix
— Functionoutput_matrix(petrinet::AbstractPetriNet) -> Matrix{value_type(inscription_type(net), typeof(net))}
output_matrix(petrinet::PnmlNet) -> Matrix{value_type(inscription_type(net), typeof(net))}
Create and return a matrix ntransitions x nplaces.
PNML.page_type
— Functionpage_type(x) -> Type(<:Page)
PNML.pages
— Functionpages(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).
PNML.pages
— MethodIterator of Pages
directly owned by net
.
PNML.parser_context
— FunctionFill and return a ParserContext
object.
PNML.parser_context
— MethodFill and return a ParserContext
object.
PNML.partitionop
— MethodLookup partitionop with id
in DeclDict.
PNML.partitionops
— MethodReturn dictionary of partitionops (PartitionElement
)
PNML.partitionsort
— MethodLookup partitionsort with id
in DeclDict.
PNML.partitionsorts
— MethodReturn dictionary of PartitionSort
PNML.pid
— Functionpid(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.
PNML.place
— FunctionReturn the place with id
.
PNML.place_idset
— FunctionReturn iterator of all place IDs.
PNML.place_idset
— MethodReturn iterator over keys of a dictionary
PNML.place_type
— Functionplace_type(x) -> Type(<:Place)
PNML.places
— FunctionReturn iterator of all places.
PNML.pnml_hl_operator
— Methodpnml_hl_operator(tag::Symbol) -> Callable(::Vector{AbstractTerm})
Return callable with a single argument, a vector of inputs.
PNML.pnml_hl_outsort
— Methodpnml_hl_outsort(tag::Symbol; insorts::Vector{UserSortRef}) -> SortRef
Return sort that operator tag
returns.
PNML.pnmlmultiset
— Functionpnmlmultiset(basis::SortRef, x, multi::Int=1; ddict) -> PnmlMultiset
pnmlmultiset(basis::SortRef, x::Multisets.Multiset; ddict) -> PnmlMultiset
pnmlmultiset(basis::SortRef; ddict) -> 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 PnmlTuples)
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, ddict), variable_substitutions))
eval(toexpr(Bag(basis), ddict), variable_substitutions))
PNML.pnmltuple
— Methodpnmltuple(args...) -> Tuple
See PnmlTupleEx
PNML.post_flatten_verify
— MethodVerify a PnmlNet
after it has been flattened or is otherwise expected to be a single-page net.
PNML.postset
— Methodpostset(net, id) -> Iterator
Iterate ids of output (arc's target) for source transition or place id
.
See PNet.out_inscriptions
and transition_function
.
PNML.preset
— Methodpreset(net, id) -> Iterator
Iterate ids of input (arc's source) for output transition or place id
.
See PNet.in_inscriptions
and transition_function
.
PNML.productsort
— MethodLookup productsort with id
in DeclDict.
PNML.productsorts
— MethodReturn dictionary of ProdictSort
PNML.refid
— Functionrefid(x) -> REFID
Return reference id symbol. Multiple objects may hold the same refid value.
PNML.refplace
— FunctionReturn reference place matching id
.
PNML.refplace_idset
— Functionrefplace_idset(x) -> OrderedSet{Symbol} #TODO iterator?
Return reference place pnml ids.
PNML.refplace_type
— Functionrefplace_type(x) -> Type(<:RefPlace)
PNML.refplaces
— FunctionReturn vector of all reference places.
PNML.reftransition
— FunctionReturn reference transition matching id
.
PNML.reftransition_idset
— Functionreftransition_idset(x) -> OrderedSet{Symbol} #TODO iterator?
Return reference transition pnml ids.
PNML.reftransition_type
— Functionreftransition_type(x) -> Type(<:RefTransition)
PNML.reftransitions
— FunctionReturn vector of all reference transitions.
PNML.registry_of
— MethodReturn PnmlIDRegistry of a PnmlNet.
PNML.rewrite
— Methodrewrite(net)
Rewrite TermInterface expressions.
PNML.save_config!
— Functionsave_config!(config::PnmlConfig=CONFIG[])
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`
PNML.sortdefinition
— Functionsortdefinition(::SortDeclaration) -> 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.
Examples
sortdefinition(namedsort(decldict, refid))
sortdefinition(partitionsort(decldict, refid))
PNML.sortelements
— Functionsortelements(x) -> Iterator
Return iterator over elements of the sort of x.
PNML.sortelements
— Methodsortelements(ms::PnmlMultiset) -> iterator
Iterates over elements of the basis sort. May not be finite sort!
PNML.sortof
— Functionsortof(x) -> AbstractSort
Return the sort of an object or type. Any type that supports the PNML sort interface is expected to define has_sort
to be true and a sortof
method that returns a sort instance.
Often implemented as sortdefinition(namedsort(ddict, sortref(x)))
or other call of sortdefinition
. Default implementation is identity
.
We provide a sort for some Julia types: Integer
, Int64
, Float64
. Used for PTNet
.
PNML.sortof
— MethodSpecial case to IntegerSort()
, it is part of the name, innit.
PNML.sortref
— Functionsortref(x) -> SortRef
Return a REFID wrapped in a SortRef
.
Things that have a sortref include: Place, Arc, Inscription, HLInscription, Marking, HLMarking, MultisetSort, SortType, NumberConstant, Int64, Integer, Float64, FEConstant, FiniteIntRangeConstant, DotConstant, BooleanConstant, PnmlMultiset, Operator, Variable,
PNML.source
— Methodsource(arc) -> Symbol
Return identity symbol of source of arc
.
PNML.src_arcs
— FunctionPNML.tag
— Functiontag(x) -> Symbol
Return tag symbol. Multiple objects may hold the same tag value. Often used to refer to an XML tag.
PNML.tag
— MethodName of xml tag.
PNML.target
— Methodtarget(arc) -> Symbol
Return identity symbol of target of arc
.
PNML.term
— Functionterm(x)
Return 'PnmlExpr` term of x.
PNML.text_content
— FunctionFind first :text and return its :content as string.
PNML.tgt_arcs
— FunctionPNML.transition
— FunctionPNML.transition_idset
— FunctionPNML.transition_type
— Functiontransition_type(x) -> Type(<:Transition)
PNML.transitions
— FunctionReturn iterator of all transitions.
PNML.unwrap_pmset
— Methodunwrap_pmset(mark) -> Multiset
If marking wraps a PnmlMultiset, extract a singleton.
PNML.useroperator
— MethodLookup useroperator with id
in DeclDict.
PNML.useroperators
— MethodReturn dictionary of UserOperator
PNML.usersort
— MethodLookup usersort with id
in DeclDict.
PNML.usersorts
— MethodReturn dictionary of UserSort
PNML.validate_declarations
— Methodvalidate_declarations(dd::DeclDict) -> Bool
PNML.value
— Functionvalue(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.
PNML.value_type
— Functionvalue_type(::Type{<AbstractLabel}, ::Type{<:PnmlType}) -> Type
Return the Type of a label's value.
PNML.variabledecl
— MethodLookup variable with id
in DeclDict.
PNML.variabledecls
— MethodReturn dictionary of VariableDecl
PNML.varsubs
— Functionvarsubs(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.
PNML.verify
— MethodError if any diagnostic messages are collected. Especially intended to detect semantc error.
PNML.version
— Function"Version of tool for this tool specific information element and its parser."
PNML.vertex_codes
— Methodpnml id symbol mapped to graph vertex code.
PNML.vertex_data!
— MethodFill dictionary where keys are pnml ids, values are tuples of vertex code, place or transition.
PNML.vertex_labels
— Methodgraph vertex code mapped to pnml id symbol.
PNML.zero_marking
— MethodReturn 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
.
PNML.PnmlTypes
PNML.PnmlTypes
— ModulePetri Net Type Definition (pntd) URI mapped to PnmlType subtype singleton.
PNML.PnmlTypes.pnmltype_map
— ConstantThe key Symbols are the supported kinds of Petri Nets. Maps to singletons.
PNML.PnmlTypes.pntd_map
— ConstantMap 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 '_'.
PNML.PnmlTypes.AbstractContinuousNet
— Typeabstract type AbstractContinuousNet <: PNML.PnmlTypes.PnmlType
Uses floating point numbers for markings, inscriptions. Most of the functionality is shared with AbstractPnmlCore
. This seperates the
PNML.PnmlTypes.AbstractHLCore
— Typeabstract type AbstractHLCore <: PNML.PnmlTypes.PnmlType
Base of High Level Petri Net pntds which add large extensions to PNML core. hlinitialMarking, hlinscription, and defined label structures.
See PnmlTypes.HLCoreNet
, PnmlTypes.SymmetricNet
, PnmlTypes.PT_HLPNG
and others.
PNML.PnmlTypes.AbstractPnmlCore
— Typeabstract type AbstractPnmlCore <: PNML.PnmlTypes.PnmlType
Base of token/integer-based Petri Net pntds.
See PnmlCoreNet
, PTNet
and others.
PNML.PnmlTypes.ContinuousNet
— Typestruct ContinuousNet <: PNML.PnmlTypes.AbstractContinuousNet
TODO: Continuous Petri Net
PNML.PnmlTypes.HLCoreNet
— Typestruct 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.
PNML.PnmlTypes.HLPNG
— Typestruct 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
PNML.PnmlTypes.PTNet
— Typestruct 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.
PNML.PnmlTypes.PT_HLPNG
— Typestruct PT_HLPNG <: PNML.PnmlTypes.AbstractHLCore
Place-Transition Net in HLCoreNet notation.
PNML.PnmlTypes.PnmlCoreNet
— Typestruct 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.
PNML.PnmlTypes.PnmlType
— Typeabstract type PnmlType
Abstract root of a dispatch type based on Petri Net Type Definitions (pntd).
Each Petri Net Markup Language (PNML) network element will have a single pntd URI as a required 'type' XML attribute. That URI should refer to a RelaxNG schema defining the syntax and semantics of the XML model.
Selected abbreviations, URIs that do not resolve to a valid schema file, are also allowed.
Refer to pntd_symbol
and pnmltype
for how to get from the URI to a singleton.
PNML.PnmlTypes.SymmetricNet
— Typestruct SymmetricNet <: PNML.PnmlTypes.AbstractHLCore
Symmetric Petri Net is the best-worked use case in the primer
and ISO 15909 standard part 2.
PNML.PnmlTypes.add_nettype!
— Methodadd_nettype!(
dict::AbstractDict,
s::Symbol,
pntd::PNML.PnmlTypes.PnmlType
) -> AbstractDict
Add or replace mapping from Symbol s
to PnmlType
singleton pntd
.
PNML.PnmlTypes.all_nettypes
— MethodReturn iterator over PnmlType
singletons filtered by the prediciate p
.
PNML.PnmlTypes.all_nettypes
— MethodReturn iterator over PnmlType
singletons.
PNML.PnmlTypes.iscontinuous
— FunctionValues are floating point.
PNML.PnmlTypes.isdiscrete
— FunctionValues are integers.
PNML.PnmlTypes.ishighlevel
— FunctionValues are many-sorted.
PNML.PnmlTypes.pnmltype
— Functionpnmltype(pntd::T) -> PnmlType
pnmltype(uri::AbstractString) -> PnmlType
pnmltype(s::Symbol; pnmltype_map=pnmltype_map) -> PnmlType
Map either a text string or a symbol to a dispatch type singlton.
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()
PNML.PnmlTypes.pntd_symbol
— Methodpntd_symbol(s::AbstractString) -> Symbol
Map string s
to a pntd symbol using pntd_map
. Any unknown s
is mapped to :pnmlcore
. Returned symbol is suitable for pnmltype
to use to index into pnmltype_map
.
Examples
julia> PNML.PnmlTypes.pntd_symbol("foo")
:pnmlcore
PNML.PnmlIDRegistrys
PNML.PnmlIDRegistrys
— ModulePetri Net Markup Language identifier registry.
PNML.PnmlIDRegistrys.PnmlIDRegistry
— TypeHolds a set of PNML ID symbols and, optionally, a lock to allow safe reentrancy.
struct PnmlIDRegistry
PNML.PnmlIDRegistrys.isregistered
— Methodisregistered(
registry::PNML.PnmlIDRegistrys.PnmlIDRegistry,
id::Symbol
) -> Bool
Return true
if id
is registered in registry
.
PNML.PnmlIDRegistrys.register_id!
— Methodregister_id!(
registry::PNML.PnmlIDRegistrys.PnmlIDRegistry,
id::Symbol
) -> Symbol
Register id
symbol and return the symbol.
PNML.PnmlIDRegistrys.reset_reg!
— Methodreset_reg!(
registry::PNML.PnmlIDRegistrys.PnmlIDRegistry
) -> PNML.PnmlIDRegistrys.PnmlIDRegistry
Empty the set of id symbols. Use case is unit tests.
PNML.Sorts
PNML.Sorts.Sort
— TypeUnion of UserSort, ProductSort{N}, MultisetSort.
PNML.Sorts.BoolSort
— TypeBuilt-in sort whose eltype
is Bool
Operators: and, or, not, imply
Functions: equality, inequality
PNML.Sorts.CyclicEnumerationSort
— Typestruct CyclicEnumerationSort{N, M} <: PNML.Sorts.EnumerationSort{N, M}
Wraps tuple of REFIDs into feconstant(decldict).
Operations differ between EnumerationSort
s. 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.
PNML.Sorts.DotSort
— TypeDotSort
Built-in sort whose eltype
is Bool
, the smallest Integer subtype that can represent one.
PNML.Sorts.EnumerationSort
— Typeabstract type EnumerationSort{N, M} <: PNML.AbstractSort
See FiniteEnumerationSort
, PNML.Sorts.CyclicEnumerationSort
. Both hold an ordered collection of PNML.FEConstant
REFIDs and metadata.
PNML.Sorts.FiniteEnumerationSort
— TypeFiniteEnumerationSort(ntuple) -> FiniteEnumerationSort{N,M}
Wraps a tuple of FEConstant
REFIDs. Usage: feconstant(decldict)[refid]
.
PNML.Sorts.FiniteIntRangeSort
— Typestruct FiniteIntRangeSort{T<:Integer, M} <: PNML.AbstractSort
FiniteIntRangeSort(start::T, stop::T; meta) where {T<:Integer} -> Range
PNML.Sorts.IntegerSort
— TypeBuilt-in sort whose eltype
is Int
PNML.Sorts.ListSort
— Typestruct ListSort <: PNML.AbstractSort
PNML.Sorts.MultisetSort
— Typestruct MultisetSort <: PNML.AbstractSort
Wrap a UserSort. Warning: do not cause recursive multiset Sorts.
PNML.Sorts.NaturalSort
— TypeBuilt-in sort whose eltype
is Int
PNML.Sorts.NullSort
— TypeBuilt-in sort whose eltype
is Nothing
PNML.Sorts.PositiveSort
— TypeBuilt-in sort whose eltype
is Int
PNML.Sorts.ProductSort
— Typestruct ProductSort{N} <: 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 ProduceSort is the color domain.
PNML.Sorts.RealSort
— TypeBuilt-in sort whose eltype
is Float64
PNML.Sorts.StringSort
— Typestruct StringSort <: PNML.AbstractSort
PNML.Sorts.UserSort
— Typestruct UserSort <: PNML.AbstractSort
Holds a reference id (REFID) to a subtype of SortDeclaration
stored in a DeclDict
.
PNML.Declarations.NamedSort
is used to construct a sort out of builtin sorts. Also PNML.Declarations.ArbitrarySort
, PNML.Declarations.PartitionSort
.
Base.length
— MethodReturn number of FEConstants
contained by this sort.
PNML.Sorts.builtin_sorts
— MethodTuple of sort IDs that are considered builtin. There will be a version defined for each in the DeclDict
. Users may (re)define these.
PNML.Sorts.equals
— Methodequals(a::PNML.AbstractSort, b::PNML.AbstractSort) -> Any
For sorts to be the same, first they must have the same type. Then any contents of the sorts are compared semantically.
PNML.Sorts.isbuiltinsort
— Methodisbuiltinsort(::Symbol) -> Bool
Is tag in builtin_sorts()
.
PNML.Sorts.make_sortref
— Methodmake_sortref(parse_context, dict, sort, seed, id, name) -> SortRef`
dict
is a method/callable that returns an AbstractDict (in a DeclDict).sort
ia a concrete sort that is to be indict
.seed
is passed togensym
ifid
innothing
and nosort
is already indict
.id
is aSymbol
and the stringname
arenothing
and "" unless there is a wrapper providing such information,
Uses fill_sort_tag!
.
Return concrete SortRef matching dict
, wrapping id
.
PNML.Sorts.refs
— Methodrefs(sort::EnumerationSort) -> NTuple{N,REFID}
Return NTuple
of FEConstant
REFID
s.
PNML.Sorts.sorts
— Methodsorts(ps::ProductSort) -> NTuple
Return iterator over tuples of elements of sorts in the product.
PNML.namedsort
— MethodGet NamedSort from UserSort REFID
PNML.sortelements
— MethodElements of boolean sort
PNML.sortelements
— Methodsortelements(sort::EnumerationSort) -> Iterator
Return iterator into feconstant(decldict) for this sort's FEConstants
. Maintains order of this sort.
PNML.sortelements
— MethodReturn iterator from start
to stop
, inclusive.
PNML.Declarations
PNML.Declarations.AbstractDeclaration
— Typeabstract 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
PNML.Declarations.ArbitraryOperator
— Typestruct ArbitraryOperator <: PNML.Declarations.OperatorDeclaration
id::Symbol
name::Union{SubString{String}, String}
declaration::Symbol
declarationdicts::PNML.DeclDict
...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.
PNML.Declarations.ArbitrarySort
— Typestruct ArbitrarySort <: PNML.Declarations.SortDeclaration
id::Symbol
name::Union{SubString{String}, String}
body::Symbol
declarationdicts::PNML.DeclDict
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.
PNML.Declarations.NamedOperator
— Typestruct NamedOperator{T} <: PNML.Declarations.OperatorDeclaration
id::Symbol
name::Union{SubString{String}, String}
parameter::Vector{PNML.Declarations.VariableDeclaration}
def::Any
declarationdicts::PNML.DeclDict
See UserOperator
.
Vector of VariableDeclaration
for parameters (ordered), and duck-typed AbstractTerm
for its body.
PNML.Declarations.NamedSort
— Typestruct NamedSort{S<:PNML.AbstractSort} <: PNML.Declarations.SortDeclaration
id::Symbol
name::Union{SubString{String}, String}
def::PNML.AbstractSort
declarationdicts::PNML.DeclDict
Declaration of a NamedSort
. Wraps a concrete instance of an AbstractSort
. See MultisetSort
, ProductSort
, UserSort
.
PNML.Declarations.OperatorDeclaration
— Typeabstract type OperatorDeclaration <: PNML.Declarations.AbstractDeclaration
NamedOperator
. PNML.FEConstant
, PartitionElement
and ArbitraryOperator
are all referenced by UserOperator
.
UserOperator
wraps REFID used to access DeclDict
.
PNML.Declarations.PartitionElement
— TypePartitionElement(id::Symbol, name, Vector{IDREF}, REFID)
id::Symbol
name::Union{SubString{String}, String}
terms::Vector{Symbol}
partition::Symbol
declarationdicts::PNML.DeclDict
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.
PNML.Declarations.PartitionSort
— Typestruct PartitionSort <: PNML.Declarations.SortDeclaration
id::Symbol
name::Union{SubString{String}, String}
def::Symbol
elements::Vector{PNML.Declarations.PartitionElement}
declarationdicts::PNML.DeclDict
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, and is accessed by UserSort
.
PNML.Declarations.SortDeclaration
— Typeabstract type SortDeclaration <: PNML.Declarations.AbstractDeclaration
See Declarations.NamedSort
, Declarations.PartitionSort
and [Declarations.ArbitrarySort
] as concrete subtypes.
PNML.Declarations.UnknownDeclaration
— Typestruct UnknownDeclaration <: PNML.Declarations.AbstractDeclaration
id::Symbol
name::Union{SubString{String}, String}
nodename::Union{SubString{String}, String}
content::Vector{PNML.AnyElement}
declarationdicts::PNML.DeclDict
PNML.Declarations.VariableDeclaration
— Typestruct VariableDeclaration{S<:SortRef} <: PNML.Declarations.AbstractDeclaration
id::Symbol
name::Union{SubString{String}, String}
sort::SortRef
declarationdicts::PNML.DeclDict
Variable declaration <variabledecl>
adds a name string and sort to the id
shared with <variable>
terms in non-ground terms.
EXAMPLE
PNML.variabledecls[id] = VariableDeclaration(id, "human name", sort)
PNML.Declarations.contains
— FunctionReturn Bool true if partition contains the FEConstant
PNML.Declarations.element_ids
— MethodIterator over partition element REFIDs of a `PartitionSort
PNML.Declarations.element_names
— MethodIterator over partition element names
PNML.PnmlGraphics
PNML.Labels.PnmlGraphics.Fill
— TypeFill attributes as strings.
struct Fill
color::String
image::String
gradient_color::String
gradient_rotation::String
PNML.Labels.PnmlGraphics.Font
— TypeFont attributes as strings.
struct Font
family::String
style::String
weight::String
size::String
align::String
rotation::String
decoration::String
PNML.Labels.PnmlGraphics.Graphics
— TypePNML Graphics can be attached to many 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}
PNML.Labels.PnmlGraphics.Line
— TypeLine attributes as strings.
struct Line
color::String
shape::String
style::String
width::String
PNML.Labels
PNML.Labels.Condition
— Type(c::Condition)(args) -> Bool
Use args
, a dictionary of variable substitutions into the expression to return a Bool.
PNML.Labels.Condition
— Typestruct Condition{T<:PNML.Expressions.PnmlExpr, N} <: PNML.Annotation
text::Union{Nothing, String}
term::PNML.Expressions.PnmlExpr
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
vars::NTuple{N, Symbol} where N
declarationdicts::PNML.DeclDict
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.
Examples
julia> c = Labels.Condition(false, ctx.ddict)
Condition("", BooleanEx(BooleanConstant(false)))
julia> c()
false
julia> c = Labels.Condition("xx", BooleanEx(BooleanConstant(true, ctx.ddict)), ctx.ddict)
Condition("xx", BooleanEx(BooleanConstant(true)))
julia> c()
true
PNML.Labels.Declaration
— Typestruct Declaration <: PNML.Annotation
text::Union{Nothing, String}
ddict::PNML.DeclDict
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::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 ddict
. The text, graphics, and tools fields are expected to be nothing, but are present because, being labels, it is allowed.
PNML.Labels.HLInscription
— Typestruct HLInscription{T<:PNML.Expressions.PnmlExpr, N} <: PNML.HLAnnotation
text::Union{Nothing, String}
term::PNML.Expressions.PnmlExpr
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
vars::NTuple{N, Symbol} where N
declarationdicts::PNML.DeclDict
Labels an Arc with a term in a many-sorted algebra. See also Inscription
for non-high-level net inscriptions.
HLInscription(t::PnmlExpr)()
is a functor evaluating the expression and returns a value of the eltype
of sort of inscription.
PNML.Labels.HLLabel
— Typestruct HLLabel{PNTD} <: PNML.HLAnnotation
text::Union{Nothing, String}
structure::Union{Nothing, PNML.AnyElement}
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
declarationdicts::PNML.DeclDict
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.
Some "claimed" HLAnnotation
labels are Condition
, Declaration
, HLMarking
, HLInscription
.
PNML.Labels.HLMarking
— Typestruct HLMarking{T<:PNML.Expressions.PnmlExpr} <: PNML.HLAnnotation
text::Union{Nothing, String}
term::PNML.Expressions.PnmlExpr
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
declarationdicts::PNML.DeclDict
Multiset of a sort labeling of a Place
in a High-level Petri Net Graph. See AbstractHLCore
, AbstractTerm
, Marking
.
Is a functor that returns the evaluated value
.
... is a term with some multiset sort denoting a collection of tokens on the corresponding place, which defines its initial marking.
NB: The place's sorttype is not a multiset
a ground term of the corresponding multiset sort. (does not contain variables)
For every sort, the multiset sort over this basis sort is interpreted as the set of multisets over the type associated with the basis sort.
Multiset literals ... are defined using Add and NumberOf (multiset operators).
The term is a expression that will, when evaluated, have a Sort
. Implement the Sort interface.
Examples
; setup=:(using PNML; using PNML: HLMarking, NaturalSort, ddict)
julia> m = HLMarking(PNML.pnmlmultiset(UserSortRef(:integer), 1; ddict))
HLMarking(Bag(UserSortRef(:integer), 1))
julia> m()
1
PNML.Labels.HLMarking
— Method(hlm::HLMarking)() -> PnmlMultieset
Evaluate a HLMarking
term. Is a ground term so no variables. Used for initial marking value of a Place
when creating the initial_marking
.
PNML.Labels.Inscription
— Typestruct Inscription{T<:PNML.Expressions.PnmlExpr} <: PNML.Annotation
term::PNML.Expressions.PnmlExpr
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
declarationdicts::PNML.DeclDict
Labels an Arc. See also HLInscription
. ```
PNML.Labels.Marking
— Typestruct Marking{T<:PNML.Expressions.PnmlExpr} <: PNML.Annotation
term::PNML.Expressions.PnmlExpr
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
declarationdicts::PNML.DeclDict
Number-valued label of Place
. See PTNet
, ContinuousNet
, HLMarking
.
Is a functor that returns the value
. ```
PNML.Labels.Marking
— MethodEvaluate Marking
instance by returning the evaluated TermInterface expression.
The Marking
vs. HLMarking
values differ by handling of token identity. Place/Transition Nets (PNet, ContinuousNet) use collective token identity (map to ::Number). High-level Nets (SymmetricNet, HLPNG) use individual token identity (colored petri nets). TODO Cite John Baez for this distinction.
There is a multi-sorted algebra definition mechanism defined for HL Nets. HLMarking values are a ground terms of this multi-sorted algebra. There are abstract syntax trees defined by PNML. We use TermInterface to implement/manipulate the terms.
Inscription and condition expressions may contain variables that map to a place's tokens. HL Nets need to evaluate expressions as part of enabling and transition firing rules. The result must be a ground term, and is used to update a marking.
For non-High,level nets, the inscrition TermInterface expression evaluates to a Number and the condition is a boolean expression (default true).
PNML.Labels.Name
— Typestruct Name <: PNML.Annotation
text::String
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
Name is for display, possibly in a tool specific way.
PNML.Labels.PnmlLabel
— Typestruct PnmlLabel <: PNML.Annotation
tag::Union{SubString{String}, String, Symbol}
elements::Any
declarationdicts::PNML.DeclDict
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.
PNML.Labels.Rate
— Typestruct Rate{T<:Number} <: PNML.Annotation
value::Number
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
declarationdicts::PNML.DeclDict
Real valued label. An expected use is as a transition rate.
PNML.Labels.SortType
— Typestruct SortType <: PNML.Annotation
text::Union{Nothing, String}
sort_::SortRef
graphics::Union{Nothing, PNML.Labels.PnmlGraphics.Graphics}
tools::Union{Nothing, Vector{PNML.Labels.ToolInfo}}
declarationdicts::PNML.DeclDict
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 UserSort
& PNML.Declarations.NamedSort
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 HLMarking 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.
PNML.Labels.Structure
— Typestruct Structure
tag::Symbol
el::Any
High-level Annotation Labels place meaning in <structure> that is consumed by "claimed" labels. Is is expected to contain an abstract syntax tree (ast) for the many-sorted algebra expressed in XML. We implement this to allow use of <structure> tags by other PnmlTypes.
Extra
There are various defined structure ast variants in pnml:
- Sort Type of a Place [builtin, multi, product, user]
- Place HLMarking [variable, operator]
- Transition Condition [variable, operator]
- Arc Inscription [variable, operator]
- Declarations [sort, variable, operator]
These should all have dedicated parsers and objects as claimed labels. Here we provide a fallback for unclaimed tags.
PNML.Labels.TokenGraphics
— Typestruct TokenGraphics
positions::Vector{PNML.Coordinate}
TokenGraphics is <toolspecific> content. Combines the <tokengraphics> and <tokenposition> elements.
PNML.Labels.ToolInfo
— Typestruct ToolInfo{T}
toolname::String
version::String
infos::Vector
declarationdicts::PNML.DeclDict
Holds a <toolspecific> tag.
It wraps a iteratable collection (currently vector) of well formed elements parsed into AnyElement
s for use by anything that understands toolname, version tool specifics.
PNML.Labels._match
— Function_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.
PNML.Labels.def_sort_element
— Methoddef_sort_element(x)
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)
method that returns an iterator with length. See AbstractSort
, SortType
.
PNML.Labels.default
— Functiondefault(::Type{T<:AbstractLabel}, pntd::PnmlType; ddict::DeclDict) -> T
Return a default label T
for pntd
.
PNML.Labels.default
— Methoddefault(
::Type{<:PNML.Labels.Marking},
t::PNML.PnmlTypes.PnmlType;
ddict
)
Return default marking value based on PnmlType
. 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
.
PNML.Labels.default_typeusersort
— FunctionReturn instance of UserSortRef
for default SortType
of a PNTD
. Useful for non-high-level nets and PTNet. See PNML.fill_nonhl!
PNML.Labels.delay_value
— Methoddelay_value(
t;
tag,
valtype,
content_parser,
default_value
) -> Tuple{AbstractString, Float64, Union{Bool, Float64}}
Return 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 value type. Expected label XML: see MathML. Only non-negative.
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]
PNML.Labels.get_toolinfo
— Functionget_toolinfo(infos, toolname[, version]) -> Maybe{ToolInfo}
Return first toolinfo in iteratable collection infos
having a matching toolname and version. See has_toolinfo
.
PNML.Labels.get_toolinfos
— Functionget_toolinfos(infos, toolname::Regex, version::Regex) -> Iterator
infos
may be a collection of ToolInfo
or ToolParser
. Return iterator over infos
matching toolname and version regular expressions. Default version regex matches anything, returning all infos for a tool or all parsers for a tool.
PNML.Labels.has_toolinfo
— Functionhas_toolinfo(infos, toolname[, version]) -> Bool
Does any toolinfo in iteratable collection infos
have a matching toolname
, and a matching version
(if it is provided). toolname
and version
will be turned into Regex
s to match against each item in the infos
collection.
PNML.Labels.hastag
— Methodhastag(x, tagvalue::Union{Symbol, String, SubString{String}}) -> Bool
Test anything with a tag
accessor for equality with tagvalue
.
Usage: Iterators.filter(Fix2(hastag, :asymbol), iteratable)
PNML.Labels.infos
— MethodContent of a ToolInfo.
PNML.Labels.number_content_parser
— MethodParse content of <text>
as a number of value_type
.
PNML.Labels.rate_value
— Methodrate_value(t, pntd) -> 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 `labelof(t, tag)`.
`pntd::PnmlType`
`tag::String` is the XML element tag, default `"rate"`.
`value_type::Type{<:Number}` is concrete `Type` used to parse value.
`content_parser`::Base.Callable with arguments of `labelof(t, tag)` and `value_type`.
`default_value` = zero(value_type) is returned when `labelof(t, tag)` returns `nothing`.
PNML.Labels.text
— MethodReturn text
field. All labels are expected to have one that may be nothing
or an empty string.
PNML.Labels.validate_toolinfos
— Methodvalidate_toolinfos(infos, dd) -> Bool
Validate each ToolInfo
in the iterable infos
collection.
Note that each info may contain any well-formed XML. That XML for other tools must be ignored. Any info for this tool will have deeper validation implemented.
PNML.get_label
— MethodReturn label matching tagvalue
or
nothing``.
PNML.has_label
— MethodReturn true
if collection iteratable
contains label with tagvalue
.
PNML.name
— MethodName of tool to for this tool specific information element.
PNML.term
— Methodterm(marking) -> PnmlExpr
PNML.Parser
PNML.Parser
— ModuleParser module of PNML.
See LabelParser
, (ToolParser
)(@ref).
PNML.Parser.pnml_ns
— ConstantNamespace expected for pnml XML.
PNML.Parser.sort_ids
— ConstantTag names of sort XML elements.
PNML.Parser.ParseInscriptionTerm
— TypeParseInscriptionTerm(placetype) -> Functor
Holds parameters for parsing 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, ::PnmlType)
PNML.Parser.ParseMarkingTerm
— TypeParseMarkingTerm(placetype) -> Functor
Holds parameters for parsing when called as (f::T)(::XMLNode, ::PnmlType)
PNML.Parser.TermJunk
— TypeTermJunk
parse_term
returns a triple of: PnmlExpr, SortRef, NTuple{N,REFID}
PNML.Parser.XMLNode
— TypeAlias for EzXML.Node
PNML.Parser._parse_page!
— Method_parse_page!(net, node, pntd; ddict) -> Page
Place Page
in pagedict
using id as the key.
PNML.Parser.add_label!
— Methodadd_label!(collection, node, pntd) -> collection
Parse and add PnmlLabel
to collection, return collection.
See AbstractPnmlObject
for those XML entities that have labels. Any "unknown" XML is presumed to be a label.
PNML.Parser.add_label
— Methodadd_label(infos::Maybe{collection}, node::XMLNode, pntd, parse_context) -> collection
Allocate storage for collection on first use. Then parse and add a label.
PNML.Parser.add_toolinfo!
— Methodadd_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.
PNML.Parser.add_toolinfo
— Methodadd_toolinfo(infos::Maybe{collection}, node::XMLNode, pntd, parse_contex) -> collection
Allocate storage for infos
on first use. Then add to infos
.
PNML.Parser.allchildren
— Functionallchildren(node::XMLNode, tag::AbstractString) -> Vector{XMLNode}
Return vector of el
's immediate children with tag
.
PNML.Parser.alldecendents
— Functionalldecendents(node::XMLNode, tag::AbstractString) -> Vector{XMLNode}
Return vector of node's immediate children and decendents with tag
.
PNML.Parser.anyelement
— Methodanyelement(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType
) -> PNML.AnyElement
Return AnyElement
holding a well-formed XML node. See ToolInfo
for one intended use-case.
PNML.Parser.attribute
— Functionattribute(node::EzXML.Node, key::AbstractString) -> String
attribute(
node::EzXML.Node,
key::AbstractString,
msg::String
) -> String
Return XML attribute value.
PNML.Parser.deduce_sort
— FunctionReturn sort REFID of PnmlExpr.
PNML.Parser.fill_decl_dict!
— Methodfill_decl_dict!(ctx::ParseContext, node::XMLNode, pntd::PnmlType) -> ParseContext
Add <declaration>
<declarations>
to ParseContext. <declaration>
may be attached to <net>
and <page>
elements. Each will have contents in a <structure>
element. Are net-level values.
PNML.Parser.find_toolinfos!
— Methodfind_toolinfos!(tools, node, pntd, parse_context::ParseContext) -> tools
Calls add_toolinfo(tools, info, pntd, parse_context)
for each info found. See Labels.get_toolinfos
for accessing ToolInfo
s.
PNML.Parser.firstchild
— Functionfirstchild(
node::EzXML.Node,
tag::AbstractString
) -> Union{Nothing, EzXML.Node}
firstchild(
node::EzXML.Node,
tag::AbstractString,
namespace::AbstractString
) -> Union{Nothing, EzXML.Node}
Return up to 1 immediate child of el
that is a tag
. ns
is the default namespace. Invent a prefix to create an iterator of namespace prefix and URI pairs
PNML.Parser.kw!
— MethodAdd XMLNode attribute, value pair to dictionary.
PNML.Parser.parse_arc!
— MethodFill arcset, arcdict.
PNML.Parser.parse_arc
— Methodparse_arc(node::XMLNode, pntd::PnmlType) -> Arc
Construct an Arc
with labels specialized for the PnmlType.
PNML.Parser.parse_condition
— Methodparse_condition(::XMLNode, ::PnmlType; decldict) -> 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, BoolExpr
. Another field holds information on variables in the expression.
PNML.Parser.parse_condition_term
— Methodparse_condition_term(::XMLNode, ::PnmlType; decldict) -> PnmlExpr, SortRef, Tuple
Used as termparser
by parse_label_content
for Condition
label of a Transition
; will have a structure element containing a term.
PNML.Parser.parse_declaration!
— FunctionFill dd::[
DeclDict](@ref)
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!
PNML.Parser.parse_feconstants
— Methodparse_feconstants(::XMLNode, ::PnmlType, ::REFID; ddict) -> Tuple{<:SortRef}
Place the constants into feconstants(). Return tuple of finite enumeration constant REFIDs.
Access as 0-ary operator indexed by REFID
PNML.Parser.parse_graphics
— Methodparse_graphics(
node,
pntd
) -> PNML.Labels.PnmlGraphics.Graphics{Float32}
Arcs, Annotations and Nodes have different graphics semantics. Return a Graphics
holding the union of possibilities.
PNML.Parser.parse_graphics_coordinate
— Methodparse_graphics_coordinate(node, pntd) -> PNML.Coordinate
Return Coordinate
. Sandard seems to only use integers, we also allow real numbers.
PNML.Parser.parse_graphics_fill
— Methodparse_graphics_fill(
node,
pntd
) -> PNML.Labels.PnmlGraphics.Fill
Return Fill
PNML.Parser.parse_graphics_font
— Methodparse_graphics_font(
node,
pntd
) -> PNML.Labels.PnmlGraphics.Font
Return Font
.
PNML.Parser.parse_graphics_line
— Methodparse_graphics_line(
node,
pntd
) -> PNML.Labels.PnmlGraphics.Line
Return Line
.
PNML.Parser.parse_hlinitialMarking
— Methodparse_hlinitialMarking(
node::EzXML.Node,
placetype::PNML.Labels.SortType,
pntd::PNML.PnmlTypes.AbstractHLCore;
parse_context
)
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. Will be a UserSort
that holds the ID of a sort declaration.
NB: Used by PTNets that assume placetype is DotSort().
PNML.Parser.parse_hlinscription
— Methodparse_hlinscription(
node::EzXML.Node,
source::Symbol,
target::Symbol,
pntd::PNML.PnmlTypes.AbstractHLCore;
netdata,
parse_context
)
hlinscriptions are expressions.
PNML.Parser.parse_initialMarking
— Methodparse_initialMarking(
node::EzXML.Node,
placetype::PNML.Labels.SortType,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
Non-high-level PnmlType
initial marking parser. Most things are assumed to be Numbers.
PNML.Parser.parse_inscription
— Methodparse_inscription(
node::EzXML.Node,
source::Symbol,
target::Symbol,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
Ignore the source & target IDREF symbols.
PNML.Parser.parse_label_content
— Methodparse_label_content(node::XMLNode, termparser, pntd; decldict) -> NamedTuple
Parse top-level label node
using a termparser
callable applied to any <structure>
element. Also parses <text>
, <toolinfo>
, graphics
and sort of term.
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.
PNML.Parser.parse_name
— Methodparse_name(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
Return Name
label holding <text>
value. With optional <toolspecific>
& <graphics>
information.
PNML.Parser.parse_namedoperator
— Methodparse_namedoperator(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
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.
PNML.Parser.parse_namedsort
— Methodparse_namedsort(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
Declaration that wraps a Sort, adding an ID and name.
PNML.Parser.parse_net
— Methodparse_net(node::XMLNode[; options...]) -> PnmlNet
PnmlNet
created from an <net>
XMLNode
.
Arguments
- pntd_override::Maybe{PnmlType}
- parse_context::ParseContext
PNML.Parser.parse_net_1!
— MethodParse PNML <net> with a defined PnmlType used to set the expected behavior of labels attached to the nodes of a petri net graph, including: marking, inscription, condition and sorttype.
Page IDs are appended as the XML tree is descended, followed by node IDs.
PNML.Parser.parse_page!
— Methodparse_page!(net,netsets, node, pntd; context) -> Nothing
Call _parse_page!
to create a page with its own netsets
. Add this page to parent's page_idset(netsets)
and pagedist(net)
.
PNML.Parser.parse_partitionelement!
— Methodparse_partitionelement!(elements::Vector{PartitionElement}, node::XMLNode; ddict)
Parse <partitionelement>
, add FEConstant refids to the element and append element to the vector.
PNML.Parser.parse_place!
— MethodFill placeset, placedict.
PNML.Parser.parse_place
— Methodparse_place(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType;
context,
parse_context
)
PNML.Parser.parse_refPlace!
— MethodFill refplaceset, refplacedict.
PNML.Parser.parse_refPlace
— Methodparse_refPlace(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
PNML.Parser.parse_refTransition!
— MethodFill reftransitionset, reftransitiondict.
PNML.Parser.parse_refTransition
— Methodparse_refTransition(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
PNML.Parser.parse_sort
— Functionparse_sort(node::XMLNode, pntd::PnmlType,
id::Maybe{REFID}=nothing, name::String="";
parse_context::ParseContext)
parse_sort(::Val{:tag}, node::XMLNode, pntd::PnmlType, id, name;
parse_context::ParseContext)
Where tag
is the XML element tag name for a parser invoked using Val{:tag}.
See also parse_sorttype_term
, parse_namedsort
, parse_variabledecl
.
PNML.Parser.parse_sorttype
— Methodparse_sorttype(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
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.
PNML.Parser.parse_sorttype_term
— Methodparse_sorttype_term(::XMLNode, ::PnmlType; decldict) -> PnmlExpr, SortRef, Tuple
The PNML <type>
of a <place>
is a "sort" of the high-level many-sorted algebra. Because we are sharing the HL implementation with the other meta-models, we support it in all nets.
The term here is a concrete sort, usually UserSort
Ref. It is possible to have an inlined concrete sort that is anonymous. We place all these concrete sorts in the parse_context.ddict and pass around a SortRef.
See parse_sorttype
for the rest of the AnnotationLabel
structure.
PNML.Parser.parse_structure
— Methodparse_structure(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
Return PNML.Labels.Structure
holding an XML <structure>. Should be inside of an PNML label. A "claimed" label usually elids the <structure> level (does not call this method).
PNML.Parser.parse_term
— Methodparse_term(node::XMLNode, ::PnmlType; ddict) -> (PnmlExpr, sort, vars)
parse_term(::Val{:tag}, node::XMLNode, ::PnmlType; 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).
PNML.Parser.parse_term
— Method`<gtp>` Partition element greater than.
PNML.Parser.parse_term
— Methodparse_partitionelementof(elements::Vector{PartitionElement}, node::XMLNode)
Parse <partitionelement refpartition="id">
, add FEConstant refids to the element and append element to the vector.
PNML.Parser.parse_text
— Methodparse_text(
node::EzXML.Node,
_::PNML.PnmlTypes.PnmlType
) -> String
Return the stripped string of <text>
node's content.
PNML.Parser.parse_tokengraphics
— Methodparse_tokengraphics(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType
) -> PNML.Labels.TokenGraphics
Parse high-level place-transition net's (HL-PTNet) toolspecific structure defined for token graphics. See Labels.TokenGraphics
and parse_tokenposition
.
PNML.Parser.parse_tokenposition
— Methodparse_tokenposition(node, pntd) -> PNML.Coordinate
Return Cartesian Coordinate
relative to containing element.
PNML.Parser.parse_toolspecific
— Methodparse_toolspecific(node, pntd; parse_context, tp_vec)
Return ToolInfo
with tool & version attributes and content.
The content can be one or more well-formed xml elements.
PNML.Parser.parse_transition!
— MethodFill transitionset, transitiondict.
PNML.Parser.parse_transition
— Methodparse_transition(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
PNML.Parser.parse_unknowndecl
— Methodparse_unknowndecl(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
PNML.Parser.parse_usersort
— Methodparse_usersort(
node::EzXML.Node,
pntd::PNML.PnmlTypes.PnmlType;
parse_context
)
Returns concrete SortRef
wraping the REFID of a NamedSort
, ArbitrarySort
. or PartitionSort
.
PNML.Parser.parse_variabledecl
— Methodparse_variabledecl(node::XMLNode, pntd::PnmlType; parse_context::ParseContext) -> VariableDeclaration
Variables are used during firing a transition to identify tokens removed from input place markings, added to output place markings.
Variables are used in evaluating an <namedoperator.>
Variabledecls provide a name and sort.
Variabledecls may appear in the definition of an operator as well as directly in a declaration.
PNML.Parser.pnml_namespace
— Methodpnml_namespace(
node::EzXML.Node;
missing_ns_fatal,
default_ns
) -> String
Return namespace. When node
does not have a namespace return default value pnml_ns
and warn or throw an error.
PNML.Parser.pnmlmodel
— FunctionPNML.Parser.register_idof!
— Methodregister_idof!(
registry::PNML.PnmlIDRegistrys.PnmlIDRegistry,
node::EzXML.Node
) -> Symbol
Return registered symbol from id attribute of node. See PnmlIDRegistry
.
PNML.Parser.subterms
— Methodsubterms(node, pntd; vars) -> Vector{PnmlExpr}
Unwrap each <subterm>
and parse into a PnmlExpr
term. Collect expressions in a Vector
and variable REFIDs in a Tuple
.
PNML.Parser.to_sort
— Functionto_sort(sortref::SortRef; ddict::DeclDict) -> AbstractSort
Return concrete sort from ddict
using the REFID
in sortref
,
PNML.Parser.tokengraphics_content
— Methodtokengraphics_content(
node,
pntd
) -> Vector{PNML.Labels.TokenGraphics}
Parse ToolInfo content.
PNML.Parser.toolspecific_content_fallback
— MethodReturn Vector{AnyElement}
for each well-formed element of a <toolspecific>
node.`
PNML.Parser.unparsed_tag
— Methodunparsed_tag(node::XMLNode) -> (tag, Union{DictType, String, SubString{String}})
Return tuple holding a well formed XML tree as parsed by XMLDict.xml_dict
. Symbols for attribute key, strings for element/child keys and strings for value/leaf.
tag
is the name of the XML element that is "unparsed". It is the root of the tree.
PNML.Parser.unwrap_subterm
— Methodunwrap_subterm(st::XMLNode) -> XMLNode, Symbol
Unwrap a <subterm>
by returning tuple of child node and child's tag.
PNML.Parser.xmlroot
— Methodxmlroot(s::AbstractString) -> EzXML.Node
Parse string s
into EzXML node.
PNML.Parser.@xml_str
— MacroParse string into EzXML node.
See xmlroot
.
PNML.PNet
PNML.PNet.AbstractPetriNet
— Typeabstract type AbstractPetriNet{PNTD<:PNML.PnmlTypes.PnmlType}
Top-level of a single network in a pnml model that is some flavor of Petri Net. Note that pnml can represent nets that are not Petri Nets.
Here is where specialization and restriction are applied to achive Proper Petri Behavior.
Extended
Additional constrants can be imposed. We want to run under the motto: "syntax is not semantics, quack".
Since a PNML.Document model can contain multiple networks it is possible that a higher-level will create multiple AbstractPetriNet instances, each a different type.
Multiple Page
s can (are permitted to) be merged into one page by PNML.flatten_pages!
without losing any Petri Net semantics.
PNML.PNet.HLPetriNet
— TypeWrap a single pnml net. Presumes that the net does not need to be flattened as all content is in first page.
struct HLPetriNet{PNTD} <: PNML.PNet.AbstractPetriNet{PNTD}
ctx::PNML.Context
net::PnmlNet{PNTD} where PNTD
Details
PNML.PNet.HLPetriNet
— MethodConstruct from string of valid pnml XML, using the first network in model.
PNML.PNet.SimpleNet
— Typestruct SimpleNet{PNTD} <: PNML.PNet.AbstractPetriNet{PNTD}
id::Symbol
net::PnmlNet{PNTD} where PNTD
metadata::Any
TODO: Rename SimpleNet to TBD
SimpleNet is a concrete AbstractPetriNet
wrapping a single PnmlNet
.
Uses a flattened net to avoid the page level of the pnml hierarchy.
Note: A multi-page petri net can always be flattened by removing referenceTransitions & referencePlaces, and merging pages into the first page.
PNML.PNet.TransitionMatrices
— TypeTransitionMatrices
This data structure stores the transition matrix of an Petri net object. This is primarily used for constructing the vectorfield representation of the Petri net.
These are matrices of inscription value_type
PNML.PNet.counted_transitions
— Functioncounted_transitions(net) -> Pair(pid(tr)=>(in_counts=>out_counts))
Iterates over transitions producing a pair for each tansition := of a pair of tuples of inscription values for preset, postset arcs. Useful for petri net meta-models that need special handling to expand when inscription > 1.
PNML.PNet.in_inscriptions
— Methodin_inscriptions(net, transitionid) -> Iterator
Iterate over preset of transition, returning source place id => inscription value pairs.
PNML.PNet.in_out
— FunctionReturn tuple of input, output labelled vectors with key of place ids and value of arc inscription's value for use as a transition function. #TODO When do these get called "pre" and "post"?
PNML.PNet.initial_markings
— Functioninitial_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.
PNML.PNet.ins
— Methodins(net, transition_id) -> LVector
Inscription values labeled with source place id for arcs with transition_id
as the target id.
PNML.PNet.inscriptions
— Functioninscriptions(petrinet::AbstractPetriNet) -> [pid(arc) => inscription(arc)]
PNML.PNet.labeled_places
— Functionlabeled_places(net::PnmlNet)
Return Vector of placeid=>markingvalue.
PNML.PNet.labeled_transitions
— Functionlabeled_transitions((net::PnmlNet)) -> `(t_name=>t_rate)=>((input_states)=>(output_states))`
Iterates over transitions producing a pair for each tansition := Pair{Pair{Symbol,Number}, Pair{Tuple,Tuple}}
where the Symbol is the transition ID, Number is the rate value and the Tuples are place IDs.
PNML.PNet.out_inscriptions
— Methodout_inscriptions(net, transitionid) -> Iterator
Iterate over postset of transition, returning target place id => inscription value pairs.
PNML.PNet.outs
— Methodouts(net, transition_id) -> LVector
Inscription values labeled with target place id for arcs with transition_id
as the source id.
PNML.PNet.rates
— Functionrates(petrinet::AbstractPetriNet) -> [id(transition) => rate_value(transition, pntd)]
Return a vector of transitionid=>ratevalue.
We allow all PNML nets to be stochastic Petri nets. See rate_value
.
PNML.PNet.reachability_graph
— Methodreachability_graph
PNML.PNet.transition_function
— Functiontransition_function(petrinet::AbstractPetriNet) -> LVector{Symbol, Tuple{LVector,LVector}
Transition function of a Petri Net. Each transition has an input vector and an output vector. Each labelled vector is indexed by the place on the other end of the arc. Values are inscriptions of the arc.
keys are transition ids
values are tuple of input, output labeled vectors,
label is source or target place id - inscription (integer?)
PNML.metagraph
— Methodmetagraph(::AbstractPetriNet) -> MetaGraph
metagraph(::PnmlNet) -> MetaGraph
Return MetaGraph instance based on a SimpleDiGraph
with PNML nodes attached to vertices and edges.
PNML.Expressions
PNML.Expressions
— ModuleExpressions Module
PNML.Expressions.Bag
— TypeBag: a TermInterface expression calling pnmlmultiset(basis, x, multi) to construct a PNML.PnmlMultiset
.
See PNML.Operator
for another TermInterface operator.
PNML.Expressions.BoolExpr
— TypeTermInterface boolean expression types.
PNML.Expressions.BooleanEx
— TypeBooleanEx
TermInterface expression for a BooleanSort.
PNML.Expressions.DotConstantEx
— TypeDotConstantEx
TermInterface expression for a DotSort element.
PNML.Expressions.LiteralExpr
— TypeLiteralExpr(ex)
Literally ex
, an Expr
. toexpr
on LiteralExpr
recursively calls toexpr
on any interpolated symbolic expressions.
PNML.Expressions.NumberEx
— TypeNumberEx
TermInterface expression for a `<numberconstant>`.
PNML.Expressions.OpExpr
— TypeTermInterface operator expression types.
PNML.Expressions.PnmlExpr
— TypeTermInterface expression types.
PNML.Expressions.PnmlTupleEx
— TypePnmlTupleEx(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.
PNML.Expressions.substitute
— Methodsubstitute(expr, dict)
Recursivly substitute a VariableEx with its the value from dict
. The values in dict
will be ground terms of a place's sorttype. These values are from the current marking vector. ```
PNML.Expressions.toexpr
— Functiontoexpr(ex::PnmlExpr, varsubs::NamedTuple, ddict) -> Expr
Return Expr
. Recursivly call toexpr
on any contained terms. varsubs
used to replace variables with values in expressions.
TermInterface.maketerm
— Function@matchable TermInterface expressions
Index
PNML.Expressions
PNML.PNML
PNML.Parser
PNML.PnmlIDRegistrys
PNML.PnmlTypes
PNML.CONFIG
PNML.AbstractLabel
PNML.AbstractOperator
PNML.AbstractPnmlNet
PNML.AbstractPnmlNode
PNML.AbstractPnmlObject
PNML.AbstractSort
PNML.AbstractTerm
PNML.AbstractVariable
PNML.Annotation
PNML.AnyElement
PNML.Arc
PNML.BooleanConstant
PNML.Context
PNML.Coordinate
PNML.Coordinate
PNML.DeclDict
PNML.DictType
PNML.DotConstant
PNML.FEConstant
PNML.FiniteIntRangeConstant
PNML.HLAnnotation
PNML.LabelParser
PNML.MalformedException
PNML.Maybe
PNML.MissingIDException
PNML.NumberConstant
PNML.Operator
PNML.Page
PNML.ParseContext
PNML.Place
PNML.PnmlConfig
PNML.PnmlException
PNML.PnmlModel
PNML.PnmlMultiset
PNML.PnmlNet
PNML.PnmlNetData
PNML.PnmlNetKeys
PNML.PnmlTuple
PNML.REFID
PNML.RefPlace
PNML.RefTransition
PNML.ReferenceNode
PNML.SortRef
PNML.ToolParser
PNML.Transition
PNML.UserOperator
PNML.Variable
PNML.XDVT
PNML._attribute
PNML._cvt_inscription_value
PNML._get_op_dict
PNML._op_dictionaries
PNML._ops
PNML._sort_dictionaries
PNML._sorts
PNML.accum_varset!
PNML.accum_varsets!
PNML.adjacent_place
PNML.all_arcs
PNML.allpages
PNML.append_page!
PNML.arbitraryop
PNML.arbitraryops
PNML.arbitrarysort
PNML.arbitrarysorts
PNML.arc
PNML.arc
PNML.arc_idset
PNML.arc_type
PNML.arcs
PNML.basis
PNML.basis
PNML.binding_value_sets
PNML.cardinality
PNML.condition
PNML.condition
PNML.condition_type
PNML.conditions
PNML.coordinate_type
PNML.declarations
PNML.decldict
PNML.deref!
PNML.deref_place
PNML.deref_transition
PNML.dict_show
PNML.enabled
PNML.feconstant
PNML.feconstants
PNML.fill_nonhl!
PNML.fill_sort_tag!
PNML.find_net
PNML.find_nets
PNML.find_valuekey
PNML.fire
PNML.firstpage
PNML.flatten_pages!
PNML.func
PNML.func
PNML.get_arc_bvs!
PNML.get_label
PNML.get_label
PNML.has_arc
PNML.has_key
PNML.has_label
PNML.has_label
PNML.has_labels
PNML.has_name
PNML.has_operator
PNML.has_place
PNML.has_refplace
PNML.has_reftransition
PNML.has_sort
PNML.has_transition
PNML.inc_indent
PNML.incidence_matrix
PNML.indent
PNML.initial_marking
PNML.input_matrix
PNML.inscription
PNML.inscription
PNML.inscription
PNML.inscription_type
PNML.inscription_value
PNML.inscriptions
PNML.isbuiltinoperator
PNML.isfiniteoperator
PNML.isoperator
PNML.ispid
PNML.labelof
PNML.labels
PNML.logfile
PNML.marking_type
PNML.metagraph
PNML.multiplicity
PNML.multiset
PNML.multisetsort
PNML.multisetsorts
PNML.name
PNML.name
PNML.name
PNML.namedop
PNML.namedoperators
PNML.namedsort
PNML.namedsort
PNML.namedsorts
PNML.netdata
PNML.nets
PNML.nettype
PNML.null_function
PNML.number_value
PNML.operator
PNML.operators
PNML.output_matrix
PNML.page_type
PNML.pages
PNML.pages
PNML.parser_context
PNML.parser_context
PNML.partitionop
PNML.partitionops
PNML.partitionsort
PNML.partitionsorts
PNML.pid
PNML.place
PNML.place_idset
PNML.place_idset
PNML.place_type
PNML.places
PNML.pnml_hl_operator
PNML.pnml_hl_outsort
PNML.pnmlmultiset
PNML.pnmltuple
PNML.post_flatten_verify
PNML.postset
PNML.preset
PNML.productsort
PNML.productsorts
PNML.refid
PNML.refplace
PNML.refplace_idset
PNML.refplace_type
PNML.refplaces
PNML.reftransition
PNML.reftransition_idset
PNML.reftransition_type
PNML.reftransitions
PNML.registry_of
PNML.rewrite
PNML.save_config!
PNML.sortdefinition
PNML.sortelements
PNML.sortelements
PNML.sortelements
PNML.sortelements
PNML.sortelements
PNML.sortof
PNML.sortof
PNML.sortref
PNML.source
PNML.src_arcs
PNML.tag
PNML.tag
PNML.target
PNML.term
PNML.term
PNML.text_content
PNML.tgt_arcs
PNML.transition
PNML.transition_idset
PNML.transition_type
PNML.transitions
PNML.unwrap_pmset
PNML.useroperator
PNML.useroperators
PNML.usersort
PNML.usersorts
PNML.validate_declarations
PNML.value
PNML.value_type
PNML.variabledecl
PNML.variabledecls
PNML.varsubs
PNML.verify
PNML.version
PNML.vertex_codes
PNML.vertex_data!
PNML.vertex_labels
PNML.zero_marking
PNML.PnmlTypes.pnmltype_map
PNML.PnmlTypes.pntd_map
PNML.PnmlTypes.AbstractContinuousNet
PNML.PnmlTypes.AbstractHLCore
PNML.PnmlTypes.AbstractPnmlCore
PNML.PnmlTypes.ContinuousNet
PNML.PnmlTypes.HLCoreNet
PNML.PnmlTypes.HLPNG
PNML.PnmlTypes.PTNet
PNML.PnmlTypes.PT_HLPNG
PNML.PnmlTypes.PnmlCoreNet
PNML.PnmlTypes.PnmlType
PNML.PnmlTypes.SymmetricNet
PNML.PnmlTypes.add_nettype!
PNML.PnmlTypes.all_nettypes
PNML.PnmlTypes.all_nettypes
PNML.PnmlTypes.iscontinuous
PNML.PnmlTypes.isdiscrete
PNML.PnmlTypes.ishighlevel
PNML.PnmlTypes.pnmltype
PNML.PnmlTypes.pntd_symbol
PNML.PnmlIDRegistrys.PnmlIDRegistry
PNML.PnmlIDRegistrys.isregistered
PNML.PnmlIDRegistrys.register_id!
PNML.PnmlIDRegistrys.reset_reg!
PNML.Sorts.BoolSort
PNML.Sorts.CyclicEnumerationSort
PNML.Sorts.DotSort
PNML.Sorts.EnumerationSort
PNML.Sorts.FiniteEnumerationSort
PNML.Sorts.FiniteIntRangeSort
PNML.Sorts.IntegerSort
PNML.Sorts.ListSort
PNML.Sorts.MultisetSort
PNML.Sorts.NaturalSort
PNML.Sorts.NullSort
PNML.Sorts.PositiveSort
PNML.Sorts.ProductSort
PNML.Sorts.RealSort
PNML.Sorts.Sort
PNML.Sorts.StringSort
PNML.Sorts.UserSort
PNML.Sorts.builtin_sorts
PNML.Sorts.equals
PNML.Sorts.isbuiltinsort
PNML.Sorts.make_sortref
PNML.Sorts.refs
PNML.Sorts.sorts
PNML.Declarations.AbstractDeclaration
PNML.Declarations.ArbitraryOperator
PNML.Declarations.ArbitrarySort
PNML.Declarations.NamedOperator
PNML.Declarations.NamedSort
PNML.Declarations.OperatorDeclaration
PNML.Declarations.PartitionElement
PNML.Declarations.PartitionSort
PNML.Declarations.SortDeclaration
PNML.Declarations.UnknownDeclaration
PNML.Declarations.VariableDeclaration
PNML.Declarations.contains
PNML.Declarations.element_ids
PNML.Declarations.element_names
PNML.Labels.PnmlGraphics.Fill
PNML.Labels.PnmlGraphics.Font
PNML.Labels.PnmlGraphics.Graphics
PNML.Labels.PnmlGraphics.Line
PNML.Labels.Condition
PNML.Labels.Condition
PNML.Labels.Declaration
PNML.Labels.HLInscription
PNML.Labels.HLLabel
PNML.Labels.HLMarking
PNML.Labels.HLMarking
PNML.Labels.Inscription
PNML.Labels.Marking
PNML.Labels.Marking
PNML.Labels.Name
PNML.Labels.PnmlLabel
PNML.Labels.Rate
PNML.Labels.SortType
PNML.Labels.Structure
PNML.Labels.TokenGraphics
PNML.Labels.ToolInfo
PNML.Labels._match
PNML.Labels.def_sort_element
PNML.Labels.default
PNML.Labels.default
PNML.Labels.default_typeusersort
PNML.Labels.delay_value
PNML.Labels.get_toolinfo
PNML.Labels.get_toolinfos
PNML.Labels.has_toolinfo
PNML.Labels.hastag
PNML.Labels.infos
PNML.Labels.number_content_parser
PNML.Labels.rate_value
PNML.Labels.text
PNML.Labels.validate_toolinfos
PNML.Parser.pnml_ns
PNML.Parser.sort_ids
PNML.Parser.ParseInscriptionTerm
PNML.Parser.ParseMarkingTerm
PNML.Parser.TermJunk
PNML.Parser.XMLNode
PNML.Parser._parse_page!
PNML.Parser.add_label
PNML.Parser.add_label!
PNML.Parser.add_toolinfo
PNML.Parser.add_toolinfo!
PNML.Parser.allchildren
PNML.Parser.alldecendents
PNML.Parser.anyelement
PNML.Parser.attribute
PNML.Parser.deduce_sort
PNML.Parser.fill_decl_dict!
PNML.Parser.find_toolinfos!
PNML.Parser.firstchild
PNML.Parser.kw!
PNML.Parser.parse_arc
PNML.Parser.parse_arc!
PNML.Parser.parse_condition
PNML.Parser.parse_condition_term
PNML.Parser.parse_declaration!
PNML.Parser.parse_feconstants
PNML.Parser.parse_graphics
PNML.Parser.parse_graphics_coordinate
PNML.Parser.parse_graphics_fill
PNML.Parser.parse_graphics_font
PNML.Parser.parse_graphics_line
PNML.Parser.parse_hlinitialMarking
PNML.Parser.parse_hlinscription
PNML.Parser.parse_initialMarking
PNML.Parser.parse_inscription
PNML.Parser.parse_label_content
PNML.Parser.parse_name
PNML.Parser.parse_namedoperator
PNML.Parser.parse_namedsort
PNML.Parser.parse_net
PNML.Parser.parse_net_1!
PNML.Parser.parse_page!
PNML.Parser.parse_partitionelement!
PNML.Parser.parse_place
PNML.Parser.parse_place!
PNML.Parser.parse_refPlace
PNML.Parser.parse_refPlace!
PNML.Parser.parse_refTransition
PNML.Parser.parse_refTransition!
PNML.Parser.parse_sort
PNML.Parser.parse_sorttype
PNML.Parser.parse_sorttype_term
PNML.Parser.parse_structure
PNML.Parser.parse_term
PNML.Parser.parse_term
PNML.Parser.parse_term
PNML.Parser.parse_text
PNML.Parser.parse_tokengraphics
PNML.Parser.parse_tokenposition
PNML.Parser.parse_toolspecific
PNML.Parser.parse_transition
PNML.Parser.parse_transition!
PNML.Parser.parse_unknowndecl
PNML.Parser.parse_usersort
PNML.Parser.parse_variabledecl
PNML.Parser.pnml_namespace
PNML.Parser.pnmlmodel
PNML.Parser.register_idof!
PNML.Parser.subterms
PNML.Parser.to_sort
PNML.Parser.tokengraphics_content
PNML.Parser.toolspecific_content_fallback
PNML.Parser.unparsed_tag
PNML.Parser.unwrap_subterm
PNML.Parser.xmlroot
PNML.Parser.@xml_str
PNML.PNet.AbstractPetriNet
PNML.PNet.HLPetriNet
PNML.PNet.HLPetriNet
PNML.PNet.SimpleNet
PNML.PNet.TransitionMatrices
PNML.PNet.counted_transitions
PNML.PNet.in_inscriptions
PNML.PNet.in_out
PNML.PNet.initial_markings
PNML.PNet.ins
PNML.PNet.inscriptions
PNML.PNet.labeled_places
PNML.PNet.labeled_transitions
PNML.PNet.out_inscriptions
PNML.PNet.outs
PNML.PNet.rates
PNML.PNet.reachability_graph
PNML.PNet.transition_function
PNML.Expressions.Bag
PNML.Expressions.BoolExpr
PNML.Expressions.BooleanEx
PNML.Expressions.DotConstantEx
PNML.Expressions.LiteralExpr
PNML.Expressions.NumberEx
PNML.Expressions.OpExpr
PNML.Expressions.PnmlExpr
PNML.Expressions.PnmlTupleEx
PNML.Expressions.substitute
PNML.Expressions.toexpr