Java 还是OWLAPI中的一些规则?

Java 还是OWLAPI中的一些规则?,java,owl,owl-api,protege4,Java,Owl,Owl Api,Protege4,我似乎无法理解如何或(ObjectUnionOf?)一组和(ObjectIntersectionOf)规则。当在protégé中打开OWL文件时,我的代码生成的是规则(有一些双精度)[您正在创建unionSet但未使用它。在保存本体之前,不要向本体添加公理,而是将firstRuleSet添加到unionSet,然后在主循环外创建等效的类公理 /* write rules */ // OWLObjectIntersectionOf intersection = null; OWLClassExpr

我似乎无法理解如何或(
ObjectUnionOf
?)一组和(
ObjectIntersectionOf
)规则。当在protégé中打开OWL文件时,我的代码生成的是规则(有一些双精度)[您正在创建
unionSet
但未使用它。在保存本体之前,不要向本体添加公理,而是将
firstRuleSet
添加到
unionSet
,然后在主循环外创建等效的类公理

/* write rules */
// OWLObjectIntersectionOf intersection = null;
OWLClassExpression firstRuleSet = null;
OWLClass owlCls = null;
OWLObjectUnionOf union = null;
Iterator it = rules.map.entrySet().iterator();
Set<OWLClassExpression> unionSet = new HashSet<OWLClassExpression>();
while (it.hasNext()) {
    Map.Entry pair = (Map.Entry) it.next();
    String currCls = (String) pair.getKey();
    owlCls = factory.getOWLClass(IRI.create("#" + currCls));
    ArrayList<owlRuleSet> currRuleset = (ArrayList<owlRuleSet>) pair.getValue();
    for (int i = 0; i < currRuleset.size(); i++) {
        firstRuleSet = factory.getOWLObjectIntersectionOf(currRuleset.get(i).getRuleList(currCls))
        union = factory.getOWLObjectUnionOf(firstRuleSet);
        manager.addAxiom(ontology, factory.getOWLEquivalentClassesAxiom(owlCls, union));
    }
}
manager.saveOntology(ontology);
/* write rules */
OWLClass owlCls = null;
OWLObjectUnionOf totalUnion = null;
Iterator it = rules.map.entrySet().iterator();
Set<OWLClassExpression> unionSet = new HashSet<OWLClassExpression>();
while (it.hasNext()) {
    Map.Entry pair = (Map.Entry) it.next();
    String currCls = (String) pair.getKey();
    owlCls = factory.getOWLClass(IRI.create("#" + currCls));
    ArrayList<owlRuleSet> currRuleset = (ArrayList<owlRuleSet>) pair.getValue();
    for (int i = 0; i < currRuleset.size(); i++) {
        firstRuleSet = factory.getOWLObjectIntersectionOf(currRuleset.get(i).getRuleList(currCls))
        unionSet.add(firstRuleSet);
    }
    totalUnion = factory.getOWLObjectUnionOf(unionSet);
    unionSet.clear()
    manager.addAxiom(ontology, factory.getOWLEquivalentClassesAxiom(owlCls, totalunion));
}
manager.saveOntology(ontology);