如何从 OWL Ontology header 值中检索值
How to retrieve values from OWL Ontology header values
有人可以帮助如何使用 JenaOWLModel 或 OWLOntology 从下面的示例 OWL header 中获取 header 值。
<owl:Ontology rdf:about="">
<owl:versionInfo>v 1.17 2003/02/26 12:56:51 mdean</owl:versionInfo>
<rdfs:comment>An example ontology</rdfs:comment>
<owl:imports rdf:resource="http://www.example.org/foo"/>
</owl:Ontology>
You can refer http://www.w3.org/TR/owl-ref/#Annotations (2.2. Ontology Headers) for more reference.
I tried using the below code to fetch the values, but not able to fetch the values. I can just see the keys. Any help would be appreciated.
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLDataFactory dataFactory = manager.getOWLDataFactory();
OWLOntology owlLOntology = manager.loadOntologyFromOntologyDocument(new File(dataPath));
Set owlAnnotationPropertySet = owlLOntology.getAnnotationPropertiesInSignature();
Iterator<OWLAnnotationProperty> iter = owlAnnotationPropertySet.iterator();while(iter.hasNext()){
OWLAnnotationProperty owlAnnotationProperty = (OWLAnnotationProperty) iter.next();
}
谢谢
阿努拉格
如果您使用OWL API,您可以使用[=14=获取ontology IRI(rdf:about标签的内容)和版本信息]
owlLOntology.getOntologyID().getOntologyIRI();
和
owlLOntology.getOntologyID().getVersionInfo();
对于注释你可以试试
for (OWLAnnotation annontation: o.getAnnotations() {
annotation.getValue();
}
获取每个注释的值 属性。至于导入,请尝试
owlLOntology.getImports();
有人可以帮助如何使用 JenaOWLModel 或 OWLOntology 从下面的示例 OWL header 中获取 header 值。
<owl:Ontology rdf:about="">
<owl:versionInfo>v 1.17 2003/02/26 12:56:51 mdean</owl:versionInfo>
<rdfs:comment>An example ontology</rdfs:comment>
<owl:imports rdf:resource="http://www.example.org/foo"/>
</owl:Ontology>
You can refer http://www.w3.org/TR/owl-ref/#Annotations (2.2. Ontology Headers) for more reference.
I tried using the below code to fetch the values, but not able to fetch the values. I can just see the keys. Any help would be appreciated.
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLDataFactory dataFactory = manager.getOWLDataFactory();
OWLOntology owlLOntology = manager.loadOntologyFromOntologyDocument(new File(dataPath));
Set owlAnnotationPropertySet = owlLOntology.getAnnotationPropertiesInSignature();
Iterator<OWLAnnotationProperty> iter = owlAnnotationPropertySet.iterator();while(iter.hasNext()){
OWLAnnotationProperty owlAnnotationProperty = (OWLAnnotationProperty) iter.next();
}
谢谢 阿努拉格
如果您使用OWL API,您可以使用[=14=获取ontology IRI(rdf:about标签的内容)和版本信息]
owlLOntology.getOntologyID().getOntologyIRI();
和
owlLOntology.getOntologyID().getVersionInfo();
对于注释你可以试试
for (OWLAnnotation annontation: o.getAnnotations() {
annotation.getValue();
}
获取每个注释的值 属性。至于导入,请尝试 owlLOntology.getImports();