OWL:没有dl查询问题

时间:2014-02-18 17:45:53

标签: java owl owl-api

我编写了一个接口,例如比萨本体,它可以区分断言和推断的公理。例如,给定Class: Food SubClassOf: Thing它会告诉您它是推断的。我的问题是,如果我有一个不可满足的类TomatoTopping,我想知道Class: TomatoTopping SubClassOf: Nothing是断言,推断还是没有,我会得到公理不存在的响应。虽然我可以在层次结构中的Nothing下看到TomatoTopping。问题是什么?我不能查询这样的公理或我的逻辑有缺陷吗?

这是识别Class: Food SubClassOf: Thing但不识别Class: TomatoTopping SubClassOf: Nothing

的代码
    // parsing input
    Set<OntologyAxiomPair> frame = parsingProcess(tool, input);
    Iterator<OntologyAxiomPair> frameit = frame.iterator();

    while (frameit.hasNext()) {
        OntologyAxiomPair newPair = frameit.next();
        OWLAxiom tempAx = newPair.getAxiom();

        // the axiom type must be anything but declaration
        if (!tempAx.isOfType(AxiomType.DECLARATION)) {
            // get asseted and inferred axioms
            Set<OWLAxiom> asserted = getOntology().getAxioms();

            if (asserted.contains(tempAx)) {
                Result = "System: this axiom is an asserted axiom.";
                displayUserMessage(Result, asetBlue);
                break;
            }

            // Use an inferred axiom generators
            else 
            {
                // Calling TrOWL
                RELReasoner reasoner = relfactory.createReasoner(getOntology());
                if(reasoner.isEntailed( tempAx)){
                    Result = "System: this axiom is an inferred axiom.";
                    displayUserMessage(Result, asetMagenta);
                    break;
                }
            }
        }
    }

我想我发现了问题所在。曼彻斯特语法解析器需要一个datafactory。

    OWLOntologyManager manager = inputOntology.getOWLOntologyManager();
    this.dataFactory = manager.getOWLDataFactory();

由于经理没有被推理者分类,因此OWL:没有出现任何内容。你知道一种方法来对经理进行分类,然后提取datafactroy吗?

0 个答案:

没有答案