作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我必须使用 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 中,您必须显式键入所有实体。
关于java - OWLOntology readOntology 创建 AnnotationProperty,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40916216/
我必须使用 OWLAPI 来阅读本体;我使用这个JAVA代码: public class OwlApi { public static void main(String[] args) throws
我正在为 Windows 使用 Protégé 桌面。 我正在使用以下 URL 在 protégé 中导入都柏林核心元素:http://purl.org/dc/elements/1.1 我期待能够访问
我是一名优秀的程序员,十分优秀!