OWL-API 5.1.6 SWRL 规则生成和 RDFXMLDocumentFormat:合并规则
OWL-API 5.1.6 SWRL rule generation and RDFXMLDocumentFormat : rules are merged
内容:
我正面临我所说的问题,但可能不是。
出于某些需要,我正在通过OWLAPI创建一系列swrl规则,序列化后将通过简单的文件上传添加到stardog存储库。
为了示例目的,我调整了我的代码以生成两个非常简单的 swrl 规则公理:对于给定的术语列表,如果一个项目具有所有术语,则它必须 class 化为class参数化class。
这里我选择了
- 番茄 -> 关于蔬菜
- 猴子、驴子 -> aboutAnimals
如何:
我用的是这个版本:
[根据 Ignazio 提示进行了编辑]
compile group: 'net.sourceforge.owlapi', name: 'owlapi-distribution', version: '5.1.6'
所以我有类似的东西来产生 swrl 规则公理:
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat;
import org.semanticweb.owlapi.model.*;
import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class WhosebugExemple {
private final static String BASE_IRI = "http://foo.bar/exemple.owl";
private final static String CLASS_ITEM = BASE_IRI + "#Item";
private final static String CLASS_TERM = BASE_IRI + "#Term";
private final static String PROP_ISCLASSIFIED = BASE_IRI + "#isClassified";
private final static String PROP_HASTERM = BASE_IRI + "#hasTerm";
private final static String IND_IT = BASE_IRI + "#it";
public static void main(String[] args) throws Exception {
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology onto = manager.createOntology();
SWRLRule rule1 = createRule(manager, Arrays.asList(new String[]{"tomato"}), BASE_IRI + "#aboutVegetables");
manager.applyChange(new AddAxiom(onto, rule1));
SWRLRule rule2 = createRule(manager, Arrays.asList(new String[]{"monkey", "donkey"}), BASE_IRI + "#aboutAnimals");
manager.applyChange(new AddAxiom(onto, rule2));
File output = new File("foo.rdf");
OWLDocumentFormat format = new RDFXMLDocumentFormat();
manager.saveOntology(onto, format, IRI.create(output));
}
private static SWRLRule createRule(OWLOntologyManager manager,
List<String> inputWords,
String classificationClass) throws Exception {
OWLDataFactory factory = manager.getOWLDataFactory();
OWLClass classItem = factory.getOWLClass(IRI.create(CLASS_ITEM));
OWLClass classTerm = factory.getOWLClass(IRI.create(CLASS_TERM));
/**
* Prepararing andecedent (has term conditions)
*/
SWRLVariable varItem = factory.getSWRLVariable(IRI.create(IND_IT));
OWLObjectProperty propHasTerm = factory.getOWLObjectProperty(IRI.create(PROP_HASTERM));
Set<SWRLAtom> antecedent = new HashSet<>();
for (String term : inputWords) {
OWLNamedIndividual termInd = factory.getOWLNamedIndividual(IRI.create(BASE_IRI + "#" + term));
SWRLIndividualArgument termIndArg = factory.getSWRLIndividualArgument(termInd);
SWRLObjectPropertyAtom propAtom = factory.getSWRLObjectPropertyAtom(propHasTerm,
varItem,
termIndArg);
antecedent.add(propAtom);
antecedent.add(factory.getSWRLClassAtom(classTerm, termIndArg));
antecedent.add(factory.getSWRLClassAtom(classItem, varItem));
}
/**
* Building consequent part
*/
OWLNamedIndividual classificationIndividual = factory.getOWLNamedIndividual(IRI.create(classificationClass));
OWLObjectProperty propClassified = factory.getOWLObjectProperty(IRI.create(PROP_ISCLASSIFIED));
SWRLObjectPropertyAtom propClassifiedAtom = factory.getSWRLObjectPropertyAtom(propClassified,
varItem,
factory.getSWRLIndividualArgument(classificationIndividual));
Set<SWRLAtom> consequent = new HashSet<>();
consequent.add(propClassifiedAtom);
/**
* Create the swrl rule
*/
SWRLRule rule = factory.getSWRLRule(antecedent,
consequent);
return rule;
}
}
出了什么问题:
问题出在输出上,swrl规则合并
输出文件包含两个规则,没关系,但如果你看第一个,它包含第二个,或类似的东西。
输出文件内容(仅swrl规则部分):
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<swrl:body>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#tomato"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Term"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#tomato"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<swrl:body>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Term"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Term"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Item"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</swrl:body>
<swrl:head>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#isClassified"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#aboutAnimals"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</swrl:head>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</swrl:body>
<swrl:head>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#isClassified"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#aboutVegetables"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</swrl:head>
</rdf:Description>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<swrl:body>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Term"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Term"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Item"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</swrl:body>
<swrl:head>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#isClassified"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#aboutAnimals"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</swrl:head>
</rdf:Description>
帮助:
显然我看到了两种可能性:
- 我使用库的方式不对(我已经成功使用了这段代码:/)
- 库有问题(序列化)
所以,如果您有任何提示,遇到过类似的问题,或者只是看看我错在哪里,如果您能分享它,我会很高兴:-)
谢谢
Owlapi 3.5.0 很古老。您看到的结果似乎是 RDF/XML 渲染中的一个问题。
尝试两件事:
改用函数式语法或 OWL/XML,看看这是否有帮助
使用更新的 owlapi 版本。您的代码应使用 5.1.6 进行编译并稍作更改,其中大部分更改应仅针对包名称。
编辑:如前所述,实际使用的版本是5.1.6。看到的问题是一个错误,已在 5.1.7 版本中修复。
解决方案
正如 Ignazio 在评论中提到的那样,他修复了 5.1.7 版本中的错误
之前的部分解决方案(问题无论如何都发生了,有一组更重要的规则要序列化)
只要我没有太多时间去探究问题出在哪里,我就会选择使用另一种序列化格式,因为问题并不在于所有可用的序列化格式...
所以至少这两种格式没有问题:
OWLXMLDocumentFormat
<DLSafeRule>
<Body>
<ClassAtom>
<Class IRI="http://foo.bar/exemple.owl#Term"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#monkey"/>
</ClassAtom>
<ObjectPropertyAtom>
<ObjectProperty IRI="http://foo.bar/exemple.owl#hasTerm"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#monkey"/>
</ObjectPropertyAtom>
<ObjectPropertyAtom>
<ObjectProperty IRI="http://foo.bar/exemple.owl#hasTerm"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#donkey"/>
</ObjectPropertyAtom>
<ClassAtom>
<Class IRI="http://foo.bar/exemple.owl#Term"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#donkey"/>
</ClassAtom>
<ClassAtom>
<Class IRI="http://foo.bar/exemple.owl#Item"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
</ClassAtom>
</Body>
<Head>
<ObjectPropertyAtom>
<ObjectProperty IRI="http://foo.bar/exemple.owl#isClassified"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#aboutAnimals"/>
</ObjectPropertyAtom>
</Head>
</DLSafeRule>
<DLSafeRule>
<Body>
<ObjectPropertyAtom>
<ObjectProperty IRI="http://foo.bar/exemple.owl#hasTerm"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#tomato"/>
</ObjectPropertyAtom>
<ClassAtom>
<Class IRI="http://foo.bar/exemple.owl#Term"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#tomato"/>
</ClassAtom>
<ClassAtom>
<Class IRI="http://foo.bar/exemple.owl#Item"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
</ClassAtom>
</Body>
<Head>
<ObjectPropertyAtom>
<ObjectProperty IRI="http://foo.bar/exemple.owl#isClassified"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#aboutVegetables"/>
</ObjectPropertyAtom>
</Head>
</DLSafeRule>
RioRDFXMLDocumentFormat
<rdf:Description rdf:about="http://foo.bar/exemple.owl#it">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid15">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<body xmlns="http://www.w3.org/2003/11/swrl#" rdf:nodeID="genid19"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid19">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid20"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid20">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<propertyPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
<argument2 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#tomato"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid19">
<rdf:rest rdf:nodeID="genid17"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid17">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid18"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid18">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<classPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#Term"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#tomato"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid17">
<rdf:rest rdf:nodeID="genid16"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid16">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid2"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid2">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<body xmlns="http://www.w3.org/2003/11/swrl#" rdf:nodeID="genid11"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid11">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid12"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid12">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<classPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#Term"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid11">
<rdf:rest rdf:nodeID="genid9"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid9">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid10"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid10">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<propertyPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
<argument2 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid9">
<rdf:rest rdf:nodeID="genid7"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid7">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid8"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid8">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<propertyPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
<argument2 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid7">
<rdf:rest rdf:nodeID="genid5"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid5">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid6"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid6">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<classPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#Term"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid5">
<rdf:rest rdf:nodeID="genid3"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid3">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid1"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid1">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<classPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#Item"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid3">
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid2">
<head xmlns="http://www.w3.org/2003/11/swrl#" rdf:nodeID="genid13"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid13">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid14"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid14">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<propertyPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#isClassified"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
<argument2 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#aboutAnimals"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid13">
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid16">
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid15">
<head xmlns="http://www.w3.org/2003/11/swrl#" rdf:nodeID="genid21"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid21">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid22"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid22">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<propertyPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#isClassified"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
<argument2 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#aboutVegetables"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid21">
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
内容:
我正面临我所说的问题,但可能不是。
出于某些需要,我正在通过OWLAPI创建一系列swrl规则,序列化后将通过简单的文件上传添加到stardog存储库。
为了示例目的,我调整了我的代码以生成两个非常简单的 swrl 规则公理:对于给定的术语列表,如果一个项目具有所有术语,则它必须 class 化为class参数化class。
这里我选择了
- 番茄 -> 关于蔬菜
- 猴子、驴子 -> aboutAnimals
如何:
我用的是这个版本:
[根据 Ignazio 提示进行了编辑]
compile group: 'net.sourceforge.owlapi', name: 'owlapi-distribution', version: '5.1.6'
所以我有类似的东西来产生 swrl 规则公理:
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat;
import org.semanticweb.owlapi.model.*;
import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class WhosebugExemple {
private final static String BASE_IRI = "http://foo.bar/exemple.owl";
private final static String CLASS_ITEM = BASE_IRI + "#Item";
private final static String CLASS_TERM = BASE_IRI + "#Term";
private final static String PROP_ISCLASSIFIED = BASE_IRI + "#isClassified";
private final static String PROP_HASTERM = BASE_IRI + "#hasTerm";
private final static String IND_IT = BASE_IRI + "#it";
public static void main(String[] args) throws Exception {
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology onto = manager.createOntology();
SWRLRule rule1 = createRule(manager, Arrays.asList(new String[]{"tomato"}), BASE_IRI + "#aboutVegetables");
manager.applyChange(new AddAxiom(onto, rule1));
SWRLRule rule2 = createRule(manager, Arrays.asList(new String[]{"monkey", "donkey"}), BASE_IRI + "#aboutAnimals");
manager.applyChange(new AddAxiom(onto, rule2));
File output = new File("foo.rdf");
OWLDocumentFormat format = new RDFXMLDocumentFormat();
manager.saveOntology(onto, format, IRI.create(output));
}
private static SWRLRule createRule(OWLOntologyManager manager,
List<String> inputWords,
String classificationClass) throws Exception {
OWLDataFactory factory = manager.getOWLDataFactory();
OWLClass classItem = factory.getOWLClass(IRI.create(CLASS_ITEM));
OWLClass classTerm = factory.getOWLClass(IRI.create(CLASS_TERM));
/**
* Prepararing andecedent (has term conditions)
*/
SWRLVariable varItem = factory.getSWRLVariable(IRI.create(IND_IT));
OWLObjectProperty propHasTerm = factory.getOWLObjectProperty(IRI.create(PROP_HASTERM));
Set<SWRLAtom> antecedent = new HashSet<>();
for (String term : inputWords) {
OWLNamedIndividual termInd = factory.getOWLNamedIndividual(IRI.create(BASE_IRI + "#" + term));
SWRLIndividualArgument termIndArg = factory.getSWRLIndividualArgument(termInd);
SWRLObjectPropertyAtom propAtom = factory.getSWRLObjectPropertyAtom(propHasTerm,
varItem,
termIndArg);
antecedent.add(propAtom);
antecedent.add(factory.getSWRLClassAtom(classTerm, termIndArg));
antecedent.add(factory.getSWRLClassAtom(classItem, varItem));
}
/**
* Building consequent part
*/
OWLNamedIndividual classificationIndividual = factory.getOWLNamedIndividual(IRI.create(classificationClass));
OWLObjectProperty propClassified = factory.getOWLObjectProperty(IRI.create(PROP_ISCLASSIFIED));
SWRLObjectPropertyAtom propClassifiedAtom = factory.getSWRLObjectPropertyAtom(propClassified,
varItem,
factory.getSWRLIndividualArgument(classificationIndividual));
Set<SWRLAtom> consequent = new HashSet<>();
consequent.add(propClassifiedAtom);
/**
* Create the swrl rule
*/
SWRLRule rule = factory.getSWRLRule(antecedent,
consequent);
return rule;
}
}
出了什么问题:
问题出在输出上,swrl规则合并
输出文件包含两个规则,没关系,但如果你看第一个,它包含第二个,或类似的东西。
输出文件内容(仅swrl规则部分):
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<swrl:body>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#tomato"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Term"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#tomato"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<swrl:body>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Term"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Term"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Item"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</swrl:body>
<swrl:head>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#isClassified"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#aboutAnimals"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</swrl:head>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</swrl:body>
<swrl:head>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#isClassified"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#aboutVegetables"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</swrl:head>
</rdf:Description>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<swrl:body>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Term"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Term"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
</rdf:first>
<rdf:rest>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://foo.bar/exemple.owl#Item"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</rdf:rest>
</rdf:Description>
</swrl:body>
<swrl:head>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<swrl:propertyPredicate rdf:resource="http://foo.bar/exemple.owl#isClassified"/>
<swrl:argument1 rdf:resource="http://foo.bar/exemple.owl#it"/>
<swrl:argument2 rdf:resource="http://foo.bar/exemple.owl#aboutAnimals"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</swrl:head>
</rdf:Description>
帮助:
显然我看到了两种可能性:
- 我使用库的方式不对(我已经成功使用了这段代码:/)
- 库有问题(序列化)
所以,如果您有任何提示,遇到过类似的问题,或者只是看看我错在哪里,如果您能分享它,我会很高兴:-)
谢谢
Owlapi 3.5.0 很古老。您看到的结果似乎是 RDF/XML 渲染中的一个问题。
尝试两件事:
改用函数式语法或 OWL/XML,看看这是否有帮助
使用更新的 owlapi 版本。您的代码应使用 5.1.6 进行编译并稍作更改,其中大部分更改应仅针对包名称。
编辑:如前所述,实际使用的版本是5.1.6。看到的问题是一个错误,已在 5.1.7 版本中修复。
解决方案
正如 Ignazio 在评论中提到的那样,他修复了 5.1.7 版本中的错误
之前的部分解决方案(问题无论如何都发生了,有一组更重要的规则要序列化)
只要我没有太多时间去探究问题出在哪里,我就会选择使用另一种序列化格式,因为问题并不在于所有可用的序列化格式...
所以至少这两种格式没有问题:
OWLXMLDocumentFormat
<DLSafeRule>
<Body>
<ClassAtom>
<Class IRI="http://foo.bar/exemple.owl#Term"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#monkey"/>
</ClassAtom>
<ObjectPropertyAtom>
<ObjectProperty IRI="http://foo.bar/exemple.owl#hasTerm"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#monkey"/>
</ObjectPropertyAtom>
<ObjectPropertyAtom>
<ObjectProperty IRI="http://foo.bar/exemple.owl#hasTerm"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#donkey"/>
</ObjectPropertyAtom>
<ClassAtom>
<Class IRI="http://foo.bar/exemple.owl#Term"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#donkey"/>
</ClassAtom>
<ClassAtom>
<Class IRI="http://foo.bar/exemple.owl#Item"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
</ClassAtom>
</Body>
<Head>
<ObjectPropertyAtom>
<ObjectProperty IRI="http://foo.bar/exemple.owl#isClassified"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#aboutAnimals"/>
</ObjectPropertyAtom>
</Head>
</DLSafeRule>
<DLSafeRule>
<Body>
<ObjectPropertyAtom>
<ObjectProperty IRI="http://foo.bar/exemple.owl#hasTerm"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#tomato"/>
</ObjectPropertyAtom>
<ClassAtom>
<Class IRI="http://foo.bar/exemple.owl#Term"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#tomato"/>
</ClassAtom>
<ClassAtom>
<Class IRI="http://foo.bar/exemple.owl#Item"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
</ClassAtom>
</Body>
<Head>
<ObjectPropertyAtom>
<ObjectProperty IRI="http://foo.bar/exemple.owl#isClassified"/>
<Variable IRI="http://foo.bar/exemple.owl#it"/>
<NamedIndividual IRI="http://foo.bar/exemple.owl#aboutVegetables"/>
</ObjectPropertyAtom>
</Head>
</DLSafeRule>
RioRDFXMLDocumentFormat
<rdf:Description rdf:about="http://foo.bar/exemple.owl#it">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid15">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<body xmlns="http://www.w3.org/2003/11/swrl#" rdf:nodeID="genid19"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid19">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid20"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid20">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<propertyPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
<argument2 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#tomato"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid19">
<rdf:rest rdf:nodeID="genid17"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid17">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid18"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid18">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<classPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#Term"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#tomato"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid17">
<rdf:rest rdf:nodeID="genid16"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid16">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid2"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid2">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<body xmlns="http://www.w3.org/2003/11/swrl#" rdf:nodeID="genid11"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid11">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid12"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid12">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<classPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#Term"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid11">
<rdf:rest rdf:nodeID="genid9"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid9">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid10"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid10">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<propertyPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
<argument2 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#monkey"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid9">
<rdf:rest rdf:nodeID="genid7"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid7">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid8"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid8">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<propertyPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#hasTerm"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
<argument2 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid7">
<rdf:rest rdf:nodeID="genid5"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid5">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid6"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid6">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<classPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#Term"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#donkey"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid5">
<rdf:rest rdf:nodeID="genid3"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid3">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid1"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid1">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<classPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#Item"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid3">
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid2">
<head xmlns="http://www.w3.org/2003/11/swrl#" rdf:nodeID="genid13"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid13">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid14"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid14">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<propertyPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#isClassified"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
<argument2 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#aboutAnimals"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid13">
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid16">
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid15">
<head xmlns="http://www.w3.org/2003/11/swrl#" rdf:nodeID="genid21"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid21">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first rdf:nodeID="genid22"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid22">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
<propertyPredicate xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#isClassified"/>
<argument1 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#it"/>
<argument2 xmlns="http://www.w3.org/2003/11/swrl#" rdf:resource="http://foo.bar/exemple.owl#aboutVegetables"/>
</rdf:Description>
<rdf:Description rdf:nodeID="genid21">
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>