Liking cljdoc? Tell your friends :D

com.yetanalytics.datasim.xapi.rule

Statement Template rules. Contains functions to parse rules, apply them to Statements, and validate Statements against rules.

Note that this namespace is used during both Profile compilation and Statement generation.

Statement Template rules. Contains functions to parse rules, apply them to
Statements, and validate Statements against rules.

Note that this namespace is used during both Profile compilation and
Statement generation.
raw docstring

add-rule-valuegenclj

(add-rule-valuegen extension-spec-map
                   valuesets
                   {:keys [presence path valueset none spec] :as parsed-rule})

If parsed-rule does not already have a valueset, then either derive one from the profile cosmos (i.e. the valuesets arg), or add a :spec and :generator to generate random values. This will ensure that during rule application, the rule will always be able to come up with a value.

Also revises any extension specs to those specified in extension-map.

If `parsed-rule` does not already have a `valueset`, then either
derive one from the profile cosmos (i.e. the `valuesets` arg), or
add a `:spec` and `:generator` to generate random values. This will
ensure that during rule application, the rule will always be able to
come up with a value.

Also revises any extension specs to those specified in `extension-map`.
sourceraw docstring

add-rules-valuegenclj

(add-rules-valuegen {:keys [activity-map verb-map extension-spec-map]}
                    parsed-rules)

Use information from iri-map and activities maps, to complete the parsed-rules by adding additional valuesets or spec generators.

Use information from `iri-map` and `activities` maps, to complete the
`parsed-rules` by adding additional valuesets or spec generators.
sourceraw docstring

apply-exclusion-rulesclj

(apply-exclusion-rules statement parsed-rules)

Given a partial statement and parsed-rules, apply all rules that do do have excluded presence to make the statement satisfy those rules. Excises values at the specified rule location.

Given a partial `statement` and `parsed-rules`, apply all rules that do
do have `excluded` presence to make the statement satisfy
those rules. Excises values at the specified rule location.
sourceraw docstring

apply-inclusion-rulesclj

(apply-inclusion-rules statement parsed-rules rng)

Given a partial statement and parsed-rules, apply all rules that do not have excluded presence to make the statement satisfy those rules. Must provide an rng in order to randomly choose or generate values; these values are then assoc'd into the proper position in statement as determined by the respective rule location.

Given a partial `statement` and `parsed-rules`, apply all rules that do
not have `excluded` presence to make the statement satisfy
those rules. Must provide an `rng` in order to randomly choose or
generate values; these values are then assoc'd into the proper position
in `statement` as determined by the respective rule location.
sourceraw docstring

apply-rulesclj

(apply-rules statement parsed-rules rng)

Apply all parsed-rules to a partial statement. An rng must be provided in order to randomly choose or generate values.

Apply all `parsed-rules` to a partial `statement`. An `rng` must be
provided in order to randomly choose or generate values.
sourceraw docstring

distinct-value-propertiesclj

source

follows-rule?clj

(follows-rule? statement
               {:keys [location any all none presence] :as _parsed-rule})

Simple predicate check to see if parsed-rule satisfies statement.

Note that in this function, recommended presence acts exactly like included presence. This is more strict than what the xAPI Profile spec specifies (in which recommended rules do not require values to be present at the location), but this is so recommended rules can still be applied to the statement.

Simple predicate check to see if `parsed-rule` satisfies `statement`.

Note that in this function, `recommended` presence acts exactly like
`included` presence. This is more strict than what the xAPI Profile spec
specifies (in which `recommended` rules do not require values to be
present at the location), but this is so `recommended` rules
can still be applied to the `statement`.
sourceraw docstring

max-enumerated-pathsclj

source

parse-rulesclj

(parse-rules rules)
(parse-rules object-property rules)

Parse a collection of rules and return a coll of parsed and separated rules with specs and generators applied. object-property may be provided if the containing Template contains an Object-related Determining property.

Parse a collection of `rules` and return a coll of parsed and
separated rules with specs and generators applied. `object-property`
may be provided if the containing Template contains an Object-related
Determining property.
sourceraw docstring

property-rule?clj

(property-rule? property {:keys [location]})

Does the first key at the rule's location equal property?

Does the first key at the rule's `location` equal `property`?
sourceraw docstring

rules->object-typesclj

(rules->object-types parsed-rules)

Derive object types from parsed-rules and return a map from paths to the set of possible object types at that location (e.g. one possible key-value pair is ["actor"] #{"agent" "group"}).

Derive object types from `parsed-rules` and return a map from paths
to the set of possible object types at that location (e.g. one
possible key-value pair is `["actor"] #{"agent" "group"}`).
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close