owlontologyreasoningswrlsqwrl

How to write OR operation in sqwrl query


For AND operation in sqwrl query, it is like :

Symptom(fever) ^ Symptom(vomiting) ^ Disease(?y) ^ hasSymptom(?y,fever) ^ hasSymptom(?y,vomiting) -> sqwrl:select(?y)

From the above rule, it is selecting the diseases that have both symptoms. What about OR operation in sqwrl query? I want to select the diseases that has either symptom fever or symptom vomiting? Any help will be highly appreciated.


Solution

  • The correct answer to select diseases that have either symptom vomiting or fever.

    Symptom(fever) ^ Symptom(vomiting) ^ Disease(?x) ^ Disease(?y) ^ has_symptom(?x, fever) ^ has_symptom(?y, vomiting)˚sqwrl:makeSet(?s1, ?x) ^ sqwrl:makeSet(?s2, ?y)˚sqwrl:union(?s3, ?s1, ?s2) ^ sqwrl:element(?e, ?s3) -> sqwrl:select(?e)