From 7eee61de10d4c1873208113780866677e756c714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr> Date: Fri, 13 Nov 2015 11:11:56 +0000 Subject: [PATCH] - Added Aggregate transformation to EDOAL (edoal) --- html/edoal.html | 109 ++++++++++++------ html/relnotes.html | 5 +- .../exmo/align/impl/edoal/EDOALVisitor.java | 1 + .../renderer/GraphPatternRendererVisitor.java | 4 + .../impl/renderer/JSONRendererVisitor.java | 23 ++++ .../renderer/OWLAxiomsRendererVisitor.java | 5 + .../impl/renderer/RDFRendererVisitor.java | 17 +++ .../exmo/align/parser/RDFParser.java | 25 ++++ .../exmo/align/parser/SyntaxElement.java | 1 + 9 files changed, 150 insertions(+), 40 deletions(-) diff --git a/html/edoal.html b/html/edoal.html index 38ca80d5..3f261863 100644 --- a/html/edoal.html +++ b/html/edoal.html @@ -104,7 +104,7 @@ correspondences between the entities of different ontologies. Unlike other formats, the alignment vocabulary allows to represent complex correspondences allowing to precisely describe the relation between the entities. The alignment vocabulary extends -the <a href="format.html">alignment format</a>.</p> +the <a href="format.html">Alignment format</a>.</p> <!--dl> <dt><a href="#sec:purpose">Purpose</a></dt> @@ -128,11 +128,11 @@ the <a href="format.html">alignment format</a>.</p> </pre> </div--> -<p>Representing ontology alignments is the general purpose of this vocabulary. Particularly, it extends the ontology <a href="format.html">alignment format</a> in order to enable the representation of complex correspondences.</p> +<p>Representing ontology alignments is the general purpose of this vocabulary. Particularly, it extends the ontology <a href="format.html">Alignment format</a> in order to enable the representation of complex correspondences.</p> <p>This format can be used for cases where expressing equivalence or subsumption between terms is not sufficient, when more precise relations need to be expressed. While term equivalence or subsumption might be enough for exchanging documents, more precise relations are needed to exchange and integrate data.</p> -<p>This vocabulary was originally designed with the goal of representing patterns of correspondence between ontologies. It was since then both simplified and extended to obtain a minimal vocabulary on top of the alignment format, able to express all possible kinds of ontology alignments.</p> +<p>This vocabulary was originally designed with the goal of representing patterns of correspondence between ontologies. It was since then both simplified and extended to obtain a minimal vocabulary on top of the Alignment format, able to express all possible kinds of ontology alignments.</p> <h3 id="sec:features">Features</h3> @@ -170,7 +170,7 @@ However, we are glad that you report errors in the other syntaxes as well. <h2 id="ssec:headers">Alignment and cells</h2> <p> -In the alignment format, an alignment is a set of cells, each cell being a correspondence between two entities. The alignment vocabulary extend this scheme by allowing cells to contain compound entity descriptions. Each entity can be typed according to one of the following category: Class, Instance, Relation, Property. A relation corresponds to an object property in OWL, a property to a datatype property. Each entity can then be restricted, and transformation can be specified on propery values. +In the Alignment format, an alignment is a set of cells, each cell being a correspondence between two entities. The alignment vocabulary extend this scheme by allowing cells to contain compound entity descriptions. Each entity can be typed according to one of the following category: Class, Instance, Relation, Property. A relation corresponds to an object property in OWL, a property to a datatype property. Each entity can then be restricted, and transformation can be specified on propery values. </p> <!--p> The diagram below shows the vocabulary classes ??? @@ -179,7 +179,7 @@ The diagram below shows the vocabulary classes ??? </p--> <p> -While <i>Alignment</i> and <i>Cell</i> are described by the <a href="format.html">alignment format</a>, we will focus here on the remaining classes.</p> +While <i>Alignment</i> and <i>Cell</i> are described by the <a href="format.html">Alignment format</a>, we will focus here on the remaining classes.</p> <h3 id="ssec:namespaces">Namespaces</h3> <p> @@ -195,7 +195,7 @@ prefix: edoal). EDOAL vocabulary is dereferenceable (see <a href="#deref">below< <h3 id="ssec:alignment">Alignment format</h3> <p> -An EDOAL alignment is an alignment as specified by the alignment format. +An EDOAL alignment is an alignment as specified by the Alignment format. It is identified by its level which must be "2EDOAL". This tells tools that the alignment is on level 2, i.e., correspondences are across constructed entities, and that the corresponding entities are specified according to the expressive language. This ensures the compatibility with other extensions of the format. @@ -238,7 +238,7 @@ exemplified in the code below. ... </div></div> -<p>Details on each property are available on the <a href="format.html">alignment format</a> page.</p> +<p>Details on each property are available on the <a href="format.html">Alignment format</a> page.</p> <p>An alignment contains a set of correspondences (<tt>Cell</tt>s). Each cell can be linked to an alignment using the <tt>map</tt> property. @@ -310,7 +310,7 @@ EDOALCell extends BasicCell | |- ClassOccurenceRestriction | |- ClassTypeRestriction | |- ClassValueRestriction -|- <b>PathExpression</b> implements <i>ValueExpression</i> +|- <b>PathExpression</b> implements <a href="#ssec:values"><i>ValueExpression</i></a> | |- <a href="#ssec:properties"><b>PropertyExpression</b></a> | | |- PropertyId implements <i>Id</i> | | |- PropertyConstruction @@ -324,16 +324,17 @@ EDOALCell extends BasicCell | |- <b>RelationRestriction</b> | |- RelationCoDomainRestriction | |- RelationDomainRestriction -|- <a href="#ssec:instances"><b>InstanceExpression</b></a> +|- <a href="#ssec:instances"><b>InstanceExpression</b></a> implements <a href="#ssec:values"><i>ValueExpression</i></a> |- InstanceId implements <i>Id</i> -Value implements <i>ValueExpression</i> -Apply implements <i>ValueExpression</i> -Transformation -Linkkey +Value implements <a href="#ssec:values"><i>ValueExpression</i></a> +Apply implements <a href="#ssec:values"><i>ValueExpression</i></a> +Aggregate implements <a href="#ssec:values"><i>ValueExpression</i></a> +<a href="#ssec:transf">Transformation</a> +<a href="#ssec:linkkeys">Linkkey</a> Equals -Includes -TransfService implements <i>Clonable</i> -<a href="sec:patterns">Variable</a> +Intersects<!-- +TransfService implements <i>Clonable</i> --> +<a href="#sec:patterns">Variable</a> Comparator Datatype </pre> @@ -712,7 +713,7 @@ circumstances. or <tt>this</tt> in some languages). </p> -<h2 id="ssec:values">Values</h2> +<h2 id="ssec:values">Value expressions</h2> <p> A value expression may be used in alignments for denoting an @@ -735,6 +736,7 @@ They obey the following grammar: <!-- | <Literal {edoal:type=" <u>URI</u> "}> <u>STRING</u> </Literal> --> | <u>instexpr</u> | <u>attrexpr</u> | <Apply edoal:operator=" <u>URI</u> "> <arguments rdf:parseType="Collection"><u>value</u>*</arguments> </Apply> + | <Aggregate edoal:operator=" <u>URI</u> "> <arguments rdf:parseType="Collection"><u>value</u>*</arguments> </Aggregate> <!-- JE: this is unfortunately ugly, otherwise, this is perfect REST--><!-- | <Service edoal:operator=" <u>URI</u> "> <arguments rdf:parseType="Collection"><u>param</u>*</arguments> </Service> @@ -1283,7 +1285,7 @@ the EDOAL API requires complete knowledge of the alignment. <p>This is an abstract class, never instantiated in the format.</p> <dl> <dt>URI</dt><dd><a href="#Value">http://ns.inria.org/edoal/1.0/#Value</a></dd> -<dt>subclasses</dt><dd><a href="#Literal">Literal</a>, <a href="#Instance">Instance</a>, <a href="#Attribute">Attribute</a>, <a href="#Apply">Apply</a>, </dd> +<dt>subclasses</dt><dd><a href="#Literal">Literal</a>, <a href="#Instance">Instance</a>, <a href="#Attribute">Attribute</a>, <a href="#Apply">Apply</a>, <a href="#Aggregate">Aggregate</a></dd> </dl></div> <div class="vocab"> @@ -1318,19 +1320,29 @@ the EDOAL API requires complete knowledge of the alignment. <dt>properties</dt><dd><a href="#operator">operator</a>, <a href="#arguments">arguments</a></dd> </dl></div> +<div class="vocab"> +<h3>Class: <a name="Aggregate">Aggregate</a></h3> +<dl> +<dt>URI</dt><dd><a href="#Aggregate">http://ns.inria.org/edoal/1.0/#Aggregate</a></dd> +<dt>superclasses</dt><dd><a href="#Value">Value</a></dd> +<dt>properties</dt><dd><a href="#operator">operator</a>, <a href="#arguments">arguments</a></dd> +</dl></div> + <div class="vocab"> <h3>Property: <a name="operator">operator</a></h3> +<p>The name of the operator to apply.</p> <dl> <dt>URI</dt><dd><a href="#operator">http://ns.inria.org/edoal/1.0/#operator</a></dd> -<dt>domain</dt><dd><a href="#Apply">Apply</a></dd> -<dt>range</dt><dd><a href="#Operator">Operator</a></dd> +<dt>domain</dt><dd><a href="#Apply">Apply</a>,<a href="#Aggregate">Aggregate</a></dd> +<dt>range</dt><dd>URI</dd> +<dt>see also</dt><dd><a href="#ssec:values">Value expression</a></dd> </dl></div> <div class="vocab"> <h3>Property: <a name="arguments">arguments</a></h3> <dl> <dt>URI</dt><dd><a href="#arguments">http://ns.inria.org/edoal/1.0/#argument</a></dd> -<dt>domain</dt><dd><a href="#Apply">Apply</a></dd> +<dt>domain</dt><dd><a href="#Apply">Apply</a>,<a href="#Aggregate">Aggregate</a></dd> <dt>range</dt><dd>Sequence(<a href="#Value">Value</a>)</dd> </dl></div> @@ -1597,6 +1609,39 @@ the EDOAL API requires complete knowledge of the alignment. </dl> </div> +<div class="vocab"> +<h3>Class: <a name="Transformation">Transformation</a></h3> +<dl> +<dt>URI</dt><dd><a href="#Transformation">http://ns.inria.org/edoal/1.1/#Transformation</a></dd> +<!--dt>superclasses</dt><dd><a href="#Value">Value</a></dd--> +<dt>properties</dt><dd><a href="#direction">direction</a>, <a href="#entity1">entity1</a>, <a href="#entity2">entity2</a> + (value restricted to <a href="#Value">Value</a>)</dd> +<dt>see also</dt><dd><a href="#ssec:transf">Transformation section</a></dd> +</dl> +</div> + +<div class="vocab"> +<h3>Property: <a name="direction">direction</a></h3> +<p>The orientation of a transformation.</p> +<dl> +<dt>URI</dt><dd><a href="#direction">http://ns.inria.org/edoal/1.0/#direction</a></dd> +<dt>domain</dt><dd><a href="#Transformation">Transformation</a></dd> +<dt>range</dt><dd>String: o-, -o or oo</dd> +<dt>see also</dt><dd><a href="#ssec:transf">Transformation section</a></dd> +</dl> +</div> + +<div class="vocab"> +<h3>Relation: <a name="entity1">entity1</a>, <a name="entity2">entity2</a></h3> +<p>Not to be confounded with align:entityX, this is edoal:entityX.</p> +<dl> +<dt>URI</dt><dd><a href="#entity1">http://ns.inria.org/edoal/1.0/#entity1</a>, <a href="#entity2">http://ns.inria.org/edoal/1.0/#entity2</a></dd> +<dt>domain</dt><dd><a href="#Transformation">Transformation</a></dd> +<dt>range</dt><dd><a href="#Value">Value</a></dd> +<dt>see also</dt><dd><a href="#ssec:transf">Transformation section</a></dd> +</dl> +</div> + <div class="vocab"> <h3>Class: <a name="Linkkey">Linkkey</a></h3> <dl> @@ -1637,19 +1682,9 @@ the EDOAL API requires complete knowledge of the alignment. </div> <div class="vocab"> -<h3>Relation: <a name="property1">property1</a></h3> -<dl> -<dt>URI</dt><dd><a href="#property1">http://ns.inria.org/edoal/1.0/#property1</a></dd> -<dt>domain</dt><dd><a href="#Equals">Equals</a>, <a href="#Intersects">Intersects</a></dd> -<dt>range</dt><dd><a href="#Attribute">Attribute</a></dd> -<dt>see also</dt><dd><a href="#ssec:linkkeys">Linkkey section</a></dd> -</dl> -</div> - -<div class="vocab"> -<h3>Relation: <a name="property2">property2</a></h3> +<h3>Relation: <a name="property1">property1</a>, <a name="property2">property2</a></h3> <dl> -<dt>URI</dt><dd><a href="#property2">http://ns.inria.org/edoal/1.0/#property2</a></dd> +<dt>URI</dt><dd><a href="#property1">http://ns.inria.org/edoal/1.0/#property1</a>, <a href="#property2">http://ns.inria.org/edoal/1.0/#property2</a></dd> <dt>domain</dt><dd><a href="#Equals">Equals</a>, <a href="#Intersects">Intersects</a></dd> <dt>range</dt><dd><a href="#Attribute">Attribute</a></dd> <dt>see also</dt><dd><a href="#ssec:linkkeys">Linkkey section</a></dd> @@ -1664,7 +1699,7 @@ the EDOAL API requires complete knowledge of the alignment. </div> <div class="vocab"> -<h3>Class: <a name="Operator">Operator</a></h3> +<h3><b>Deprecated</b> Class: <a name="Operator">Operator</a></h3> <dl> <dt>URI</dt><dd><a href="#Operator">http://ns.inria.org/edoal/1.0/#Operator</a></dd> </dl> @@ -1673,9 +1708,7 @@ the EDOAL API requires complete knowledge of the alignment. <p> Not yet declared: <div class="vocab"> -Transformation -TransfService implements <i>Clonable</i> -<a href="sec:patterns">Variable</a> +<a href="#sec:patterns">Variable</a> </pre></div> </p> @@ -1692,7 +1725,7 @@ Jérôme Euzenat and Antoine Zimmermann in <a href="ftp://ftp.inrialpes.fr/pub/exmo/reports/kweb-2210.pdf">Knowledge web deliverable 2.2.10</a>, in particular through the semantics of the language. Its implementation was also reengineered as an extension -of the <a href="format.html">alignment format</a> so that it could be +of the <a href="format.html">Alignment format</a> so that it could be manipulated through the Alignment API tools (starting version 3.1). </p> <p> diff --git a/html/relnotes.html b/html/relnotes.html index 5a5a512b..f122f639 100644 --- a/html/relnotes.html +++ b/html/relnotes.html @@ -58,9 +58,9 @@ with a warning: --> <!--h2>Version 4.9 (2xxx): ??/??/201X - Letraset</h2--> -<!--h2>Version 4.8 (2080): ??/10/2015 - Antésine</h2--> +<!--h2>Version 4.8 (2090): ??/11/2015 - Antésine</h2--> -<p>The Alignment API is now compiled in Java 1.8.</p> +<p>The Alignment API is now compiled in Java 1.8 (please provide feedback if you need it for 1.7).</p> <p><ul compact="1"> <li>Fixed a bug in pool aggregation (impl)</li> @@ -76,6 +76,7 @@ with a warning: <li>Added alignment <tt>#version</tt> standard extension (format)</li> <li>Added banner option to server (server)</li> <li>Added <tt>BasicConfidence</tt> class (impl)</li> +<li>Added <tt>Aggregate</tt> transformation to EDOAL (edoal)</li> <li>Added normalisation to <tt>BasicAlignment</tt> algebraic operators (impl)</li> <li>Introduced and fully implemented <tt>DisjunctiveRelation</tt> and <tt>AlgebraRelation</tt> allowing for using algebras of diff --git a/src/fr/inrialpes/exmo/align/impl/edoal/EDOALVisitor.java b/src/fr/inrialpes/exmo/align/impl/edoal/EDOALVisitor.java index 1fbf1cf9..20717a80 100644 --- a/src/fr/inrialpes/exmo/align/impl/edoal/EDOALVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/edoal/EDOALVisitor.java @@ -44,6 +44,7 @@ public interface EDOALVisitor { public void visit( Transformation o ) throws AlignmentException; public void visit( Value o ) throws AlignmentException; public void visit( Apply o ) throws AlignmentException; + public void visit( Aggregate o ) throws AlignmentException; public void visit( Datatype o ) throws AlignmentException; public void visit( Linkkey o ) throws AlignmentException; public void visit( LinkkeyEquals o ) throws AlignmentException; diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java index ad2bcf23..b476a5bf 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/GraphPatternRendererVisitor.java @@ -41,6 +41,7 @@ import org.semanticweb.owl.align.Cell; import fr.inrialpes.exmo.align.impl.edoal.Expression; import fr.inrialpes.exmo.align.impl.edoal.Apply; +import fr.inrialpes.exmo.align.impl.edoal.Aggregate; import fr.inrialpes.exmo.align.impl.edoal.ClassConstruction; import fr.inrialpes.exmo.align.impl.edoal.ClassDomainRestriction; import fr.inrialpes.exmo.align.impl.edoal.ClassExpression; @@ -815,6 +816,9 @@ public abstract class GraphPatternRendererVisitor extends IndentedRendererVisito public void visit(final Apply e) throws AlignmentException { } + public void visit(final Aggregate e) throws AlignmentException { + } + public void visit(final Transformation transf) throws AlignmentException { } diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/JSONRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/JSONRendererVisitor.java index 78fd41d8..c3067b0f 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/JSONRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/JSONRendererVisitor.java @@ -70,6 +70,7 @@ import fr.inrialpes.exmo.align.impl.edoal.Transformation; import fr.inrialpes.exmo.align.impl.edoal.ValueExpression; import fr.inrialpes.exmo.align.impl.edoal.Value; import fr.inrialpes.exmo.align.impl.edoal.Apply; +import fr.inrialpes.exmo.align.impl.edoal.Aggregate; import fr.inrialpes.exmo.align.impl.edoal.Datatype; import fr.inrialpes.exmo.align.impl.edoal.EDOALCell; import fr.inrialpes.exmo.align.impl.edoal.EDOALVisitor; @@ -700,6 +701,28 @@ public class JSONRendererVisitor extends IndentedRendererVisitor implements Alig indentedOutput("}"); } + public void visit(final Aggregate e) throws AlignmentException { + indentedOutputln("{ \"@type\" : \"" + SyntaxElement.AGGREGATE.print(DEF) + "\","); + increaseIndent(); + indentedOutputln("\"" + SyntaxElement.OPERATOR.print(DEF) + "\" : \"" + e.getOperation() + "\","); + indentedOutputln("\"" + SyntaxElement.ARGUMENTS.print(DEF) + "\" : ["); + increaseIndent(); + boolean first = true; + for (final ValueExpression ve : e.getArguments()) { + if (first) { + first = false; + } else { + outputln(","); + } + ve.accept(this); + } + outputln(); + decreaseIndent(); + indentedOutputln("]"); + decreaseIndent(); + indentedOutput("}"); + } + public void visit(final Transformation transf) throws AlignmentException { indentedOutputln("{ \"@type\" : \"" + SyntaxElement.TRANSF.print(DEF) + "\","); increaseIndent(); diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java index 9f40c7f2..71d29fd3 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/OWLAxiomsRendererVisitor.java @@ -72,6 +72,7 @@ import fr.inrialpes.exmo.align.impl.edoal.Transformation; import fr.inrialpes.exmo.align.impl.edoal.ValueExpression; import fr.inrialpes.exmo.align.impl.edoal.Value; import fr.inrialpes.exmo.align.impl.edoal.Apply; +import fr.inrialpes.exmo.align.impl.edoal.Aggregate; import fr.inrialpes.exmo.align.impl.edoal.Datatype; import fr.inrialpes.exmo.align.impl.edoal.Comparator; import fr.inrialpes.exmo.align.impl.edoal.EDOALCell; @@ -825,6 +826,10 @@ public class OWLAxiomsRendererVisitor extends IndentedRendererVisitor implements throw new AlignmentException( "Cannot render function call in OWL "+e ); } + public void visit( final Aggregate e ) throws AlignmentException { + throw new AlignmentException( "Cannot render value aggregation in OWL "+e ); + } + // Not implemented. We only ignore transformations in OWL public void visit( final Transformation transf ) throws AlignmentException { logger.debug( "Transformations ignored in OWL" ); diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java index 0e2590ef..d7be0802 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java @@ -73,6 +73,7 @@ import fr.inrialpes.exmo.align.impl.edoal.Transformation; import fr.inrialpes.exmo.align.impl.edoal.ValueExpression; import fr.inrialpes.exmo.align.impl.edoal.Value; import fr.inrialpes.exmo.align.impl.edoal.Apply; +import fr.inrialpes.exmo.align.impl.edoal.Aggregate; import fr.inrialpes.exmo.align.impl.edoal.Datatype; import fr.inrialpes.exmo.align.impl.edoal.EDOALCell; import fr.inrialpes.exmo.align.impl.edoal.EDOALVisitor; @@ -720,6 +721,22 @@ public class RDFRendererVisitor extends IndentedRendererVisitor implements Align indentedOutput("</" + SyntaxElement.APPLY.print(DEF) + ">"); } + public void visit(final Aggregate e) throws AlignmentException { + indentedOutputln("<" + SyntaxElement.AGGREGATE.print(DEF) + " " + SyntaxElement.OPERATOR.print(DEF) + "=\"" + e.getOperation() + "\">"); + increaseIndent(); + indentedOutputln("<" + SyntaxElement.ARGUMENTS.print(DEF) + " " + SyntaxElement.RDF_PARSETYPE.print(DEF) + "=\"Collection\">"); + increaseIndent(); + for (final ValueExpression ve : e.getArguments()) { + output(linePrefix); + ve.accept(this); + outputln(); + } + decreaseIndent(); + indentedOutputln("</" + SyntaxElement.ARGUMENTS.print(DEF) + ">"); + decreaseIndent(); + indentedOutput("</" + SyntaxElement.AGGREGATE.print(DEF) + ">"); + } + public void visit(final Transformation transf) throws AlignmentException { indentedOutputln("<" + SyntaxElement.TRANSF.print(DEF) + " " + SyntaxElement.TRDIR.print(DEF) + "=\"" + transf.getType() + "\">"); increaseIndent(); diff --git a/src/fr/inrialpes/exmo/align/parser/RDFParser.java b/src/fr/inrialpes/exmo/align/parser/RDFParser.java index 8e9faaab..fffcd25b 100644 --- a/src/fr/inrialpes/exmo/align/parser/RDFParser.java +++ b/src/fr/inrialpes/exmo/align/parser/RDFParser.java @@ -67,6 +67,7 @@ import fr.inrialpes.exmo.align.impl.edoal.Transformation; import fr.inrialpes.exmo.align.impl.edoal.ValueExpression; import fr.inrialpes.exmo.align.impl.edoal.Value; import fr.inrialpes.exmo.align.impl.edoal.Apply; +import fr.inrialpes.exmo.align.impl.edoal.Aggregate; import fr.inrialpes.exmo.align.impl.edoal.Datatype; import fr.inrialpes.exmo.align.impl.edoal.Comparator; import fr.inrialpes.exmo.align.impl.edoal.Variable; @@ -1030,6 +1031,30 @@ public class RDFParser { } } return new Apply(op, valexpr); + } else if (nodeType.equals(SyntaxElement.AGGREGATE.resource)) { + // Get the operation + URI op; + if (((Resource) node).hasProperty((Property) SyntaxElement.OPERATOR.resource)) { + String operation = ((Resource) node).getProperty((Property) SyntaxElement.OPERATOR.resource).getLiteral().getString(); + try { + op = new URI(operation); + } catch (URISyntaxException e) { + throw new AlignmentException("edoal:Aggregate incorrect operation URI : " + operation); + } + } else { + throw new AlignmentException("edoal:Aggregate requires an operation"); + } + // Get all arguments + List<ValueExpression> valexpr = new LinkedList<ValueExpression>(); + if (((Resource) node).hasProperty((Property) SyntaxElement.ARGUMENTS.resource)) { + Statement stmt = ((Resource) node).getProperty((Property) SyntaxElement.ARGUMENTS.resource); + Resource coll = stmt.getResource(); // MUSTCHECK + while (!RDF.nil.getURI().equals(coll.getURI())) { + valexpr.add(parseValue(coll.getProperty(RDF.first).getResource())); + coll = coll.getProperty(RDF.rest).getResource(); + } + } + return new Aggregate(op, valexpr); } else { // Check that pe is a Path?? return parsePathExpression((Resource) node); } diff --git a/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java b/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java index 507b8a8f..da5a0640 100644 --- a/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java +++ b/src/fr/inrialpes/exmo/align/parser/SyntaxElement.java @@ -85,6 +85,7 @@ public enum SyntaxElement { // EDOAL NAMESPACE AND(Namespace.EDOAL, "and", Constructor.AND), APPLY(Namespace.EDOAL, "Apply", true), + AGGREGATE(Namespace.EDOAL, "Aggregate", true), ARGUMENTS(Namespace.EDOAL, "arguments"), ATTR_TRANSF(Namespace.EDOAL, "transf"), CLASS_EXPR(Namespace.EDOAL, "Class", true),//ALIGNMENT -- GitLab