Mentions légales du service

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

- modified renderers needing Object/EDOALAlignments to convert them on the fly

parent 9aa58374
No related branches found
No related tags found
No related merge requests found
......@@ -87,6 +87,7 @@ with a warning:
<li>Added generation of local <a href="maven.html">maven repository</a> in build.xml</li>
<li>Implemented transactions in database store (server)</li>
<li>Modified evaluators needing <tt>ObjectAlignment</tt> to convert them on the fly (impl)</li>
<li>Modified renderers needing <tt>ObjectAlignment</tt> to convert them on the fly (impl)</li>
<li>Evaluators report better errors on the server (server)</li>
<li>Fixed a bug in <tt>WeightedPREvaluator</tt> (can be more than 1.) (impl)</li>
<li>Fixed strong bug in the implementation of relaxed precision and recall (impl)</li>
......
/*
* $Id$
*
* Copyright (C) INRIA, 2003-2004, 2007-2008, 2011-2012
* Copyright (C) INRIA, 2003-2004, 2007-2008, 2011-2013
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
......@@ -257,13 +257,7 @@ public class ParserPrinter {
try {
result.render( renderer );
} catch ( AlignmentException aex ) {
try {
result = ObjectAlignment.toObjectAlignment( (URIAlignment)result );
result.render( renderer );
} catch ( Exception aex2 ) {
// Throw the initial one
throw aex;
}
throw aex;
} finally {
writer.flush();
writer.close();
......
/*
* $Id$
*
* Copyright (C) INRIA, 2003-2004, 2007-2010, 2012
* Copyright (C) INRIA, 2003-2004, 2007-2010, 2012-2013
*
* 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
......@@ -32,7 +32,9 @@ import org.semanticweb.owl.align.Cell;
import org.semanticweb.owl.align.Relation;
import fr.inrialpes.exmo.align.impl.ObjectAlignment;
import fr.inrialpes.exmo.align.impl.URIAlignment;
import fr.inrialpes.exmo.align.impl.rel.*;
import fr.inrialpes.exmo.ontowrap.LoadedOntology;
import fr.inrialpes.exmo.ontowrap.OntowrapException;
......@@ -60,9 +62,15 @@ public class COWLMappingRendererVisitor extends GenericReflectiveVisitor impleme
public void visit( Alignment align ) throws AlignmentException {
if ( subsumedInvocableMethod( this, align, Alignment.class ) ) return;
// default behaviour
if ( !(align instanceof ObjectAlignment) )
throw new AlignmentException("COWLMappingRenderer: cannot render simple alignment. Turn them into ObjectAlignment, by toObjectAlignement()");
alignment = align;
if ( align instanceof ObjectAlignment ) {
alignment = align;
} else {
try {
alignment = ObjectAlignment.toObjectAlignment( (URIAlignment)align );
} catch ( AlignmentException alex ) {
throw new AlignmentException("COWLMappingRenderer: cannot render simple alignment. Need an ObjectAlignment", alex );
}
}
onto1 = (LoadedOntology)((ObjectAlignment)alignment).getOntologyObject1();
onto2 = (LoadedOntology)((ObjectAlignment)alignment).getOntologyObject2();
writer.print("<rdf:RDF\n");
......
/*
* $Id$
*
* Copyright (C) INRIA, 2003-2004, 2007-2012
* Copyright (C) INRIA, 2003-2004, 2007-2013
*
* 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
......@@ -35,6 +35,7 @@ import fr.inrialpes.exmo.align.impl.Annotations;
import fr.inrialpes.exmo.align.impl.Namespace;
import fr.inrialpes.exmo.align.impl.Extensions;
import fr.inrialpes.exmo.align.impl.ObjectAlignment;
import fr.inrialpes.exmo.align.impl.URIAlignment;
import fr.inrialpes.exmo.align.impl.BasicRelation;
import fr.inrialpes.exmo.align.impl.rel.*;
......@@ -107,14 +108,20 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements
public void visit( Alignment align ) throws AlignmentException {
if ( subsumedInvocableMethod( this, align, Alignment.class ) ) return;
// default behaviour
alignment = align;
if ( align instanceof ObjectAlignment ){
if ( align instanceof ObjectAlignment ) {
alignment = align;
onto1 = (LoadedOntology)((ObjectAlignment)alignment).getOntologyObject1();
onto2 = (LoadedOntology)((ObjectAlignment)alignment).getOntologyObject2();
} else if ( align instanceof EDOALAlignment ) {
edoal = true;
} else {
throw new AlignmentException("OWLAxiomsRenderer: cannot render simple alignment. Turn them into ObjectAlignment, by toObjectAlignement() or use EDOALAlignment");
try {
alignment = ObjectAlignment.toObjectAlignment( (URIAlignment)align );
onto1 = (LoadedOntology)((ObjectAlignment)alignment).getOntologyObject1();
onto2 = (LoadedOntology)((ObjectAlignment)alignment).getOntologyObject2();
} catch ( AlignmentException alex ) {
throw new AlignmentException("OWLAxiomsRenderer: cannot render simple alignment. Need an ObjectAlignment", alex );
}
}
writer.print("<rdf:RDF"+NL);
writer.print(" xmlns:owl=\"http://www.w3.org/2002/07/owl#\""+NL);
......
/*
* $Id$
*
* Copyright (C) INRIA, 2003-2005, 2007-2010, 2012
* Copyright (C) INRIA, 2003-2005, 2007-2010, 2012-2013
*
* 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
......@@ -33,6 +33,7 @@ import org.semanticweb.owl.align.Cell;
import org.semanticweb.owl.align.Relation;
import fr.inrialpes.exmo.align.impl.ObjectAlignment;
import fr.inrialpes.exmo.align.impl.URIAlignment;
import fr.inrialpes.exmo.align.impl.rel.*;
import fr.inrialpes.exmo.ontowrap.LoadedOntology;
......@@ -64,9 +65,15 @@ public class SEKTMappingRendererVisitor extends GenericReflectiveVisitor impleme
public void visit( Alignment align ) throws AlignmentException {
if ( subsumedInvocableMethod( this, align, Alignment.class ) ) return;
// default behaviour
if ( !(align instanceof ObjectAlignment) )
throw new AlignmentException("SEKTMappingRenderer: cannot render simple alignment. Turn them into ObjectAlignment, by toObjectAlignement()");
alignment = align;
if ( align instanceof ObjectAlignment ) {
alignment = align;
} else {
try {
alignment = ObjectAlignment.toObjectAlignment( (URIAlignment)align );
} catch ( AlignmentException alex ) {
throw new AlignmentException("SEKTMappingRenderer: cannot render simple alignment. Need an ObjectAlignment", alex );
}
}
onto1 = (LoadedOntology)((ObjectAlignment)alignment).getOntologyObject1();
onto2 = (LoadedOntology)((ObjectAlignment)alignment).getOntologyObject2();
writer.print("MappingDocument(<\""+"\">\n");
......
......@@ -20,16 +20,19 @@
package fr.inrialpes.exmo.align.impl.renderer;
import fr.inrialpes.exmo.align.impl.edoal.EDOALCell;
import fr.inrialpes.exmo.align.impl.edoal.Expression;
import fr.inrialpes.exmo.align.impl.edoal.Transformation;
import java.io.PrintWriter;
import org.semanticweb.owl.align.Alignment;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.AlignmentVisitor;
import org.semanticweb.owl.align.Cell;
import org.semanticweb.owl.align.Relation;
import fr.inrialpes.exmo.align.impl.BasicAlignment;
import fr.inrialpes.exmo.align.impl.edoal.EDOALAlignment;
import fr.inrialpes.exmo.align.impl.edoal.EDOALCell;
import fr.inrialpes.exmo.align.impl.edoal.Expression;
import fr.inrialpes.exmo.align.impl.edoal.Transformation;
import java.io.PrintWriter;
import java.net.URI;
import java.util.ArrayList;
import java.util.Enumeration;
......@@ -77,9 +80,17 @@ public class SPARQLConstructRendererVisitor extends GraphPatternRendererVisitor
NL = p.getProperty( "newline" );
}
public void visit(Alignment align) throws AlignmentException {
public void visit( Alignment align ) throws AlignmentException {
if ( subsumedInvocableMethod( this, align, Alignment.class ) ) return;
alignment = align;
if ( align instanceof EDOALAlignment ) {
alignment = align;
} else {
try {
alignment = EDOALAlignment.toEDOALAlignment( (BasicAlignment)align );
} catch ( AlignmentException alex ) {
throw new AlignmentException("SPARQLSELECTRenderer: cannot render simple alignment. Need an EDOALAlignment", alex );
}
}
content_Corese = "";
content_Corese += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + NL;
content_Corese += "<!DOCTYPE rdf:RDF [" + NL;
......@@ -99,7 +110,7 @@ public class SPARQLConstructRendererVisitor extends GraphPatternRendererVisitor
}
}
public void visit(Cell cell) throws AlignmentException {
public void visit( Cell cell ) throws AlignmentException {
if ( subsumedInvocableMethod( this, cell, Cell.class ) ) return;
// default behaviour
this.cell = cell;
......
......@@ -20,13 +20,17 @@
package fr.inrialpes.exmo.align.impl.renderer;
import fr.inrialpes.exmo.align.impl.edoal.Expression;
import java.io.PrintWriter;
import org.semanticweb.owl.align.Alignment;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.AlignmentVisitor;
import org.semanticweb.owl.align.Cell;
import org.semanticweb.owl.align.Relation;
import fr.inrialpes.exmo.align.impl.BasicAlignment;
import fr.inrialpes.exmo.align.impl.edoal.EDOALAlignment;
import fr.inrialpes.exmo.align.impl.edoal.Expression;
import java.io.PrintWriter;
import java.net.URI;
import java.util.Enumeration;
import java.util.Hashtable;
......@@ -65,21 +69,28 @@ public class SPARQLSelectRendererVisitor extends GraphPatternRendererVisitor imp
NL = p.getProperty( "newline" );
}
public void visit(Alignment align) throws AlignmentException {
public void visit( Alignment align ) throws AlignmentException {
if ( subsumedInvocableMethod( this, align, Alignment.class ) ) return;
alignment = align;
if ( align instanceof EDOALAlignment ) {
alignment = align;
} else {
try {
alignment = EDOALAlignment.toEDOALAlignment( (BasicAlignment)align );
} catch ( AlignmentException alex ) {
throw new AlignmentException("SPARQLSELECTRenderer: cannot render simple alignment. Need an EDOALAlignment", alex );
}
}
for( Cell c : align ){ c.accept( this ); };
}
public void visit(Cell cell) throws AlignmentException {
public void visit( Cell cell ) throws AlignmentException {
if ( subsumedInvocableMethod( this, cell, Cell.class ) ) return;
String query = "";
this.cell = cell;
URI u1 = cell.getObject1AsURI(alignment);
URI u2 = cell.getObject2AsURI(alignment);
if ( ( u1 != null && u2 != null)
|| alignment.getLevel().startsWith("2EDOAL") ){
if ( ( u1 != null && u2 != null) || alignment.getLevel().startsWith("2EDOAL") ) {
resetVariables("s", "o");
((Expression)(cell.getObject1())).accept( this );
GP1 = getGP();
......
/*
* $Id$
*
* Copyright (C) INRIA, 2003-2004, 2007-2010, 2012
* Copyright (C) INRIA, 2003-2004, 2007-2010, 2012-2013
*
* 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
......@@ -32,6 +32,7 @@ import org.semanticweb.owl.align.Cell;
import org.semanticweb.owl.align.Relation;
import fr.inrialpes.exmo.align.impl.ObjectAlignment;
import fr.inrialpes.exmo.align.impl.URIAlignment;
import fr.inrialpes.exmo.align.impl.rel.*;
import fr.inrialpes.exmo.ontowrap.LoadedOntology;
......@@ -65,9 +66,15 @@ public class SWRLRendererVisitor extends GenericReflectiveVisitor implements Ali
public void visit( Alignment align ) throws AlignmentException {
if ( subsumedInvocableMethod( this, align, Alignment.class ) ) return;
// default behaviour
if ( !( align instanceof ObjectAlignment) )
throw new AlignmentException("SWRLRenderer: cannot render simple alignment. Turn them into ObjectAlignment, by toObjectAlignement()");
alignment = align;
if ( align instanceof ObjectAlignment ) {
alignment = align;
} else {
try {
alignment = ObjectAlignment.toObjectAlignment( (URIAlignment)align );
} catch ( AlignmentException alex ) {
throw new AlignmentException("SWRLRenderer: cannot render simple alignment. Need an ObjectAlignment", alex );
}
}
onto1 = (LoadedOntology)((ObjectAlignment)alignment).getOntologyObject1();
onto2 = (LoadedOntology)((ObjectAlignment)alignment).getOntologyObject2();
if ( embedded == false )
......
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