diff --git a/html/lib.html b/html/lib.html index c85a5c14152bc9622b2902b9f999b062be7a88c8..c563ea19684a82226df6746d996b96a280d1cdce 100644 --- a/html/lib.html +++ b/html/lib.html @@ -11,9 +11,10 @@ <p>The Alignment API uses a number of external libraries. These libraries are shipped (in the lib directory) with the Alignment API. Each -subdirectory of the lib directory contains version.txt and license.txt -files which indicates what version are embedded and what are its -conditions of use. +subdirectory of the lib directory + contains <a href="http://maven.apache.org/pom.html">Project Object + Models (POM)</a> which provide information about the version, + license and dependencies for these libraries. </p> <p> We provide here the list of these libraries together with the @@ -38,7 +39,7 @@ Here is a picture of the various dependencies involved: <dl> <dt><a href="http://www.urbanophile.com/arenn/hacking/download.html">Gnu getopt</a> 1.0.13: getopt.jar - [<a href="http://www.opensource.org/licenses/bsd-license.php">BSD</a>/<a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GPL</a>]</dt> + [<a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">LGPL</a>]</dt> <dd>Gnu library for parsing command line arguments. Required everywhere (included by OWL-API).</dd> <dt><a href="http://logging.apache.org/log4j">Apache Log4J</a> 1.2.15 @@ -46,7 +47,7 @@ Here is a picture of the various dependencies involved: Commons Logging</a> 1.1.1: log4j.jar commons-logging.jar [<a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache</a>] - slf4j-api.jar (1.5.6) slf4j-log4j.jar [<a href="http://www.slf4j.org/license.html">MIT license</a>] + slf4j-api.jar (1.5.6) slf4j-log4j.jar [<a href="http://www.slf4j.org/license.html">MIT license</a>??] </dt> <dd>Required by OWL-API, jwnl, Jena for the last two ones... if someone could clear the mess with loggers in Java, you are welcome!</dd> @@ -131,8 +132,7 @@ and this will compile again. <dd>This also requires MySQL to be installed. Required for alignsvc.</dd> <dt><a href="http://jetty.mortbay.org/">Jetty</a> 6.1.2rc5: jetty.jar jetty-util.jar [<a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache</a>]</dt> -<dd>This also requires MySQL to be installed. Required for HTML and - web service part.</dd> +<dd>Required for HTML and web service part.</dd> <dt><a href="http://jetty.mortbay.org/">Servlet API</a> 2.5: servlet-api.jar [<a href="https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewLicense-Start">Sun Binary Code License</a>]</dt> diff --git a/html/relnotes.html b/html/relnotes.html index f361ca7489078f7dab8227c20de3137612f5b4ac..064f225303a79ff1d632d08dcd53a1c34b90801f 100644 --- a/html/relnotes.html +++ b/html/relnotes.html @@ -78,6 +78,7 @@ with a warning: <span style="color: green">Xerces 2.10</span>, <span style="color: green">log4j 1.2.16</span>, <span style="color: green">slf4j 1.6.4</span> (lib)</li--> +<li>Added <tt>corresp</tt> primitive (server)</li> <li>Added <tt>EDOALAlignment.toEDOALAlignment()</tt> (edoal)</li> <li>Simplified <tt>TestGen</tt> options (cli)</li> <li>Fixed server initialisation error with new log4j (server)</li> diff --git a/html/rest.html b/html/rest.html index 211fa64ee22a0ab6c2b8704e96f8406cc58d3918..8c724a42a53dcf5dd60cc1fc5ea9a58a7fb9b350 100644 --- a/html/rest.html +++ b/html/rest.html @@ -7,9 +7,9 @@ </head> <body bgcolor="#ffffff"> -<h1 style="text-align: center;">Web service interface for the Alignment server</h1> +<h1>Web service interface for the Alignment server</h1> -<h1>REST interface</h1> +<h2>REST interface</h2> <p> The Alignment server provides a REST interface for accessing the functions available on the server. Each request is an URL starting @@ -31,7 +31,7 @@ The <tt>msgid</tt> and <tt>in-reply-to</tt> elements are not compulsory and may not be present in messages. </p> -<h2>listalignments<a name="listalignments"></a></h2> +<h3>listalignments<a name="listalignments"></a></h3> <p>Gets the list of the alignments available on the server.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>listalignments</b> ?</p> @@ -48,7 +48,7 @@ compulsory and may not be present in messages. </div> </p> -<h2>listmethods<a name="listmethods"></a></h2> +<h3>listmethods<a name="listmethods"></a></h3> <p>Gets the list of matching methods available on the server.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>listmethods</b> ?</p> <p>Parameters: none</p> @@ -64,7 +64,7 @@ compulsory and may not be present in messages. </div> </p> -<h2>listrenderers<a name="listrenderers"></a></h2> +<h3>listrenderers<a name="listrenderers"></a></h3> <p>Gets the list of renderer methods available on the server.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>listrenderers</b> ?</p> <p>Parameters: none</p> @@ -80,7 +80,7 @@ compulsory and may not be present in messages. </div> </p> -<h2>listservices<a name="listservices"></a></h2> +<h3>listservices<a name="listservices"></a></h3> <p>Gets the list of communication services available (and running) on the server.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>listservices</b> ?</p> <p>Parameters: none</p> @@ -96,7 +96,7 @@ compulsory and may not be present in messages. </div> </p> -<h2>listevaluators<a name="listevaluators"></a></h2> +<h3>listevaluators<a name="listevaluators"></a></h3> <p>Gets the list of evauators available on the server.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>listevaluators</b> ?</p> <p>Parameters: none</p> @@ -112,7 +112,7 @@ compulsory and may not be present in messages. </div> </p> -<h2>match<a name="match"></a></h2> +<h3>match<a name="match"></a></h3> <p>Matches two ontologies.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>match</b> ? <b>onto1</b> = <URI> & <b>onto2</b> = <URI> & method = @@ -147,7 +147,7 @@ and value of parameter <i>n</i>. </div> </p> -<h2>find<a name="find"></a></h2> +<h3>find<a name="find"></a></h3> <p>Finds alignments related to one or two ontologies.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>find</b> ? <b>onto1</b> = <URI> & <b>onto2</b> = <URI></p> @@ -168,7 +168,30 @@ and value of parameter <i>n</i>. </div> <p> -<h2>retrieve<a name="retrieve"></a></h2> +<h3>corresp<a name="corresp"></a></h3> +<p>Finds the concepts corresponding to a concept in a particular alignment.</p> +<p>URL: http://aserv.inrialpes.fr/rest/ <b>corresp</b> ? <b>id</b> + = <URI> & <b>entity</b> = <URI> & strict = <boolean></p> +<p>Parameters:<br /> + <b>id</b> the URI of the alignment,<br /> + <b>entity</b> the URI of of the entity, and<br /> + <b>strict</b> a boolean (default: false) indicating (if present) that only equivalent entities are retrieved. +</p> + +<p>Result:<br /> +<div class="xml"> +<correspResponse> + <msgid> MessageId </msgid> + <in-reply-to> messageId </in-reply-to> + <entityList> + <entity> URI </entity> + ... + </entityList> +</correspResponse> +</div> +<p> + +<h3>retrieve<a name="retrieve"></a></h3> <p>Retrieves an alignment in a specific format.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>retrieve</b> ? <b>id</b> = <URI> & <b>method</b> = <classname></p> @@ -188,7 +211,7 @@ and value of parameter <i>n</i>. </div> </p> -<h2>trim<a name="trim"></a></h2> +<h3>trim<a name="trim"></a></h3> <p>Trims an alignment with a threshhold.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>trim</b> ? <b>id</b> = <URI> & <b>threshold</b> = <float> & type = <label> </p> @@ -208,7 +231,7 @@ span, prop; default: hard). </div> </p> -<h2>invert<a name="invert"></a></h2> +<h3>invert<a name="invert"></a></h3> <p>Inverts an alignment.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>invert</b> ? <b>id</b> = <URI> </p> @@ -225,7 +248,7 @@ span, prop; default: hard). </div> </p> -<h2>store<a name="store"></a></h2> +<h3>store<a name="store"></a></h3> <p>Stores an alignment on the server.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>store</b> ? <b>id</b> = <URI></p> <p>Parameters: @@ -241,7 +264,7 @@ span, prop; default: hard). </div> </p> -<h2>load<a name="load"></a></h2> +<h3>load<a name="load"></a></h3> <p>Uploads an alignment to the server.</p> <p> This function can work in two ways: either with a url parameter @@ -265,13 +288,13 @@ or </div> </p> -<h1>Unsupported features</h1> +<h2>Unsupported features</h2> <p>These features may have been implemented and may become standard at some point. For the moment, they are not. </p> -<h2>metadata<a name="metadata"></a></h2> +<h3>metadata<a name="metadata"></a></h3> <p>Gets metadata of an alignment, i.e., avoid downloading all correspondences.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>metadata</b> ? <b>id</b> = <URI></p> <p>Parameters: @@ -286,7 +309,7 @@ or </div> </p> -<h2>translate<a name="translate"></a></h2> +<h3>translate<a name="translate"></a></h3> <p>Translates a message (resp. a query) with regard to an alignment.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>translate</b> ? <b>id</b> = <URI></p> <p>Parameters: @@ -301,7 +324,7 @@ or </div> </p> -<h2>align<a name="align"></a></h2> +<h3>align<a name="align"></a></h3> <p>Matches two ontologies and directly returns the RDF rendering of the result.</p> <p>URL: http://aserv.inrialpes.fr/rest/ <b>align</b> ? </p> <p>Parameters: @@ -318,7 +341,7 @@ to be matched. </div> </p> -<h1>Note about the SOAP interface</h1> +<h2>Note about the SOAP interface</h2> <p> As of version 4.0 of the Alignment API, the SOAP and REST interface @@ -350,7 +373,7 @@ and answers: </div> </p> -<h2>wsdl<a name="wsdl"></a></h2> +<h3>wsdl<a name="wsdl"></a></h3> <p>Gets the Web Service Description Language description of the SOAP interface.</p> <p>URL: <a href="http://aserv.inrialpes.fr/wsdl?">http://aserv.inrialpes.fr/ <b>wsdl</b> ?</a> </p> @@ -358,7 +381,7 @@ and answers: <p>Result: WSDL file in XML </p> -<h1>Changes introduced in version 4<a name="version4"></a></h1> +<h2>Changes introduced in version 4<a name="version4"></a></h2> <ul> <li>The content of <tt>classList</tt> is now <tt>classname</tt> diff --git a/html/server.html b/html/server.html index 7b4ffff80a3574f292187a6f2a157694d1742958..3a24b086796dd1f8bb26f3d63a85651e4aa9bdd5 100644 --- a/html/server.html +++ b/html/server.html @@ -144,6 +144,11 @@ These tasks are summarised in the following table: Most of these services correspond to what is provided by any implementation of the Alignment API. The main principle of the Alignment API is that it can always be extended. In particular, it is possible to add new matching algorithms and mediator generators that will be accessible through the API. They will also be accessible through the Alignment servers. They can thus be extended to new needs without breaking the infrastructure. </p> +<p> +A detailed presentation of how to access these functions is available +for <a href="tutorial/tutorial1/server.html">HTML</a> +and <a href="rest.html">REST and SOAP</a>. +</p> <h2>Writing a protocol plug-in</h2> @@ -178,7 +183,8 @@ Message |- Success | |- AlignmentId -> alignment id | |- AlignmentIds -> alignment ids -| |- OntologyURI -> Ontology URI +| |- EntityList -> entity URIs +| |- OntologyURI -> ontology URI | |- TranslatedMessage -> translated message | |- RenderedAlignment -> rendering | |- AlignmentMetadata -> metadata diff --git a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java index 3d0dc4e2d47e217d2f66603eb9e84c8577c61480..8fb8d8873952104db3d4301720e9a2ffdeb5a797 100644 --- a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java +++ b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java @@ -28,10 +28,13 @@ import fr.inrialpes.exmo.align.impl.BasicAlignment; import fr.inrialpes.exmo.align.impl.URIAlignment; import fr.inrialpes.exmo.align.impl.ObjectAlignment; import fr.inrialpes.exmo.align.impl.eval.DiffEvaluator; +import fr.inrialpes.exmo.align.impl.rel.EquivRelation; + import fr.inrialpes.exmo.align.service.msg.Message; import fr.inrialpes.exmo.align.service.msg.AlignmentId; import fr.inrialpes.exmo.align.service.msg.AlignmentIds; import fr.inrialpes.exmo.align.service.msg.AlignmentMetadata; +import fr.inrialpes.exmo.align.service.msg.EntityList; import fr.inrialpes.exmo.align.service.msg.EvalResult; import fr.inrialpes.exmo.align.service.msg.OntologyURI; import fr.inrialpes.exmo.align.service.msg.RenderedAlignment; @@ -49,6 +52,7 @@ import fr.inrialpes.exmo.ontowrap.Ontology; import fr.inrialpes.exmo.ontowrap.LoadedOntology; import org.semanticweb.owl.align.Alignment; +import org.semanticweb.owl.align.Cell; import org.semanticweb.owl.align.AlignmentProcess; import org.semanticweb.owl.align.AlignmentVisitor; import org.semanticweb.owl.align.AlignmentException; @@ -337,15 +341,45 @@ public class AServProtocolManager { return new AlignmentIds(newId(),mess,myId,mess.getSender(),msg,(Properties)null,prettys); } + public Message findCorrespondences( Message mess ) { + Properties params = mess.getParameters(); + // Retrieve the alignment + Alignment al = null; + String id = params.getProperty("id"); + try { + al = alignmentCache.getAlignment( id ); + } catch (Exception e) { + return new UnknownAlignment(newId(),mess,myId,mess.getSender(),id,(Properties)null); + } + // Find matched + URI uri = null; + try { + uri = new URI( params.getProperty("entity") ); + } catch (Exception e) { + return new ErrorMsg(newId(),mess,myId,mess.getSender(),"MalformedURI problem",(Properties)null); + }; + // Retrieve correspondences + String msg = ""; + boolean strict = (params.getProperty("strict")!=null); + try { + for ( Cell c : al.getAlignCells1( uri ) ) { + if ( !strict || c.getRelation() instanceof EquivRelation ) { + msg += c.getObject2AsURI( al )+" "; + } + } + } catch ( AlignmentException alex ) { // should never happen + return new ErrorMsg(newId(),mess,myId,mess.getSender(),"Unexpected Alignment API Error",(Properties)null); + } + return new EntityList( newId(), mess, myId, mess.getSender(), msg, (Properties)null ); + } + // ABSOLUTELY NOT IMPLEMENTED // But look at existingAlignments // Implements: find // This may be useful when calling WATSON public Message find(Message mess){ - //\prul{search-success}{a - request ( find (O, T) ) \rightarrow S}{O' \Leftarrow Match(O,T)\\S - inform (O') \rightarrow a}{reachable(O)\wedge Match(O,T)\not=\emptyset} - + //\prul{search-success}{a --request ( find (O, T) )--> S}{O' <= Match(O,T); S --inform (O')--> a}{reachable(O) & Match(O,T)!=null} //\prul{search-void}{a - request ( find (O, T) ) \rightarrow S}{S - failure (nomatch) \rightarrow a}{reachable(O)\wedge Match(O,T)=\emptyset} - //\prul{search-unreachable}{a - request ( find (O, T) ) \rightarrow S}{S - failure ( unreachable (O) ) \rightarrow a}{\neg reachable(O)} return new OntologyURI(newId(),mess,myId,mess.getSender(),"dummy//",(Properties)null); } diff --git a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java index 830ab77cb33e65e9edb479352093175ac3bcf0d8..680082c1eeafd8702eeeaa6ff33fc6f484dc3449 100644 --- a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java +++ b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java @@ -641,6 +641,14 @@ public class HTMLAServProfile implements AlignmentServiceProfile { msg = "<h1>Found alignments</h1>"; msg += displayAnswer( answer, params ); } + } else if ( perf.equals("corresp") ) { + Message answer = manager.findCorrespondences( new Message(newId(),(Message)null,myId,serverId,"", params) ); + if ( answer instanceof ErrorMsg ) { + msg = testErrorMessages( answer, params ); + } else { + msg = "<h1>Found correspondences</h1>"; + msg += displayAnswer( answer, params ); + } } else if ( perf.equals("prmretrieve") ) { String sel = params.getProperty("id"); msg = "<h1>Retrieve alignment</h1><form action=\"retrieve\">"; @@ -670,7 +678,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile { // This should be returned in answer.getParameters() return new Response( HTTP_OK, MIME_HTML, answer.getContent() ); } - // Metadata not done yet + // Metadata not done yet } else if ( perf.equals("prmmetadata") ) { msg = "<h1>Retrieve alignment metadata</h1><form action=\"metadata\">"; msg += "Alignment id: <select name=\"id\">"; @@ -738,27 +746,6 @@ public class HTMLAServProfile implements AlignmentServiceProfile { msg += answer.HTMLString().replaceAll("&", "&").replaceAll("<", "<"); msg += "</pre>"; } - } else if ( perf.equals("prmmetadata") ) { - msg = "<h1>Retrieve alignment metadata</h1><form action=\"metadata\">"; - msg += "Alignment id: <select name=\"id\">"; - for( Alignment al: manager.alignments() ){ - String id = al.getExtension( Namespace.ALIGNMENT.uri, Annotations.ID); - String pid = al.getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ); - if ( pid == null ) pid = id; else pid = id+" ("+pid+")"; - msg += "<option value=\""+id+"\">"+pid+"</option>"; - } - msg += "</select><br /><input type=\"submit\" value=\"Get metadata\"/></form>"; - } else if ( perf.equals("metadata") ) { - Message answer = manager.render( new Message(newId(),(Message)null,myId,serverId,"", params) ); - //System.err.println("Content: "+answer.getContent()); - if ( answer instanceof ErrorMsg ) { - msg = testErrorMessages( answer, params ); - } else { - // Depending on the type we should change the MIME type - return new Response( HTTP_OK, MIME_HTML, answer.getContent() ); - } - // render - // Alignment in HTML can be rendre or metadata+tuples } else if ( perf.equals("prmeval") ) { msg ="<h1>Evaluate alignment</h1><form action=\"eval\">"; msg += "Alignment to evaluate: "; diff --git a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java index 7fd025ef409545f4ca99a4a28f8db2273e2aa951..c4defc18fbe2f45538219cb82a3e1b133c4f3713 100644 --- a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java +++ b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2007-2011 + * Copyright (C) INRIA, 2007-2012 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -330,6 +330,15 @@ public class WSAServProfile implements AlignmentServiceProfile { msg += " <result>\n" + answer.getContent() + " </result>\n"; } msg += " </alignResponse>\n"; + } else if ( method.equals("correspRequest") || method.equals("corresp") ) { // URI * URI * boolean * (newparameters) -> URI* + if ( newparameters.getProperty( "id" ) == null ) { + answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); + } else if ( newparameters.getProperty( "entity" ) == null ) { + answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); + } else { + answer = manager.findCorrespondences( new Message(newId(),(Message)null,myId,serverURL,"", newparameters) ); + } + msg += " <correspResponse"+svcNS+">\n"+answer.SOAPString()+"</correspResponse>\n"; } else if ( method.equals("findRequest") || method.equals("find") ) { // URI * URI -> List of URI if ( newparameters.getProperty( "onto1" ) == null && newparameters.getProperty( "onto2" ) == null ) { answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); diff --git a/src/fr/inrialpes/exmo/align/service/aserv.wsdl b/src/fr/inrialpes/exmo/align/service/aserv.wsdl index 92f07e47a929ceed2d2c4902c1a75b2e972255b9..e104de12f02aa3075472d81e1aac28355d806229 100644 --- a/src/fr/inrialpes/exmo/align/service/aserv.wsdl +++ b/src/fr/inrialpes/exmo/align/service/aserv.wsdl @@ -21,6 +21,13 @@ </xsd:all> </xsd:complexType> </xsd:element> + <xsd:element name="entityList"> + <xsd:complexType> + <xsd:all> + <xsd:element name="entity" type="xsd:anyURI" minOccurs="0" maxOccurs="unbounded"/> + </xsd:all> + </xsd:complexType> + </xsd:element> <xsd:element name="classList"> <xsd:complexType> <xsd:all> <!-- classname as strings --> @@ -103,6 +110,16 @@ <wsdl:part name="metadata" type="xsd:string"/> </wsdl:message--> + <wsdl:message name="correspRequest"> + <wsdl:part name="id" type="xsd:anyURI"/> + <wsdl:part name="entity" type="xsd:anyURI"/> + <wsdl:part name="strict" type="xsd:boolean"/> + <wsdl:part name="param" type="param"/> <!-- minOccurs="0" maxOccurs="unbounded" ?--> + </wsdl:message> + <wsdl:message name="correspResponse"> + <wsdl:part name="entityList" type="entityList"/> + </wsdl:message> + <wsdl:message name="retrieveRequest"> <wsdl:part name="id" type="xsd:anyURI"/> <wsdl:part name="param" type="param"/> <!-- minOccurs="0" maxOccurs="unbounded" ?--> diff --git a/src/fr/inrialpes/exmo/align/service/msg/EntityList.java b/src/fr/inrialpes/exmo/align/service/msg/EntityList.java new file mode 100644 index 0000000000000000000000000000000000000000..cc349b7d232b1c2c7467d25b81cb4504006543af --- /dev/null +++ b/src/fr/inrialpes/exmo/align/service/msg/EntityList.java @@ -0,0 +1,66 @@ +/* + * $Id$ + * + * Copyright (C) INRIA, 2012 + * + * 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 the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package fr.inrialpes.exmo.align.service.msg; + +import java.util.Properties; + +/** + * A set of entities matching another entity + */ + +public class EntityList extends Success { + + String pretty = null; + + public EntityList( int surr, Message rep, String from, String to, String cont, Properties param ) { + super( surr, rep, from, to, cont, param ); + } + + public String HTMLString(){ + String id[] = content.split(" "); + String result = "No entity."; + + if ( id.length >= 1 ) { + result = "Entities: <ul>"; + for ( int i = id.length-1; i >= 0; i-- ){ + result += "<li>"+id[i]+"</a></li>"; + } + result += "</ul>"; + } + return result; + } + + public String HTMLRESTString(){ + return HTMLString(); + } + + public String RESTString(){ + String msg = "<entityList>\n"; + String id[] = content.split(" "); + for ( int i = id.length-1; i >= 0; i-- ){ + if ( id[i].trim() != "" ) { + msg += " <entity>"+id[i].trim()+"</entity>\n"; + } + } + msg += " </entityList>"; + return msg; + } +}