【发布时间】:2013-06-25 19:42:51
【问题描述】:
我找不到一些使用 SWRL 和 Jena 的体面的简单代码示例 颗粒,或者至少使用 SWRL?我研究了 Pellet 文档中的一些示例,但没有关于使用 SWRL 的示例。网络上的大多数示例都不完整且令人困惑。
我找到的唯一解决方案是使用 Jess Rule Engine,但它不是免费的,并且已获得商业许可。我发现 Pellet 支持 SWRL 规则,但找不到运行示例。
我找到的唯一例子是这个,但我不明白:
OWLOntologyManager m = create();
OWLOntology o = m.createOntology(example_iri);
// Get hold of references to class A and class B.
OWLClass clsA = df.getOWLClass( IRI.create(example_iri + "#A" ));
OWLClass clsB = df.getOWLClass(IRI.create(example_iri + "#B" ));
SWRLVariable var = df.getSWRLVariable(IRI.create(example_iri + "#x" ));
SWRLClassAtom body = df.getSWRLClassAtom(clsA, var);
SWRLClassAtom head = df.getSWRLClassAtom(clsB, var);
SWRLRule rule = df.getSWRLRule(Collections.singleton(body),
Collections.singleton(head));
m.applyChange(new AddAxiom(o, rule));
【问题讨论】:
标签: jena semantic-web pellet swrl