I've noticed when using DefiantJS's XPath features to search a list of Caliper event JSON from OpenLRS that it's necessary to use some special node names that aren't explcitly shown in the data. For example, if the JSON were:
[
{
"edApp": {
"@id": "https://example.com/super-media-tool",
"@type": "http://purl.imsglobal.org/caliper/v1/SoftwareApplication",
"name": "Super Media Tool"
}
},
{
"navigatedFrom": {
"@id": "https://example.edu/politicalScience/2015/american-revolution-101/index.html",
"@type": "http://purl.imsglobal.org/caliper/v1/WebPage",
"name": "American Revolution 101 Landing Page"
},
"edApp": {
"@id": "https://example.com/viewer",
"@type": "http://purl.imsglobal.org/caliper/v1/SoftwareApplication",
"name": "Reader-O-Matic"
}
}
]
Note: This is valid JSON, but for the sake of brevity, they're not actually valid Caliper events, only fragments.
The whole list is called d:data
and each Caliper event object is called d:item
.
To select all events with a navigatedFrom
attribute:
//d:item[navigatedFrom]
To select all events sent from the "Reader-O-Matic" application:
//d:item[edApp[name="Reader-O-Matic"]]