- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试阅读在 Protege 4 上手动设计的本体,以使用 Jena 在 Eclipse 中对其进行更新。现在做简单,我只想从文件中读取本体并将内容打印回控制台。
这是java Jena代码。
package soctrace;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.ProfileRegistry;
import com.hp.hpl.jena.rdf.model.ModelFactory;
public class Intology {
static String xmlbase = "http://www.soctrace.org/ontologies/#";
static String ontopath = "./ontologies/tima.owl";
public static void main(String[] args) throws FileNotFoundException {
manageOntologies();
}
public static void manageOntologies() throws FileNotFoundException{
OntModel domainModel =ModelFactory.createOntologyModel(ProfileRegistry.OWL_DL_LANG);
domainModel.read((new FileInputStream(ontopath)), null);
model.write(System.out);
}
}
<?xml version="1.0"?>
<!DOCTYPE Ontology [
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
xml:base="http://www.soctrace.org/ontologies/tima.owl"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
ontologyIRI="http://www.soctrace.org/ontologies/tima.owl">
<Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
<Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
<Prefix name="" IRI="http://www.w3.org/2002/07/owl#"/>
<Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
<Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
<Annotation>
<AnnotationProperty abbreviatedIRI=":versionInfo"/>
<Literal datatypeIRI="&xsd;string">cette version est la promiere</Literal>
</Annotation>
<Annotation>
<AnnotationProperty abbreviatedIRI="rdfs:comment"/>
<Literal datatypeIRI="&xsd;string">Cette ontologie est construite pour gerer les traces de TIMA. dans un premier temps nous allons seulement considerer que les evenements sont les elements les plus interessants a regarder, puis nous allons fournir l'ontologie au gré des attentes.</Literal>
</Annotation>
<Declaration>
<Class IRI="#Event"/>
</Declaration>
<Declaration>
<Class IRI="#EventDuration"/>
</Declaration>
<Declaration>
<Class IRI="#EventType"/>
</Declaration>
<Declaration>
<Class IRI="#ValuePartition"/>
</Declaration>
<SubClassOf>
<Class IRI="#Event"/>
<Class abbreviatedIRI=":Thing"/>
</SubClassOf>
<SubClassOf>
<Class IRI="#EventDuration"/>
<Class IRI="#ValuePartition"/>
</SubClassOf>
<SubClassOf>
<Class IRI="#EventType"/>
<Class IRI="#ValuePartition"/>
</SubClassOf>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 18 column 64): {W136} Relative URIs are not permitted in RDF: specifically <ontologyIRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 18 column 64): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 19 column 65): {W136} Relative URIs are not permitted in RDF: specifically <name>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 19 column 65): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 19 column 65): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 19 column 65): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 20 column 62): {W136} Relative URIs are not permitted in RDF: specifically <name>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 20 column 62): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 20 column 62): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 20 column 62): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 21 column 59): {W136} Relative URIs are not permitted in RDF: specifically <name>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 21 column 59): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 21 column 59): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 21 column 59): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 22 column 75): {W136} Relative URIs are not permitted in RDF: specifically <name>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 22 column 75): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 22 column 75): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 22 column 75): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 23 column 70): {W136} Relative URIs are not permitted in RDF: specifically <name>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 23 column 70): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 23 column 70): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 23 column 70): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 25 column 60): {W136} Relative URIs are not permitted in RDF: specifically <abbreviatedIRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 25 column 60): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
ERROR [main] (RDFDefaultErrorHandler.java:40) - (line 26 column 44): {E201} Multiple children of property element
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 26 column 44): {W136} Relative URIs are not permitted in RDF: specifically <datatypeIRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 26 column 44): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
ERROR [main] (RDFDefaultErrorHandler.java:40) - (line 26 column 73): {E202} Expecting XML start or end element(s). String data "cette version est la promiere" not allowed. Maybe there should be an rdf:parseType='Literal' for embedding mixed XML content in RDF. Maybe a striping error.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 29 column 60): {W136} Relative URIs are not permitted in RDF: specifically <abbreviatedIRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 29 column 60): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
ERROR [main] (RDFDefaultErrorHandler.java:40) - (line 30 column 44): {E201} Multiple children of property element
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 30 column 44): {W136} Relative URIs are not permitted in RDF: specifically <datatypeIRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 30 column 44): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
ERROR [main] (RDFDefaultErrorHandler.java:40) - (line 30 column 258): {E202} Expecting XML start or end element(s). String data "Cette ontologie est construite pour gerer les traces de TIMA. dans un premier temps nous allons seulement considerer que les evenements sont les elements les plus interessants a regarder, puis nous allons fournir l" not allowed. Maybe there should be an rdf:parseType='Literal' for embedding mixed XML content in RDF. Maybe a striping error.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 33 column 30): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 33 column 30): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 36 column 38): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 36 column 38): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 39 column 34): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 39 column 34): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 42 column 39): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 42 column 39): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 45 column 30): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 45 column 30): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
ERROR [main] (RDFDefaultErrorHandler.java:40) - (line 46 column 41): {E201} Multiple children of property element
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 46 column 41): {W136} Relative URIs are not permitted in RDF: specifically <abbreviatedIRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 46 column 41): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 49 column 38): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 49 column 38): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
ERROR [main] (RDFDefaultErrorHandler.java:40) - (line 50 column 39): {E201} Multiple children of property element
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 50 column 39): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 50 column 39): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 53 column 34): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 53 column 34): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
ERROR [main] (RDFDefaultErrorHandler.java:40) - (line 54 column 39): {E201} Multiple children of property element
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 54 column 39): {W136} Relative URIs are not permitted in RDF: specifically <IRI>
WARN [main] (RDFDefaultErrorHandler.java:36) - (line 54 column 39): {W102} Unqualified property attributes are not allowed. Property treated as a relative URI.
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
</rdf:RDF>
最佳答案
那不是 OWL RDF 文件。我认为语法是OWL2 XML ,耶拿不支持。
您应该能够从 protege 输出 OWL RDF,或使用 this online tool 进行转换.
关于jena - Jena读取Protege本体文件报错怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11013186/
我想用前缀来表示这个nt文件: . "a" . "b" . "c" . 我写入一个新的nt文件是: @prefix sp: . . "a" . "b" . "c"
我有一个名为 Modelling.owl 的 OWL 文件,它是使用 Protege 4.2 创建的。但是后来我必须通过使用 Jena 注册一些新的 Individual 和它的属性来修改它。例如我有
我正在尝试使用 Jena 写入本地免费的独立 GraphDB(版本 8.5.0)存储库。 我尝试过的 (1) 耶拿直接使用 我使用了这个 Jena 3.7.0 代码片段: String strInse
我无法在我的 Ontology 中表达以下情况: 假设我有四个人投票,投了四票(所以 vote 和 voter 之间存在一对一的映射)。人们可以投票赞成或反对。如果我知道三个人的投票结果,我应该能够推
我在我的项目中使用 Dbpedia,我想创建一个本地 sparql 端点,因为在线端点不可靠。我下载了数据转储(大型 NT 文件)并决定使用 Jena TDB。使用 NetBeans IDE,我使用输
我用这个java代码在jena中创建了一个模型 Model m = ModelFactory.createDefaultModel(); Resource a1 = m.createR
我有一个猫头鹰本体,我将它读入 Jena OntModel。然后我在运行时更新它。现在我想把它写回一个OWL 本体。我正在使用下面的代码: RDFWriter writer = model.getWr
我将 Jena 和 Fuseki 安装为服务使用 一个可靠的角色 gremid.fuseki . 而且我想自定义监听主机和监听端口。但是,我不知道。 也许我应该编辑$FUSEKI_BASE/confi
我正在对基于本体的上下文管理和基于流程的上下文管理进行性能分析。然而,为了创建与 PCM 案例研究类似的场景,我需要在推理过程中直接从 Jena SWRL 规则触发 Java 方法。我做了很多研究,但
我正在使用 SPARQL 查询查询整数结果: String qString = "SELECT (COUNT(?S) AS ?C) "+ "WHERE
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 8年前关闭。 Improve t
我无法找到一些使用 SWRL 和 Jena 的简单代码示例佩莱,或者至少使用 SWRL?我研究了 Pellet 文档中的一些示例,但没有关于使用 SWRL 的示例。网络上的大多数示例都不完整且令人困惑
我对 RDF 和 Jena 很陌生。我想将一个 .nt (N-TRIPLE) 文件加载到模型中。我试过 read(inputStream, "N-TRIPLE") 但没有帮助。 它抛出 org.apa
我成功地使用 Jena API 和 Eclipse 创建、修改、合并本体。我还在 Eclipse 中成功启动了 OWL 推理器和 Pellet 推理器。 现在我想了解如何使用 Jena API 在 E
我正在尝试使用 Jena 框架来编辑使用 Protoge 4.2 构建的现有本体。即更改属性值或添加个人或类别,然后进行推理。假设在本体中我们有这样的规则:hasAge(?p,?age)^swrlb:
我了解到您可以使用以下代码提取 rdf 文件并初始化为 jena 中的模型: DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(
我目前正在开发一个项目,初始值为 .owl包含我们本体的基本模式的文件。我们使用 Jena API 加载此文件并对其执行不同的操作,例如添加本体类和个体。 我们寻求将系统迁移到三重存储,这意味着,而不
这是我的代码: public class FunctionalityCheckTest1 { InfModel infModel; Model model = ModelFactory
我使用Jena和TDB来存储RDF,我想对其进行一些推断。但是RDF数据很大,Jena的owl reasoner必须将所有数据加载到内存中。 所以我想找到一个可以推理而不将所有数据加载到内存中的推理器
我建立了一个使用SWRL规则进行推理的本体。当我在Protege中执行SQWRL查询时,它工作正常。问题是,当我想将Pellet与Jena一起使用时,Pellet似乎在查询中不包括SWRL规则。我像这
我是一名优秀的程序员,十分优秀!