-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Right now only types are matched to find event handler to execute.
Here's an improved query which could be used to find handlers which can support any kind of eventSpec and only find such handlers which satisfy all conditions
PREFIX as: <https://www.w3.org/ns/activitystreams#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX hydra: <http://www.w3.org/ns/hydra/core#>
prefix event: <https://hypermedia.app/events#>
prefix code: <https://code.described.at/>
DESCRIBE ?handler
WHERE {
{
select ?handler (count(?spec) as ?allSpecs) (count(?match) as ?matchedSpecs) {
VALUES ?activity { as:Activity as:Create }
BIND (<https://creta-todos.lndo.site/todos/item/Ride%20Corbet%27s%20couloir> as ?object)
?handler a event:EventHandler ;
event:eventSpec
[
rdf:predicate rdf:type ;
rdf:object ?activity
] ;
event:objectSpec ?spec ;
code:implementedBy ?impl ;
hydra:apiDocumentation <https://creta-todos.lndo.site/todos/api> .
optional {
?spec rdf:predicate ?p ;
rdf:object ?o .
?object ?p ?o .
BIND(?spec as ?match)
}
}
group by ?handler
having (count(?spec) = count(?match))
}
}Thus, if a handler was defined as
<>
events:objectSpec
[
rdf:predicate rdf:type ;
rdf:object </api/TodoItem> ;
],
[
rdf:predicate schema:status ;
rdf:object "IN PROGRESS" ;
] .it would only execute when the resource above was
<https://creta-todos.lndo.site/todos/item/Ride%20Corbet%27s%20couloir>
a </api/TodoItem> ;
schema:status "IN PROGRESS" ;
.Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers