我有一个本地alignment.rdf
文件并使用对齐API库here我想创建Alignment
对象并将其转换为.owl文件。
我的代码在这里:
AlignmentParser aparser = new AlignmentParser(0);
Alignment result = aparser.parse( new File( "Ontologies/alcomo-alignment.rdf" ).toURI() );
File merged1 = new File( "Ontologies/final_alignment.owl");
PrintWriter writer1 = new PrintWriter ( new FileWriter( merged1, false ), true );
AlignmentVisitor renderer1 = new OWLAxiomsRendererVisitor(writer1);
result.render(renderer1);
writer1.flush();
writer1.close();
但我面对这个错误:
OWLAxiomsRenderer: cannot render simple alignment. Need an ObjectAlignment
答案 0 :(得分:0)
替换:
result.render(renderer1);
通过
ObjectAlignment oresult = ObjectAlignment.toObjectAlignment(result);
oresult.render(renderer1);
讨论:http://alignapi.gforge.inria.fr/builtin.html
请注意,为此,初始文件中的本体URI必须是可解除引用的。