简体   繁体   中英

error in generating owl alignment from rdf alignment using Align API

I have done ontology matching on two ontologies and it's result is alignment.rdf. Now I want to generate owl file from alignment rdf using Align API library.

According to Align API documentation here is my code :

PrintWriter writer1 = null ;
    Alignment temp = null ;
    Alignment temp1 = null ;
    AlignmentParser aparser = new AlignmentParser();
    temp = aparser.parse( "file:Ontologies/final_alignment.rdf" );
    temp1 = ObjectAlignment.toObjectAlignment((URIAlignment)temp);
    File merged1 = new File( "Ontologies/final_alignment.owl");
    writer1 = new PrintWriter ( new FileWriter( merged1, false ), true );
    AlignmentVisitor renderer1 = new OWLAxiomsRendererVisitor( writer1 );
    temp1.render(renderer1);
    writer1.flush();
    writer1.close();    

But I face this error in line temp1 = ObjectAlignment.toObjectAlignment((URIAlignment)temp); :

Error: Exception in thread "main" org.semanticweb.owl.align.AlignmentException: Arguments must be LoadedOntology or URI

how can I get rid of this error ?

I guess this is a follow-up to [1].

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

More precisely, this means that from the URI in your file, Jena or the OWL API should be able to load the ontologies, and, since your trying to render them as OWL, these are OWLOntologies.

These may eventually be local URIs (starting with file://).

[1] How to create Alignment Object using alignment API

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