2

I'm writing a diploma thesis about how does weather affect on people's health (meteoropathy). The ontology is shown in the picture in this link: http://dl.dropbox.com/u/5322973/WeatherHealthcast1%20-%20Properties.PNG

So, a wrote a simple SWRL rule:

Weather(?w) ∧ temperature(?w, ?t) ∧ swrlb:greaterThan(?t, 25.0) → Disease(Migraine1)

which means that if the weather temperature is greater than 25°C there is a strong chance the patient will be suffering from migraine (Migraine1 is an individual of the "Disease" class) I entered some individuals in the ontology and tried to run the SQWRL query rule

Weather(?w) ∧ temperature(?w, ?t) ∧ swrlb:greaterThan(?t, 25.0) → sqwrl:select(Migraine1)

and it works fine. But, when I try to run a SPARQL query:

prefix WeatherHealthcast:    <http://www.semanticweb.org/ontologies/2011/2/WeatherHealthcast.owl#>
SELECT ?disease ?tm ?w
WHERE
{
?temperature rdf:type WeatherHealthcast:Weather.
?temperature WeatherHealthcast:temperature ?tm.
FILTER (?tm = 30.0).
?disease rdf:type WeatherHealthcast:Disease.
?w rdf:type WeatherHealthcast:Weather.
?w WeatherHealthcast:affects ?disease.
}

it seems like the rule doesn't apply (with this SPARQL query I want to get all possible diseases if the weather temperature is 30°C). Does anyone know how to make this work, how to include the SWRL rule in to the SPARQL query?

Viktor
  • 93
  • 6

1 Answers1

3

If you want to apply SPARQL to something then this something must be converted into RDF first. The question then becomes:

  • How is your SWRL rule (rule 1) represented in RDF?
  • How is your SQWRL rule (rule 2) represented in RDF?

The 1st rule is pretty strange: it states that if there exists a weather with a certain temperature then Migrane is a disease. Is this really what you intend to say? In general it usually makes sense if the IF-part and the THEN-part of a SWRL rule share variables, e.g.

weather(?w) ∧ temperature(?w, ?t) ∧ swrlb:greaterThan(?t, 25.0)
            ∧ patient(?p) ∧ exposed-to(?p, ?w) →
                                   suffers-from(?p, Migraine)

SQWRL is a query language for OWL, i.e. it operates in the same space as SPARQL. So I don't really see why do you want to use SPARQL at all, or why do you want to combine SQWRL and SPARQL.

Kaarel
  • 10,554
  • 4
  • 56
  • 78
  • Hi! Thanks for you answer. I changed the SWRL rule a little bit, so now it looks something like yours: Person(?p) ∧ Weather(?w) ∧ has(?p, Migraine) ∧ temperature(?w, ?t) ∧ swrlb:greaterThan(?t, 25.0) → suffersFrom(?p, Migraine) and when I do a SQWRL query: suffersFrom(?p, ?d) → sqwrl:select(?p, ?d) it works fine, it only selects the "Migraine". But now a have some other problem. Seems like the Pellet reasoner doesn't apply my SWRL rules. Do you know why is that? – Viktor Aug 22 '11 at 08:16