SWRL - Rules depending on other rules assertions

Currently I'm developing an ontology to represent preferences that a specific user may have about something. For example, the user may have an MediaVolumeLevel preference set to VolumeLevel_3.

The different levels (individuals of the class MediaVolumeLevel) are: VolumeLevel_1, VolumeLevel_2, VolumeLevel_3 and VolumeLevel_4.

The user and the Preference are linked by the objectProperty hasMediaVolumeLevelPreference.

The objectProperty assertion need to be inferred from other User aspects through SWRL rules. For example, if the user has a hearing difficulty, the MediaVolumeLevel needs to be set to VolumeLevel_4. So:

User(?u), hasDifficulty(?u,Hearing) -> hasMediaVolumeLevelPreference(?u,VolumeLevel_4)

This is working fine. But, since I have other SWRL rules that also infer the MediaVolumeLevel for the same users, such as:

User(?u), hasContext(?u,NoisyRoom) -> hasMediaVolumeLevelPreference(?u, VolumeLevel_3)

and SWRL supports monotonic inference only, the reasoner will assert both VolumeLevels (VolumeLevel_4 and VolumeLevel_3).

What I need is a rule that, somehow, will only assert the preference if there's no higher level already asserted. In the given example, even if hasContext(?u,NoisyRoom) is true, the only asserted level should be VolumeLevel_4 because other rule asserted it.

Any advices on this? Is what I want possible using SWRL? I'm using Protege 4.3 and Pellet Reasoner

Thanks, MFV.

Upvotes: 1

Views: 881

Answers (1)

Kunal Khaladkar
Kunal Khaladkar

Reputation: 493

this is possible but only in certain cases. Allow me to explain.


1) Your hasMediaVolumeLevelPreference is an object property that relates to individualsVolumeLevel_1, VolumeLevel_2, VolumeLevel_3 and VolumeLevel_4. These individuals have no relative ordering in the ontology. You, as a human designer, are aware that VolumeLevel_4 is greater than VolumeLevel_3 but to a reasoner no such relative ordering exists. If you were to change hasMediaVolumeLevelPreference to a data property with a range of int (or long or whatever really) then you have provided a concrete data value behind your individuals. Thus you can write rules using swrl comparison builtins, i.e swrl:greaterThan etc.

2) You can now write clauses into your rules that make comparisons in the antecedent so that only the highest value gets asserted, however SWRL supports monotonic inference only. Hence, SWRL rules cannot be used to modify existing information in an ontology. SWRL rules can not retract or remove information from an ontology. Therefore in the case where a lower volume, Volume_3 gets asserted before Volume_4, you cannot remove the relation hasMediaVolumeLevelPreference(Volume_3) from your ontology.

3) All is not lost yet though, Apache Jena has a rule engine that can be used to manipulate the ontology at an rdf triple level. You may have to write your own built-ins but you can remove properties and class descriptions from rdf subgraphs. Go here for more info on Jena rules.

I hope this helps.

Upvotes: 3

Related Questions