我已经对两个本体进行了本体匹配,结果是alignment.rdf。现在我想使用 Align API 库从对齐 rdf 生成 owl 文件。
根据 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();
但我面临这个错误temp1 = ObjectAlignment.toObjectAlignment((URIAlignment)temp);
:
Error: Exception in thread "main" org.semanticweb.owl.align.AlignmentException: Arguments must be LoadedOntology or URI
我怎样才能摆脱这个错误?