简体   繁体   English

使用 Align API 从 rdf 对齐生成 owl 对齐时出错

[英]error in generating owl alignment from rdf alignment using Align API

I have done ontology matching on two ontologies and it's result is alignment.rdf.我在两个本体上做了本体匹配,结果是alignment.rdf。 Now I want to generate owl file from alignment rdf using Align API library.现在我想使用 Align API 库从对齐 rdf 生成 owl 文件。

According to Align API documentation here is my code :根据 Align API 文档,这里是我的代码:

PrintWriter writer1 = null ;
    Alignment temp = null ;
    Alignment temp1 = null ;
    AlignmentParser aparser = new AlignmentParser();
    temp = aparser.parse( "file:Ontologies/final_alignment.rdf" );
    temp1 = ObjectAlignment.toObjectAlignment((URIAlignment)temp);
    File merged1 = new File( "Ontologies/final_alignment.owl");
    writer1 = new PrintWriter ( new FileWriter( merged1, false ), true );
    AlignmentVisitor renderer1 = new OWLAxiomsRendererVisitor( writer1 );
    temp1.render(renderer1);
    writer1.flush();
    writer1.close();    

But I face this error in line temp1 = ObjectAlignment.toObjectAlignment((URIAlignment)temp);但是我在temp1 = ObjectAlignment.toObjectAlignment((URIAlignment)temp);行中遇到了这个错误temp1 = ObjectAlignment.toObjectAlignment((URIAlignment)temp); :

Error: Exception in thread "main" org.semanticweb.owl.align.AlignmentException: Arguments must be LoadedOntology or URI

how can I get rid of this error ?我怎样才能摆脱这个错误?

I guess this is a follow-up to [1].我想这是[1]的后续。

Like I answered "Note that for this purpose, the URI of the ontologies in the initial file must be dereferenceable."就像我回答“请注意,为此目的,初始文件中本体的 URI 必须是可取消引用的。”

More precisely, this means that from the URI in your file, Jena or the OWL API should be able to load the ontologies, and, since your trying to render them as OWL, these are OWLOntologies.更准确地说,这意味着从文件中的 URI,Jena 或 OWL API 应该能够加载本体,并且由于您尝试将它们呈现为 OWL,因此这些是 OWLOntology。

These may eventually be local URIs (starting with file://).这些最终可能是本地 URI(以 file:// 开头)。

[1] How to create Alignment Object using alignment API [1] 如何使用对齐 API 创建对齐对象

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM