SWRL 规则不适用于我的本体

发布于 2024-11-17 23:59:06 字数 1107 浏览 2 评论 0原文

我正在写一篇关于天气如何影响人们的健康(气象病)的文凭论文。本体如以下链接中的图片所示: http://dl .dropbox.com/u/5322973/WeatherHealthcast1%20-%20Properties.PNG

因此,a 编写了一个简单的 SWRL 规则:

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

这意味着如果天气温度高于25°C,则患者很有可能患有偏头痛(偏头痛1是“疾病”类别的个体) 我在本体中输入了一些个人并尝试运行 SQWRL 查询规则

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

,它工作正常。 但是,当我尝试运行 SPARQL 查询时:

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.
}

似乎该规则不适用(使用此 SPARQL 查询,如果天气温度为 30°C,我希望获得所有可能的疾病)。 有谁知道如何做到这一点,如何将 SWRL 规则包含到 SPARQL 查询中?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沧笙踏歌 2024-11-24 23:59:06

如果你想将 SPARQL 应用于某些东西,那么必须首先将其转换为 RDF。那么问题就变成了:

  • 您的 SWRL 规则(规则 1)如何用 RDF 表示?
  • 您的 SQWRL 规则(规则 2)如何用 RDF 表示?

第一条规则非常奇怪:它指出,如果存在具有一定温度的天气,那么偏头痛就是一种疾病。这真的是你想说的吗?一般来说,如果 SWRL 规则的 IF 部分和 THEN 部分共享变量,通常是有意义的,例如

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

SQWRL 是 OWL 的查询语言,即它与 SPARQL 在同一空间中运行。所以我真的不明白为什么要使用 SPARQL,或者为什么要结合 SQWRL 和 SPARQL。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文