如何使用RDF架构验证RDF [英] How to validate a RDF with your RDF schema

查看:114
本文介绍了如何使用RDF架构验证RDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jena框架来操纵RDF文件,但是我找不到用各自的RDFSchema验证RDF的方法. 我正在尝试以下方法:

I'm using the Jena framework to manipulate RDF files, but I can't find a way to validate a RDF with your respective RDFSchema. I'm trying this method bellow:

Model mod1 = new ModelMem();
Model modSchema = new ModelMem();
String baseURI = "http://iec.ch/TC57/2007/network";

String rdfPath = "file:D:\\modelo.rdf";
InputStream model = FileManager.get().open(rdfPath);

String rdfPathSchema = "file:D:\\Schema.rdf";
InputStream modelSchema = FileManager.get().open(rdfPathSchema);

mod1.read(model, baseURI, "RDF/XML-ABBREV");
modSchema.read(modelSchema,baseURI,  "RDF/XML-ABBREV");
InfModel infmodel = ModelFactory.createRDFSModel(mod1, modSchema);
ValidityReport validity = infmodel.validate();
return validity.isValid();

但是它总是返回true.

But it always returns true.

推荐答案

我找到了使用RDF Schema验证RDF的解决方案. 存在一个名为CIMValidation的工具.我们可以在应用程序java中使用它, 只需将.jar添加到buildpath并使用RDFSValidator类. 感谢您的回答.

I found the solution for validate a RDF with a RDF Schema. Exists a tool called CIMValidation. We can use this in a application java, just add the .jar to the buildpath and use the RDFSValidator class. Thanks for all answer.

这篇关于如何使用RDF架构验证RDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆