简体   繁体   中英

How to create Alignment Object using alignment API

I have a local alignment.rdf file and using alignment API library here I want to create Alignment object and convert it to .owl file.

My code is here:

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();

but I face with this error:

OWLAxiomsRenderer: cannot render simple alignment. Need an ObjectAlignment

Replace:

result.render(renderer1);

by

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

Discussed in: http://alignapi.gforge.inria.fr/builtin.html

Note that for this purpose, the URI of the ontologies in the initial file must be dereferenceable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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