diff --git a/examples/omwg/total.xml b/examples/omwg/total.xml index 8ed92b34b69c79d49ac047acb1a2c6ddb62fae6c..257f259d7755786457aea432716ba25cb43a40fd 100644 --- a/examples/omwg/total.xml +++ b/examples/omwg/total.xml @@ -665,13 +665,9 @@ <edoal:transformation> <edoal:Transformation edoal:type="o-"> <edoal:entity1> - <!--edoal:Property rdf:about="foaf:name"/--> - <!-- BELOW DOES NOT WORK --> <edoal:Property><edoal:compose rdf:parseType="Collection"/></edoal:Property> - <!--edoal:Property><edoal:self/></edoal:Property--> </edoal:entity1> <edoal:entity2> - <!-- APPLY DOES NOT WORK --> <edoal:Apply edoal:operator="concat"> <edoal:arguments rdf:parseType="Collection"> <edoal:Property rdf:about="vcard:firstname"/> @@ -687,5 +683,31 @@ </edoal:transformation> </Cell> </map> + <map> + <Cell rdf:about="ExtremeTransformationTest"> + <entity1> + <edoal:Class> + <edoal:or /> + </edoal:Class> + </entity1> + <entity2> + <edoal:Class> + <edoal:and /> + </edoal:Class> + </entity2> + <measure rdf:datatype='&xsd;float'>1.</measure> + <relation>SubsumedBy</relation> + <edoal:transformation> + <edoal:Transformation edoal:type="o-"> + <edoal:entity1> + <edoal:Relation><edoal:compose /></edoal:Relation> + </edoal:entity1> + <edoal:entity2> + <edoal:Relation><edoal:compose /></edoal:Relation> + </edoal:entity2> + </edoal:Transformation> + </edoal:transformation> + </Cell> + </map> </Alignment> </rdf:RDF> diff --git a/html/relnotes.html b/html/relnotes.html index af21a7aea88ed8a6edf2c8953ef3c2aa7be78c53..8ceb192e65a76288e22d1445fcd65ec5aebab6f3 100644 --- a/html/relnotes.html +++ b/html/relnotes.html @@ -31,7 +31,7 @@ Other less radical changes include: <ul compact="1"> <li>Implementation of <tt>Relation</tt> and <tt>Confidence</tt> interfaces </li> </ul> -Currently the development and maintainance of 3 versions continue. +The development and maintainance of 4 versions continue. </p> <h2>Under development (you can contribute)</h2> @@ -67,11 +67,13 @@ Currently the development and maintainance of 3 versions continue. <!--h2>Version 4.1 (1xxx): xx/09/2009 - Tring</h2--> <p><ul compact="1"> -<li>Added a getResult() method to Evaluator (api)</li> +<li>Added a <tt>getResult()</tt> method to <tt>Evaluator</tt> (api)</li> <li>Implemented online evaluation (server)</li> +<!--li>Implemented transformations in EDOAL (edoal)</li--> <li>Upgraded to <span style="color: green">Pellet 2.1</span> (lib)</li> <li>Added tutorial 4 Pellet action (tutorial)</li> <li>Fixed path errors in tutorials (tutorial)</li> +<li>Improved RDF Rendering layout (impl)</li> </ul></p> <h2>Version 4.0 (1415): 31/03/2010 - Rouquine carmélite</h2> diff --git a/src/fr/inrialpes/exmo/align/parser/RDFParser.java b/src/fr/inrialpes/exmo/align/parser/RDFParser.java index 5cc40886c11f81cc4a1947cf29463ff74acaf349..3d493a71ca3e58732ccb89ce6175150f512ea01e 100644 --- a/src/fr/inrialpes/exmo/align/parser/RDFParser.java +++ b/src/fr/inrialpes/exmo/align/parser/RDFParser.java @@ -493,15 +493,22 @@ public class RDFParser { throw new AlignmentException( "Class statement must containt one constructor or Id : "+node ); } } - Resource coll = stmt.getResource(); // MUSTCHECK - // JE: I guess that this may be NULL and thus be kept OK - // for <and />, <or /> and <compose /> + // Jena encode these collections as first/rest statements + Object o = stmt.getObject(); + Resource coll = null; // Errors if null tackled below + if ( o instanceof Resource) coll = (Resource)o; + if ( o instanceof Literal && !o.toString().equals("") ) + throw new AlignmentException( "Invalid content of constructor : "+o ); if ( op == SyntaxElement.NOT.getOperator() ) { + if ( coll == null ) + throw new AlignmentException( "NOT constructor cannot be empty : "+node ); clexpr.add( parseClass( coll ) ); - } else { // Jena encode these collections as first/rest statements - while ( !RDF.nil.getURI().equals( coll.getURI() ) ) { // THIS IS HORRIBLE - clexpr.add( parseClass( coll.getProperty( RDF.first ).getResource() ) ); - coll = coll.getProperty( RDF.rest ).getResource(); // MUSTCHECK + } else { + if ( coll != null ) { + while ( !RDF.nil.getURI().equals( coll.getURI() ) ) { + clexpr.add( parseClass( coll.getProperty( RDF.first ).getResource() ) ); + coll = coll.getProperty( RDF.rest ).getResource(); // MUSTCHECK + } } } return new ClassConstruction( op, clexpr ); @@ -614,13 +621,20 @@ public class RDFParser { throw new AlignmentException( "Property statement must containt one constructor or Id : "+node ); } } - Resource coll = stmt.getResource(); // MUSTCHECK - // JE: I guess that this may be NULL and thus be kept OK - // for <and />, <or /> and <compose /> + // Jena encode these collections as first/rest statements + Object o = stmt.getObject(); + Resource coll = null; // Errors if null tackled below + if ( o instanceof Resource) coll = (Resource)o; + if ( o instanceof Literal && !o.toString().equals("") ) + throw new AlignmentException( "Invalid content of constructor : "+o ); if ( op == SyntaxElement.NOT.getOperator() ) { + if ( coll == null ) + throw new AlignmentException( "NOT constructor cannot be empty : "+node ); clexpr.add( parseProperty( coll ) ); } else if ( op == SyntaxElement.COMPOSE.getOperator() ) { - while ( !RDF.nil.getURI().equals( coll.getURI() ) ) { // THIS IS HORRIBLE + if ( coll == null ) + throw new AlignmentException( "COMPOSE constructor for properties cannot be empty : "+node ); + while ( !RDF.nil.getURI().equals( coll.getURI() ) ) { // In this present case, it is a series of Relations followed by a Property Resource newcoll = coll.getProperty( RDF.rest ).getResource(); // MUSTCHECK if ( !RDF.nil.getURI().equals( newcoll.getURI() ) ) { @@ -631,9 +645,11 @@ public class RDFParser { coll = newcoll; } } else { // This is a first/rest statements - while ( !RDF.nil.getURI().equals( coll.getURI() ) ) { // THIS IS HORRIBLE - clexpr.add( parseProperty( coll.getProperty( RDF.first ).getResource() ) ); - coll = coll.getProperty( RDF.rest ).getResource(); // MUSTCHECK + if ( coll != null ) { + while ( !RDF.nil.getURI().equals( coll.getURI() ) ) { + clexpr.add( parseProperty( coll.getProperty( RDF.first ).getResource() ) ); + coll = coll.getProperty( RDF.rest ).getResource(); // MUSTCHECK + } } } return new PropertyConstruction( op, clexpr ); @@ -716,19 +732,26 @@ public class RDFParser { throw new AlignmentException( "Relation statement must containt one constructor or Id : "+node ); } } - Resource coll = stmt.getResource(); // MUSTCHECK - // JE: I guess that this may be NULL and thus be kept OK - // for <and />, <or /> and <compose /> + // Jena encode these collections as first/rest statements + Object o = stmt.getObject(); + Resource coll = null; // Errors if null tackled below + if ( o instanceof Resource) coll = (Resource)o; + if ( o instanceof Literal && !o.toString().equals("") ) + throw new AlignmentException( "Invalid content of constructor : "+o ); if ( op == SyntaxElement.NOT.getOperator() || op == SyntaxElement.INVERSE.getOperator() || op == SyntaxElement.REFLEXIVE.getOperator() || op == SyntaxElement.SYMMETRIC.getOperator() || op == SyntaxElement.TRANSITIVE.getOperator() ) { + if ( coll == null ) + throw new AlignmentException( op+" constructor cannot be empty : "+node ); clexpr.add( parseRelation( coll ) ); } else { // This is a first/rest statements - while ( !RDF.nil.getURI().equals( coll.getURI() ) ) { // THIS IS HORRIBLE - clexpr.add( parseRelation( coll.getProperty( RDF.first ).getResource() ) ); - coll = coll.getProperty( RDF.rest ).getResource(); // MUSTCHECK + if ( coll != null ) { + while ( !RDF.nil.getURI().equals( coll.getURI() ) ) { + clexpr.add( parseRelation( coll.getProperty( RDF.first ).getResource() ) ); + coll = coll.getProperty( RDF.rest ).getResource(); // MUSTCHECK + } } } return new RelationConstruction( op, clexpr );