2016-08-26 87 views
2

我有本地alignment.rdf文件並使用對齊API庫here我想創建Alignment對象並將其轉換爲.owl文件。如何使用對齊API創建對齊對象

我的代碼是在這裏:

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

替換:

result.render(renderer1); 

通過

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

討論於:http://alignapi.gforge.inria.fr/builtin.html

請注意,爲此目的,初始文件中的本體的URI必須是可解引用的。