I am trying to write a SPIN-Rule that will count the number of incoming references and set this number as a property value. E.g., count number of Issues that occurred on a particular machine. Therefore I need to count the number of incoming references of type rdfs:occuredOn
(domain: Issue, range: Machine).
CONSTRUCT {
?machine rdfs:numberOfIssues ?n .
}
WHERE {
?machine a ex:Machine .
?issue a ex:Issue .
?issue ?r ?machine .
(COUNT(?r) AS ?n) //Error
}
Thank you in advance!