Mentions légales du service

Skip to content
Snippets Groups Projects
Commit ef3360e9 authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- Added EDOALAlignment.toEDOALAlignment

parent fe2f37f8
No related branches found
No related tags found
No related merge requests found
...@@ -78,6 +78,7 @@ with a warning: ...@@ -78,6 +78,7 @@ with a warning:
<span style="color: green">Xerces 2.10</span>, <span style="color: green">Xerces 2.10</span>,
<span style="color: green">log4j 1.2.16</span>, <span style="color: green">log4j 1.2.16</span>,
<span style="color: green">slf4j 1.6.4</span> (lib)</li--> <span style="color: green">slf4j 1.6.4</span> (lib)</li-->
<li>Added <tt>EDOALAlignment.toEDOALAlignment()</tt> (edoal)</li>
<li>Simplified <tt>TestGen</tt> options (cli)</li> <li>Simplified <tt>TestGen</tt> options (cli)</li>
<li>Fixed server initialisation error with new log4j (server)</li> <li>Fixed server initialisation error with new log4j (server)</li>
<li>All documentation has now been revised in html and is not in the (outdated) manuals (html)</li> <li>All documentation has now been revised in html and is not in the (outdated) manuals (html)</li>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* $Id$ * $Id$
* *
* Sourceforge version 1.6 - 2008 - was OMWGAlignment * Sourceforge version 1.6 - 2008 - was OMWGAlignment
* Copyright (C) INRIA, 2007-2011 * Copyright (C) INRIA, 2007-2012
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
...@@ -42,6 +42,7 @@ import fr.inrialpes.exmo.align.impl.Annotations; ...@@ -42,6 +42,7 @@ import fr.inrialpes.exmo.align.impl.Annotations;
import fr.inrialpes.exmo.align.impl.Namespace; import fr.inrialpes.exmo.align.impl.Namespace;
import fr.inrialpes.exmo.align.impl.BasicAlignment; import fr.inrialpes.exmo.align.impl.BasicAlignment;
import fr.inrialpes.exmo.align.impl.URIAlignment; import fr.inrialpes.exmo.align.impl.URIAlignment;
import fr.inrialpes.exmo.align.impl.ObjectAlignment;
import fr.inrialpes.exmo.align.impl.Extensions; import fr.inrialpes.exmo.align.impl.Extensions;
import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor; import fr.inrialpes.exmo.align.parser.TypeCheckingVisitor;
...@@ -243,7 +244,18 @@ public class EDOALAlignment extends BasicAlignment { ...@@ -243,7 +244,18 @@ public class EDOALAlignment extends BasicAlignment {
* convert an URI alignment into a corresponding EDOALAlignment * convert an URI alignment into a corresponding EDOALAlignment
* The same could be implemented for ObjectAlignent if necessary * The same could be implemented for ObjectAlignent if necessary
*/ */
// This works for any BasicAlignment but will return an empty
// alignment if they do not have proper URI dereferencing.
// It would be better to implement this for ObjectAlignment
// and to use return toEDOALAlignment( ObjectAlignment.toObjectAlignment( al ) );
// for URIAlignment
public static EDOALAlignment toEDOALAlignment( URIAlignment al ) throws AlignmentException { public static EDOALAlignment toEDOALAlignment( URIAlignment al ) throws AlignmentException {
return toEDOALAlignment( (BasicAlignment)al );
}
public static EDOALAlignment toEDOALAlignment( ObjectAlignment al ) throws AlignmentException {
return toEDOALAlignment( (BasicAlignment)al );
}
public static EDOALAlignment toEDOALAlignment( BasicAlignment al ) throws AlignmentException {
EDOALAlignment alignment = new EDOALAlignment(); EDOALAlignment alignment = new EDOALAlignment();
try { try {
alignment.init( al.getFile1(), al.getFile2() ); alignment.init( al.getFile1(), al.getFile2() );
...@@ -255,32 +267,32 @@ public class EDOALAlignment extends BasicAlignment { ...@@ -255,32 +267,32 @@ public class EDOALAlignment extends BasicAlignment {
} }
} }
alignment.setType( al.getType() ); alignment.setType( al.getType() );
//alignment.setLevel( al.getLevel() ); // Should n't it be EDOAL level?
alignment.setExtensions( al.convertExtension( "EDOALConverted", "fr.inrialpes.exmo.align.edoal.EDOALAlignment#toEDOAL" ) ); alignment.setExtensions( al.convertExtension( "EDOALConverted", "fr.inrialpes.exmo.align.edoal.EDOALAlignment#toEDOAL" ) );
LoadedOntology<Object> o1 = (LoadedOntology<Object>)alignment.getOntologyObject1(); // [W:unchecked] LoadedOntology<Object> o1 = (LoadedOntology<Object>)alignment.getOntologyObject1(); // [W:unchecked]
LoadedOntology<Object> o2 = (LoadedOntology<Object>)alignment.getOntologyObject2(); // [W:unchecked] LoadedOntology<Object> o2 = (LoadedOntology<Object>)alignment.getOntologyObject2(); // [W:unchecked]
try { for ( Cell c : al ) {
for ( Cell c : al ) { try {
// HERE THIS SHOULD BE CREATED AS THE CORRESPONDING ID DEPENDING ON THEIR TYPES... MAKE A FUNCTION
Cell newc = alignment.addAlignCell( c.getId(), Cell newc = alignment.addAlignCell( c.getId(),
getEntity( o1, c.getObject1AsURI(alignment) ), createEDOALExpression( o1, c.getObject1AsURI( al ) ),
getEntity( o2, c.getObject2AsURI(alignment) ), createEDOALExpression( o2, c.getObject2AsURI( al ) ),
c.getRelation(), c.getRelation(),
c.getStrength() ); c.getStrength() );
Collection<String[]> exts = c.getExtensions(); Collection<String[]> exts = c.getExtensions();
if ( exts != null ) { if ( exts != null ) {
for ( String[] ext : exts ){ for ( String[] ext : exts ){
newc.setExtension( ext[0], ext[1], ext[2] ); newc.setExtension( ext[0], ext[1], ext[2] );
} }
} }
} catch ( AlignmentException aex ) {
aex.printStackTrace(); // continue to concert the rest
} catch ( OntowrapException owex ) {
throw new AlignmentException( "Cannot dereference entity", owex );
} }
} catch ( OntowrapException owex ) {
throw new AlignmentException( "Cannot dereference entity", owex );
} }
return alignment; return alignment;
} }
static private Id getEntity( LoadedOntology<Object> o, URI u ) throws OntowrapException, AlignmentException { private static Id createEDOALExpression( LoadedOntology<Object> o, URI u ) throws OntowrapException, AlignmentException {
Object e = o.getEntity( u ); Object e = o.getEntity( u );
if ( o.isClass( e ) ) { if ( o.isClass( e ) ) {
return new ClassId( u ); return new ClassId( u );
...@@ -293,10 +305,6 @@ public class EDOALAlignment extends BasicAlignment { ...@@ -293,10 +305,6 @@ public class EDOALAlignment extends BasicAlignment {
} else throw new AlignmentException( "Cannot interpret URI" ); } else throw new AlignmentException( "Cannot interpret URI" );
} }
/**
* Returns the mappings of the EDOALAlignment
* @return The set of rules contained by the EDOALAlignment
*/
/** /**
* Generate a copy of this alignment object * Generate a copy of this alignment object
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment