【问题标题】:Exporting Inferred Axiom together with Annotation in OWL API在 OWL API 中导出推断公理和注释
【发布时间】:2015-09-11 14:02:52
【问题描述】:

我正在使用以下方法从本体中导出所有推断的公理:

   List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<>();
         gens.add(new InferredSubClassAxiomGenerator());  
         gens.add(new InferredClassAssertionAxiomGenerator());
         gens.add( new InferredDisjointClassesAxiomGenerator());
         gens.add( new InferredEquivalentClassAxiomGenerator());
         gens.add( new InferredEquivalentDataPropertiesAxiomGenerator());
         gens.add( new InferredEquivalentObjectPropertyAxiomGenerator());
         gens.add( new InferredInverseObjectPropertiesAxiomGenerator());
         gens.add( new InferredObjectPropertyCharacteristicAxiomGenerator());
         gens.add( new InferredPropertyAssertionGenerator());
         gens.add( new InferredSubDataPropertyAxiomGenerator());
         gens.add(new InferredDataPropertyCharacteristicAxiomGenerator());
         gens.add(new InferredObjectPropertyCharacteristicAxiomGenerator());
         gens.add( new InferredSubObjectPropertyAxiomGenerator());
         reasoner.flush();
         reasoner.getKB().realize(); 
         InferredOntologyGenerator iog = new InferredOntologyGenerator(reasoner, gens);
         OWLOntology infOnt = manager.createOntology();
         iog.fillOntology(reasoner.getManager().getOWLDataFactory(), infOnt);

现在,我想从本体中导出所有注解(标签和 cmets),并将它们放入新的注解中。我能怎么做 ?非常感谢。

【问题讨论】:

    标签: java semantic-web owl-api


    【解决方案1】:

    我已经解决了只是将注释公理从本体源复制到目标:

     for(OWLOntology o : manager.getImportsClosure(src)) {
             for(OWLAnnotationAssertionAxiom ax : o.getAxioms(AxiomType.ANNOTATION_ASSERTION)) {
            manager.applyChange(new AddAxiom(infOnt, ax));
                 }
             }
    

    我不知道是否有更好的方法,但它有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多