OWLOntology readOntology 创建 AnnotationProperty

OWLOntology readOntology creates AnnotationProperty

我必须阅读 ontology,使用 OWLAPI;我使用此 JAVA 代码:

public class OwlApi {

public static void main(String[] args) throws OWLOntologyCreationException, FileNotFoundException {
        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
        File file = new File("myfile");
        InputStream targetStream = new FileInputStream(file);
        OWLOntology ontology = manager.loadOntologyFromOntologyDocument(targetStream);      
}
}

我的文件是一个简单的海龟文件,像这样:

@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix : <platform:/resource/test/OWL/prova#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<platform:/resource/test/OWL/prova> a owl:Ontology .

:proprietao a owl:ObjectProperty ;
rdfs:domain :classeuno ;
rdfs:range <http://dbpedia.org/ontology/PopulatedPlace> .

:proprietad a owl:DatatypeProperty ;
rdfs:domain <http://dbpedia.org/ontology/PopulatedPlace> ;
rdfs:range xsd:string .

:classeuno a owl:Class .

加载文件的输出是这个:

Ontology(OntologyID(OntologyIRI(<platform:/resource/test/OWL/prova>) VersionIRI(<null>))) [Axioms: 7 Logical Axioms: 3] First 20 axioms: {DataPropertyRange(<platform:/resource/test/OWL/prova#proprietad> xsd:string) DataPropertyRange(<platform:/resource/test/OWL/prova#proprietao> <http://dbpedia.org/ontology/PopulatedPlace>) Declaration(ObjectProperty(<platform:/resource/test/OWL/prova#proprietao>)) Declaration(DataProperty(<platform:/resource/test/OWL/prova#proprietad>)) Declaration(Class(<platform:/resource/test/OWL/prova#classeuno>)) AnnotationPropertyDomain(<platform:/resource/test/OWL/prova#proprietad> <http://dbpedia.org/ontology/PopulatedPlace>) ObjectPropertyDomain(<platform:/resource/test/OWL/prova#proprietao> <platform:/resource/test/OWL/prova#classeuno>) }

我不明白为什么会出现关于 DataProperty 的 AnnotationPropertyDomain

我是不是做错了什么? 非常感谢。

发生这种情况是因为 http://dbpedia.org/ontology/PopulatedPlace 未声明为 owl:Class 并且解析器非常严格。在 OWL 中,您必须明确键入所有实体。