From ca46308e3c7c1a3f87fbee8b66c6b178eb1a07be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr> Date: Wed, 7 Jan 2015 18:15:34 +0000 Subject: [PATCH] - suppressed too strict test on compose properties (can actually be empty) --- .../exmo/align/impl/edoal/PropertyConstruction.java | 13 ++++++++----- src/fr/inrialpes/exmo/align/parser/RDFParser.java | 7 ++++--- test/src/EDOALExportTest.java | 1 + 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyConstruction.java b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyConstruction.java index 0999db64..6d71879c 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/PropertyConstruction.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/PropertyConstruction.java @@ -65,12 +65,15 @@ public class PropertyConstruction extends PropertyExpression { } if ( op == SyntaxElement.COMPOSE.getOperator() ) { // In case of COMPOSE, the list should have only relations and end in a property - for ( PathExpression pe : components.subList( 0, components.size()-1 ) ) { - if ( ! ( pe instanceof RelationExpression ) ) - throw new IllegalArgumentException( "Property composition must be based on relation expressions" ); + // Or, it can be empty! If it is a path starting from a property! (see total.xml) + if ( !expressions.isEmpty() ) { + for ( PathExpression pe : components.subList( 0, components.size()-1 ) ) { + if ( ! ( pe instanceof RelationExpression ) ) + throw new IllegalArgumentException( "Property composition must be based on relation expressions" ); + } + if ( ! ( components.get( components.size()-1 ) instanceof PropertyExpression ) ) + throw new IllegalArgumentException( "Property composition must end by a property expression" ); } - if ( ! ( components.get( components.size()-1 ) instanceof PropertyExpression ) ) - throw new IllegalArgumentException( "Property composition must end by a property expressions" ); } else if ( op == SyntaxElement.AND.getOperator() || op == SyntaxElement.OR.getOperator() || op == SyntaxElement.NOT.getOperator() ) { diff --git a/src/fr/inrialpes/exmo/align/parser/RDFParser.java b/src/fr/inrialpes/exmo/align/parser/RDFParser.java index be0e8b90..942891ce 100644 --- a/src/fr/inrialpes/exmo/align/parser/RDFParser.java +++ b/src/fr/inrialpes/exmo/align/parser/RDFParser.java @@ -774,9 +774,10 @@ public class RDFParser { } clexpr.add(parseProperty(coll)); } else if (op == SyntaxElement.COMPOSE.getOperator()) { - if (coll == null) { - throw new AlignmentException("COMPOSE constructor for properties cannot be empty : " + node); - } + // It can: see total.xml/TransformationTest + //if ( coll == null || RDF.nil.getURI().equals( coll.getURI() ) ) { + // throw new AlignmentException("COMPOSE constructor 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 diff --git a/test/src/EDOALExportTest.java b/test/src/EDOALExportTest.java index ca5aed04..60e4b237 100644 --- a/test/src/EDOALExportTest.java +++ b/test/src/EDOALExportTest.java @@ -213,6 +213,7 @@ public class EDOALExportTest { writer.flush(); writer.close(); String str1 = stream.toString(); + //System.err.println(str1); assertEquals(str1.length(), 37286); } -- GitLab