42688

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

Answer1:

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.

Recommend

  • SPARQL Federated Query Not Returning All Solutions
  • Could anyone help me with a tool for RDF/OWL visualization?
  • swrlx:makeOWLThing is creating only one individual
  • How to call a method from loaded class using classLoader?
  • How do you read a text file and print it to the console window? Java
  • Is it possible to know the duration of an MP3 before the entire file is downloaded?
  • Delete blank node from ontology through SPARQL UPDATE
  • Firebase connection state listener returns false in javascript
  • Store ArrayList into SharedPreferences
  • Java/JavaFX: Set Swing Icon for JavaFX label
  • How to write xml into a file using MarkupBuilder
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • Master page gives error
  • JFileChooser in front of fullscreen Swing application
  • jQuery show() function is not executed in Safari if submit handler returns true
  • Align navbar back button on right side
  • HTML download movie download link
  • Modifying destination and filename of gulp-svg-sprite
  • How to handle AllServersUnavailable Exception
  • How to model a transition system with SPIN
  • VBA Convert delimiter text file to Excel
  • ORA-29908: missing primary invocation for ancillary operator
  • php design question - will a Helper help here?
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • How to disable jQuery.jplayer autoplay?
  • AngularJs get employee from factory
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • coudnt use logback because of log4j
  • How to stop GridView from loading again when I press back button?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Authorize attributes not working in MVC 4
  • Bitwise OR returns boolean when one of operands is nil
  • Can't mass-assign protected attributes when import data from csv file
  • sending mail using smtp is too slow
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • Binding checkboxes to object values in AngularJs
  • How can I use `wmic` in a Windows PE script?