Default Values
Varies by PNTD. Possibilitie include:
- markings: return zero(
Int), zero(Float64), or empty multiset of same sort as adjacent place's sorttype. - inscription: return one(
Int), one(Float64), or singleton multiset of same sort as adjacent place's sorttype with value of first(elements(sort)). - condition: return
true, orBooleanConstant(true)
The ISO/IEC 15909-2 standard and the RelaxNG Schemas state 'natural numbers' and 'non-zero natural numbers'. I choose to also allow continuous values to support nonstandard continuous and hybrid valued Petri Nets. Makes generating default values more interesting.
Determine type of Number to parse with number_value by using value_type.
There are many items in the XML that are permitted to be missing and a defaut value is assumed. Examples are place initial marking, arc inscription, transition condition, graphics data.
- place initial marking is assumed to be empty, i. e. 0.
- arc inscription is assumed to be 1.
- transition condition is assumed to be true
- graphics data, e.g. token position, line width, are TBD
There are multiple kinds of nets supported by PNML.jl differing by (among other properties) the kind on number they use:
- discrete,
- continuous,
- and multi-sorted algebra
See PnmlType - Petri Net Type Definition for the full hierarchy.
This means there are at least 3 sets of default value types. We use the pntd AbstractPnmlType as a trait to determine the default types/values.
A consequence is that the default value's type ripples through the type system.
Methods
# 6 methods for generic function default from [35mPNML.Labels[39m:- default(::Type{<:PNML.Labels.Inscription}, pntd::PNML.PnmlTypes.AbstractContinuousNet, placetype::PNML.Labels.SortType, net::PNML.AbstractPnmlNet) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/inscriptions.jl:83
- default(::Type{<:PNML.Labels.Inscription}, pntd::PNML.PnmlTypes.AbstractHLCore, placetype::PNML.Labels.SortType, net::PNML.AbstractPnmlNet) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/inscriptions.jl:91
- default(::Type{<:PNML.Labels.Inscription}, pntd::PNML.PnmlTypes.AbstractPnmlType, placetype::PNML.Labels.SortType, net::PNML.AbstractPnmlNet) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/inscriptions.jl:76
- default(::Type{<:PNML.Labels.Marking}, pntd::PNML.PnmlTypes.AbstractHLCore, placetype::PNML.Labels.SortType, net::PNML.AbstractPnmlNet) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/markings.jl:161
- default(::Type{<:PNML.Labels.Marking}, pntd::PNML.PnmlTypes.AbstractPnmlType, placetype::PNML.Labels.SortType, net::PNML.AbstractPnmlNet) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/markings.jl:156
- default(::Type{<:PNML.Labels.Condition}, ::PNML.PnmlTypes.AbstractPnmlType, net::PNML.AbstractPnmlNet) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/conditions.jl:39
Examples
julia> c = default(Condition, PnmlCoreNet(), net)
Condition("", BooleanEx(BooleanConstant(true)))
julia> c()
true
julia> c = default(Condition, PnmlCoreNet(), net)
Condition("", BooleanEx(BooleanConstant(true)))
julia> c = default(Condition, PnmlCoreNet(), net)
Condition("", BooleanEx(BooleanConstant(true)))