How to extract all actuators that are switched off when there are no users at home. I tried to write Jena rule but am unable to get proper output. I have added desired result that I want. Need help with writing rule.
[rule1: noValue(:users :hasLocation :home) ->
(:actuators :hasLocation :home)
(:actuators :state "OFF"^^xsd:boolean)]
[rule2: noValue(:users :hasLocation :home) ->
(?x rdf:type :actuators)
(?x :hasLocation :home)
(?x :state "OFF"^^xsd:boolean)]
{ rulex: [noValue(:subject1 :hasPropertyP2 :Object1) ->
(:subject2 :hasProperty1 :Object2)
(:subject2 :hasPropertyP3 Object3)] }
Ontology:
class:user
Individual user_1 -> user
Individual user_2 -> user
.
.
class: actuators
subclass: ac -> actuators
subclass: light -> actuators
subclass: other -> actuators
Individual central_ac -> ac
Individual room_lighting -> light
Individual tv -> other
Individual refridgration -> other
Individual heater -> other
result for rule1 [:actuators :state "OFF"^^xsd:boolean]
result for rule2 [:4e62503a:14b01762f42:-7eea :state "OFF"^^xsd:boolean]
desired result:
[central_ac :state "OFF"^^xsd:boolean]
[room_lighting :state "OFF"^^xsd:boolean]
[tv :state "OFF"^^xsd:boolean]
.
.
The rule
doesn't do what you expect it to, and there may very well be some typos, too. In your ontology (in the future, please provide code that we can actually copy and paste, e.g.,the TTL serialization, or the OWL/FSS), you have a class called user, not users, but in your rule you talk about users. But even if that were corrected, you're not going to get the results you want, because you're using IRIs where you need to be using variables. Your rule says that
I think that you want a rule that says:
That would look more like:
This will start getting you results in your graph like
Note that I removed the ^^xsd:boolean datatype from "OFF", because "OFF" isn't a valid lexical form for the boolean datatype. You could use "true" or "false" instead.