1

概括

提前感谢您帮助我编写了可以在 TopBraid Composer 免费版中声明为 SPIN 规则并使用的 CONSTRUCT/WHERE 语句。

我正在尝试在声明中嵌入 SPARQL CONSTRUCT/WHERE 语句spin:rule,然后执行它。我对下面的陈述 1 或 2 返回零推论。我正在使用 Java 7、Eclipse 4.3 和 TopBraid Composer 免费版。我已经成功地将语句 3 作为类表单中的 SPIN 构造函数声明运行(语句 3)。我已经在我交叉发布到用户论坛的 SPARQL 查询编辑器(解释器)中成功运行了语句 4。

细节

事实 1:我无法将语句 1 作为 SPIN 规则运行。

----声明1---

CONSTRUCT {
?this owl:hasKey ?x .
}
WHERE {
BIND (spif:generateUUID() AS ?x) .
}

事实 2:我无法将语句 2 作为 SPIN 规则运行。

----声明2----

CONSTRUCT {
?this owl:hasKey ?x .
}
WHERE {
?this rdfs:subClassOf node:entity .
BIND (spif:generateUUID() AS ?x) .
}
--No Error Message--

事实 3:但是,我在类表单的构造函数字段中成功使用了语句 3。

----声明3----

CONSTRUCT {
?this owl:hasKey ?x .
}
WHERE {
BIND (spif:generateUUID() AS ?x) .
}
Success: When a new instance is created a new triple indicating a key is created.

事实 4:我在 SPARQL 查询编辑器中成功使用了 Statement 4,这是类似的。

----声明4----

CONSTRUCT {
?s owl:hasKey ?x .
}
WHERE {
?s rdf:type node:word_use
BIND (spif:generateUUID() AS ?x) .
}
Success: When statement is run all current instances get keys.

事实 5:我没有在 Ontology Profile 表单中检查任何 SPARQL 规则库。

事实 6:我已经导入了以下两个库。

<http://spinrdf.org/spin> from local file TopBraid/SPIN/spin.ttl.
<http://spinrdf.org/sp> from local file TopBraid/SPIN/sp.ttl

事实 7:文件中的命名空间是:

Base URI (Location) - http://example.org/
Default Namespace - http://example.org/

But the Base URI keeps getting reset to:
http://www.semanticweb.org/owl/owlapi/turtle

ace_lexicon - http://attempto.ifi.uzh.ch/ace_lexicon#
arc - http://example.org/arc#
arg - http://spinrdf.org/arg#
concept - http://example.org/concept#
node - http://www.example.org/node#
owl - http://www.w3.org/2002/07/owl#
rdf - http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs - http://www.w3.org/2001/01/rdf-schema#
skos - http://www.w3.org/2004/02/skos/core#
sp - http://spinrdf.org/sp#
spif - http://spinrdf.org/spif#
spin - http://spinrdf.org/spin#
spl - http://spinrdf.org/spl#
word_sense - http://example.org/word_sense#
word_term - http://example.org/word_term#
word_use - http://example.org/word_use#

事实 8:我正在使用的类具有以下断言。

Name - node:unclassified_concept
SubClassOf - node:entity

事实 9:node:unclassified_concept 类的一个实例如下所述。

URI - http://example.org/concept#regardless_of1
rdfs:comment - without attention to
rdfs:isDefinedBy - <http://en.wiktionary.org/wiki/regardless_of>
rdfs:label - regardless of

事实 10:我已经成功地使用了 Jena 通用规则推理以及 OWL_MEM_RULE_INF OntModelSpec、读/写、基本模型、inf 模型和 ont 模型。

语境

我的问题的背景如下。我正在使用 Java 和 Jena 构建和迭代执行本体和规则集,以证明 OWL/RDF 的概念表示、考虑和响应非平凡的打字英语。我使用的句子很重要(41 个单词,三个从句等)。当前本体在不针对任何 OWL/RDF 规则(传递性等)运行时有 1422 个断言。我尽可能使用 TopBraid Composer 来补充 Jena 编程,以确保我符合约定和标准。

4

1 回答 1

0

这篇文章概述了我发布的问题的解决方案。我能够通过一个回复他们用户论坛的人来找到这个解决方案。https://groups.google.com/forum/#!forum/topbraid-users

我想运行的 CONSTRUCT/WHERE 语句(修订后)是:

CONSTRUCT {
?this owl:hasKey ?x .
}
WHERE {
?this rdf:type node:unclassified_concept .
BIND (spif:generateUUID() AS ?x) .
}

但是,如果我将此语句放在 TBC 中类表单的 spin:rule 字段中并按下用于推理的图标,我将不会收到任何推理,并且推理器将花费大量时间来搅动。

解决方案是创建 spin:rule 的子属性,将 spin:rulePropertyMaxIterationCount 设置为 1(以避免运行内置函数生成无限循环——在我的例子中是 spin:generateUUID()。)

然后,我需要将新的子属性(我将其命名为“runOnce”)“拉”或放置到我试图为其创建依赖于内置的 CONSTRUCT/WHERE 规则的类表单中。

最后,在类表单中,我需要在新的子属性 RunOnce 上选择添加空白行,然后在此处输入我原来的 CONSTRUCT/WHERE 语句。

然后我运行推理,班级使用规则。

简而言之,如果您想在 TBC 中的类中嵌入规则,并且该规则使用内置函数,则需要

-Create a subproperty of spin:rule that has rulePropertyMaxIterationCount 
   set to 1.
-Include this subproperty in the classes form.
-Embed your CONSTRUCT/WHERE statement that uses the built-in within that 
   subproperty on the classes form by selecting insert blank line and 
   copying/pasting it       in there.

请注意,TBC 支持的 SPIN 内置函数集比我认为的 SPIN API 文档中的要小。TBC 支持的内置列表在 TBC 产品中。

Help>
  Help Contents>
    TopBraid Composer>
      Application Development Tools>
        SPARQL Motion Scripts>
          SPARQL Motion Functions Reference

希望这可以帮助某人。

于 2014-08-20T16:53:01.637 回答