Mentions légales du service

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

Improvement of the rendering of EDOAL objects in HTML

parent 8f3c679d
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,11 @@ import fr.inrialpes.exmo.align.impl.Namespace; ...@@ -40,6 +40,11 @@ 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.ObjectCell; import fr.inrialpes.exmo.align.impl.ObjectCell;
import fr.inrialpes.exmo.align.impl.edoal.EDOALAlignment; import fr.inrialpes.exmo.align.impl.edoal.EDOALAlignment;
import fr.inrialpes.exmo.align.impl.edoal.Expression;
import fr.inrialpes.exmo.align.impl.edoal.ClassExpression;
import fr.inrialpes.exmo.align.impl.edoal.PropertyExpression;
import fr.inrialpes.exmo.align.impl.edoal.RelationExpression;
import fr.inrialpes.exmo.align.impl.edoal.InstanceExpression;
import fr.inrialpes.exmo.ontowrap.LoadedOntology; import fr.inrialpes.exmo.ontowrap.LoadedOntology;
...@@ -75,7 +80,7 @@ public class HTMLRendererVisitor extends HTMLMetadataRendererVisitor implements ...@@ -75,7 +80,7 @@ public class HTMLRendererVisitor extends HTMLMetadataRendererVisitor implements
printAlignmentMetadata( align ); printAlignmentMetadata( align );
indentedOutputln("<h2>Correspondences ("+align.nbCells()+")</h2>"); indentedOutputln("<h2>Correspondences ("+align.nbCells()+")</h2>");
if ( align instanceof EDOALAlignment ) { if ( align instanceof EDOALAlignment ) {
indentedOutputln("<p style=\"font-size: 80%\">EDOAL alignments are not deeply displayed in HTML, some expressions are displayed by null. Use RDF renderer to see the actual alignment.</p>"); indentedOutputln("<p style=\"font-size: 80%\">EDOAL alignments are not deeply displayed in HTML, some expressions are displayed as [[ EDOAL ]]. Use RDF renderer to see the actual alignment.</p>");
} }
indentedOutputln("<div rel=\"align:map\">"); indentedOutputln("<div rel=\"align:map\">");
...@@ -104,12 +109,23 @@ public class HTMLRendererVisitor extends HTMLMetadataRendererVisitor implements ...@@ -104,12 +109,23 @@ public class HTMLRendererVisitor extends HTMLMetadataRendererVisitor implements
indentedOutputln("</html>"); indentedOutputln("</html>");
} }
private String renderObject( URI u, Object o ) {
if ( u != null ) return u.toString();
else if ( o instanceof Expression ) {
if ( o instanceof ClassExpression ) return "[[ EDOAL Class expression ]]";
else if ( o instanceof PropertyExpression ) return "[[ EDOAL Property expression ]]";
else if ( o instanceof RelationExpression ) return "[[ EDOAL Relation expression ]]";
else if ( o instanceof InstanceExpression ) return "[[ EDOAL Instance expression ]]";
else return "[[ EDOAL Unknown expression ]]";
} else return "** Unknown object **";
}
public void visit( Cell cell ) throws AlignmentException { public void visit( Cell cell ) throws AlignmentException {
if ( subsumedInvocableMethod( this, cell, Cell.class ) ) return; if ( subsumedInvocableMethod( this, cell, Cell.class ) ) return;
// default behaviour // default behaviour
this.cell = cell; this.cell = cell;
URI u1 = cell.getObject1AsURI( alignment ); String u1 = renderObject( cell.getObject1AsURI( alignment ), cell.getObject1() );
URI u2 = cell.getObject2AsURI( alignment ); String u2 = renderObject( cell.getObject2AsURI( alignment ), cell.getObject2() );
indentedOutput("<tr typeof=\"align:Cell\">"); indentedOutput("<tr typeof=\"align:Cell\">");
output("<td rel=\"align:entity1\" href=\""+u1+"\">"+u1+"</td><td property=\"align:relation\">"); output("<td rel=\"align:entity1\" href=\""+u1+"\">"+u1+"</td><td property=\"align:relation\">");
cell.getRelation().accept( this ); cell.getRelation().accept( this );
......
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