2

我有一个本地文件并在这里alignment.rdf​​使用对齐 API 库我想创建对象并将其转换为 .owl 文件。Alignment

我的代码在这里:

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
4

1 回答 1

0

代替:

result.render(renderer1);

经过

ObjectAlignment oresult = ObjectAlignment.toObjectAlignment(result);
oresult.render(renderer1);

讨论:http ://alignapi.gforge.inria.fr/builtin.html

请注意,为此目的,初始文件中本体的 URI 必须是可解引用的。

于 2017-03-13T16:14:34.690 回答