Finite State Automaton (FSA)¶
This method applies a Finite State Automaton to detect patterns of obsels in the source trace, and produce an obsel in the transformed trace for each pattern occurence. It is based on the FSA4streams library.
origin) is not provided,
the model (resp. origin) of the source trace will be used instead.
fsa parameter expects a JSON description of the FSA,
as described in the FSA4streams documentation,
with the following specificities:
- The default matcher (even if not explicitly specified) is
transition.conditionis interpreted as an obsel type URI (either absolute or relative to the source trace’s model URI), and an obsel matches the transition if it has the corresponding obsel type.
- An additional matcher is also provided:
sparql-ask, which allows for more expressive condition as the previous one. It interprets conditions as the WHERE clause of a SPARQL ASK query, where
:is bound to the kTBS namespace,
m:is bound to the source trace model,
?obsis bound to the considered obsel,
?predis bound to the previous matching obsel (if any),
?firstis bound to the first matching obsel of the current match (if any).
max_durationconstraints (as specified in the documentation) apply to the end timestamps of the obsels.
- Terminal states may have two additional attributes
ktbs_attribute, described below.
For each match found by the FSA, a new obsel is generated:
The source obsels of the new obsel are all the obsels contributing to the match.
The begin and end timestamps of the new obsel are, respectively, the begin of the first source obsel and the end of the last source obsel.
The type of the new obsel is the value of the
ktbs_obsel_typeof the terminal state, interpreted as a URI relative to the computed trace’s model URI. If this attribute is omitted, the state identifier is used instead. If this attribute is
null, no obsel will be generated for the corresponding match.
If the terminal state has a
ktbs_attributesmodel, additional attributes will be generated for the new obsel. The value of
ktbs_attributesmust be a JSON object, whose keys are the target attribute type URIs (relative to the computed trace’s model URI), and whose values are source attribute type URIs (relative to the source trace’s model URI). Each target attribute will receive the value of the source attribute of the source obsels. If several values are available, the value of the latest source obsel will be kept. If none of the source obsel has a source attribute, the corresponding target attribute will not be set.
Additionally, the source attributes can be preceded by one of the following operators, in which case the value of the target operator will be the result of applying the operator to all the values of the source attributes in the source obsels:
last: returns the last value in chronological order (this is the default, see above);
first: returns the first value in chronological order;
count: returns the number of source obsel having the source attribute;
sum: returns the sum of all values;
avg: returns the average of all values;
min: returns the minimum value;
max: returns the maximum value;
span: returns the difference between the maximum and the minimum values;
concat: returns a space-separated concatenation of all the values.