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 PnmlType 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; ddict) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/inscriptions.jl:76
- default(::Type{<:PNML.Labels.Inscription}, ::PNML.PnmlTypes.AbstractHLCore, placetype::PNML.Labels.SortType; ddict) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/inscriptions.jl:79
- default(::Type{<:PNML.Labels.Inscription}, pntd::PNML.PnmlTypes.PnmlType, placetype::PNML.Labels.SortType; ddict) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/inscriptions.jl:73
- default(::Type{<:PNML.Labels.Marking}, pndt::PNML.PnmlTypes.AbstractHLCore, placetype::PNML.Labels.SortType; ddict) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/markings.jl:182
- default(::Type{<:PNML.Labels.Marking}, pntd::PNML.PnmlTypes.PnmlType, placetype::PNML.Labels.SortType; ddict) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/markings.jl:178
- default(::Type{<:PNML.Labels.Condition}, ::PNML.PnmlTypes.PnmlType; ddict) in PNML.Labels at /home/runner/work/PNML.jl/PNML.jl/src/Labels/conditions.jl:56
Examples
julia> c = default(Condition, PnmlCoreNet(); ctx.ddict)
Condition("", BooleanEx(BooleanConstant(true)))
julia> c()
true
julia> c = default(Condition, PnmlCoreNet(); ctx.ddict)
Condition("", BooleanEx(BooleanConstant(true)))
julia> c = default(Condition, PnmlCoreNet(); ctx.ddict)
Condition("", BooleanEx(BooleanConstant(true)))