Reaction data is internally stored in SQL LRS as JSON objects. The top-level spec for Reactions is as follows, with some properties being autogenerated when the reaction is stored or updated in SQL LRS:
Property | Type | Autogenerated? |
---|---|---|
id |
UUID | True |
created |
Timestamp | True |
modified |
Timestamp | True |
title |
String | False |
active |
Boolean | False |
ruleset |
Object | False |
The following are properties of ruleset
objects:
Property | Type | Description |
---|---|---|
conditions |
Object | Map from condition name strings to condition objects. |
template |
Object | xAPI Statement object that allows additional $templatePath properties. |
identityPaths |
Array | Array of path arrays (see below). |
A path array is an array of xAPI statement properties pointing to a particular location in the statement object, e.g. ["actor", "mbox"]
. A $templatePath
array is similar, except its first element is a condition name, e.g. ["condition_alpha", "actor", "mbox"]
.
The following are properties of condition objects. Condition objects may be a boolean and contain a single and
, or
, or not
property, or they can be statement criteria and contain path
, op
, and one of val
or ref
.
Property | Type | Description |
---|---|---|
path |
Array | Path array. |
op |
String | String denoting the reaction operation. One of the following: gt , lt , gte , lte , eq , noteq , like , contains . |
val |
Scalar | Comparison value; can be a string, boolean, number, or null . Type may have additional restrictions depending on the particular location in the statement. |
ref |
Object | Object that references another condition. |
and |
Array | Array of condition objects. |
or |
Array | Array of condition objects. |
not |
Object | Condition object to be negated. |
The following are properties of the ref
object:
Property | Type | Description |
---|---|---|
condition |
String | Referenced condition name. |
path |
Path Array | Path array for referenced statement. |
The following is the example reaction from the tutorial, in JSON format:
{
"id": "019257f4-d533-8c0b-8730-28b82f383982",
"created": "2024-10-04T14:35:16Z",
"modified": "2024-10-04T14:35:16Z",
"title": "reaction_example",
"active": true,
"ruleset": {
"conditions": {
"condition_alpha": {
"and": [
{
"path": [ "object", "id" ],
"op": "eq",
"val": "https://example.com/alpha"
},
{
"path": [ "verb", "id" ],
"op": "eq",
"val": "https://example.com/completed"
},
{
"path": [ "result", "success" ],
"op": "eq",
"val": true
}
]
},
"condition_beta": {
"and": [
{
"path": [ "object", "id" ],
"op": "eq",
"val": "https://example.com/beta"
},
{
"path": [ "verb", "id" ],
"op": "eq",
"val": "https://example.com/completed"
},
{
"path": [ "result", "success" ],
"op": "eq",
"val": true
},
{
"path": [ "timestamp" ],
"op": "gt",
"ref": {
"condition": "condition_alpha",
"path": [ "timestamp" ]
}
}
]
}
},
"template": {
"actor": {
"mbox": {
"$templatePath": [ "condition_alpha", "actor", "mbox" ]
}
},
"verb": {
"id": "https://example.com/completed"
},
"object": {
"id": "https://example.com/alpha-and-beta",
"objectType": "Activity"
}
},
"identityPaths": [
[ "actor", "mbox" ],
[ "actor", "mbox_sha1sum" ],
[ "actor", "openid" ],
[ "actor", "account", "homePage" ],
[ "actor", "account", "name" ]
]
}
}