View Javadoc

1   /*
2    wsmo4j - a WSMO API and Reference Implementation
3   
4    Copyright (c) 2004-2005, OntoText Lab. / SIRMA
5   
6    This library is free software; you can redistribute it and/or modify it under
7    the terms of the GNU Lesser General Public License as published by the Free
8    Software Foundation; either version 2.1 of the License, or (at your option)
9    any later version.
10   This library is distributed in the hope that it will be useful, but WITHOUT
11   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13   details.
14   You should have received a copy of the GNU Lesser General Public License along
15   with this library; if not, write to the Free Software Foundation, Inc.,
16   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17   */
18  
19  /**
20   * <p>Title: WSMO4J</p>
21   * <p>Description: WSMO API and a Reference Implementation</p>
22   * <p>Copyright:  Copyright (c) 2004-2005</p>
23   * <p>Company: OntoText Lab. / SIRMA </p>
24   */
25  
26  package org.wsmo.wsml;
27  
28  
29  import java.io.IOException;
30  import java.io.Reader;
31  import java.util.List;
32  import java.util.Map;
33  import java.util.Set;
34  
35  import org.wsmo.common.TopEntity;
36  import org.wsmo.common.exception.InvalidModelException;
37  
38  
39  /**
40   *
41   * @author not attributable
42   * @version $Revision: 1946 $ $Date: 2007-04-02 15:13:28 +0300 (Mon, 02 Apr 2007) $
43   */
44  public interface Parser {
45      
46      public static final String CLEAR_MODEL = "clear_model_on_parse";
47      public static final String CACHE_LOGICALEXPRESSION_STRING = "cache_le_string";
48  
49      /**
50       * Parses the input data consisted of Ontology, Goal, Mediator or
51       * WebServices definitions.
52       * @param src The reader to read from
53       * @return a top level WSMO entity found in the input
54       * @throws java.io.IOException
55       * @throws org.wsmo.wsml.ParserException
56       * @throws org.wsmo.common.exception.InvalidModelException
57       */
58  
59      TopEntity[] parse(Reader src)
60              throws IOException, ParserException, InvalidModelException;
61  
62      /**
63       * Parses the input data consisted of Ontology, Goal, Mediator or
64       * WebServices definitions.
65       * @param src The reader to read from
66       * @param options an optional Map with user supplied options specific to this parse operation
67       * @return a top level WSMO entity found in the input
68       * @throws java.io.IOException
69       * @throws org.wsmo.wsml.ParserException
70       * @throws org.wsmo.common.exception.InvalidModelException
71       */
72  
73      TopEntity[] parse(Reader src, Map options)
74              throws IOException, ParserException, InvalidModelException;
75  
76      /**
77       * Parses the input data consisted of Ontology, Goal, Mediator or
78       * WebServices definitions.
79       * @param src The string buffer to read from
80       * @return top level WSMO entity found in the input
81       * @throws org.wsmo.wsml.ParserException
82       * @throws org.wsmo.common.exception.InvalidModelException
83       */
84  
85      TopEntity[] parse(StringBuffer src)
86              throws ParserException, InvalidModelException;
87  
88      /**
89       * Parses the input data consisted of Ontology, Goal, Mediator or
90       * WebServices definitions.
91       * @param src The string buffer to read from
92       * @param options an optional Map with user supplied options specific to this parse operation
93       * @return top level WSMO entity found in the input
94       * @throws org.wsmo.wsml.ParserException
95       * @throws org.wsmo.common.exception.InvalidModelException
96       */
97  
98      TopEntity[] parse(StringBuffer src, Map options)
99              throws ParserException, InvalidModelException;
100 
101     /**
102      * List known keywords.
103      * @return set of known keywords
104      */
105     Set <String> listKeywords();
106     
107     /**
108      * This method returns a List containing warnings that 
109      * occured during the parsing.
110      * 
111      * @return List of collected warnings
112      */
113     public List <Object> getWarnings();
114     
115     /**
116      * This method returns a List containing errors that occured during 
117      * the parsing.
118      * 
119      * @return List of collected errors
120      */
121     public List <Object> getErrors();
122 }
123 /*
124  * $Log$
125  * Revision 1.15  2007/04/02 12:13:15  morcen
126  * Generics support added to wsmo-api, wsmo4j and wsmo-test
127  *
128  * Revision 1.14  2006/11/17 15:20:49  holgerlausen
129  * added constant to the parser enabling to "cache" the formating of logical expressions.
130  *
131  * Revision 1.13  2006/11/10 11:08:54  nathaliest
132  * added getWarnings() and getErrors() methods to Parser interface, implemented them in the rdf parser implementation and added UnsupportedOperationException to the other parser implementations
133  *
134  * Revision 1.12  2006/04/11 16:06:59  holgerlausen
135  * addressed RFE 1468651 ( http://sourceforge.net/tracker/index.php?func=detail&aid=1468651&group_id=113501&atid=665349)
136  * currently the default behaviour of the parser is still as before
137  *
138  * Revision 1.11  2006/01/11 13:02:06  marin_dimitrov
139  * common constants moved to Factory
140  *
141  * Revision 1.10  2006/01/09 16:16:42  nathaliest
142  * deleted duplicate entry from wsmo4j.properties and renamed the parser_le_factory and the parser_wsmo_factory to le_factory and wsmo_factory.
143  *
144  * Revision 1.9  2005/12/09 11:26:54  vassil_momtchev
145  * listKeywords method added
146  *
147  * Revision 1.8  2005/09/16 12:31:13  marin_dimitrov
148  * DataFactory can now be created from the meta factory
149  *
150  * Revision 1.7  2005/07/19 13:52:17  vassil_momtchev
151  * more than one topentity allowed in the wsml files (again)
152  *
153  * Revision 1.6  2005/07/04 11:44:40  marin_dimitrov
154  * formatting?
155  *
156  * Revision 1.4  2005/06/30 13:34:45  marin_dimitrov
157  * javadoc
158  *
159  * Revision 1.3  2005/06/30 13:10:35  marin_dimitrov
160  * parse() now returns a SINGLE TopEntity (was: array of TEs)
161  *
162  * Revision 1.2  2005/06/30 09:52:53  marin_dimitrov
163  * Parser and Serialiser split
164  *
165  * Revision 1.1  2005/06/30 09:31:47  alex_simov
166  * refactoring: org.wsmo.parser -> org.wsmo.wsml.*
167  *
168  * Revision 1.1  2005/06/27 08:51:50  alex_simov
169  * refactoring: *.io.locator -> *.locator
170  * refactoring: *.io.parser -> *.parser
171  * refactoring: *.io.datastore -> *.datastore
172  *
173  * Revision 1.6  2005/06/22 15:00:46  marin_dimitrov
174  * note about Parser *not* closing the stream after write
175  *
176  * Revision 1.5  2005/06/22 14:40:49  alex_simov
177  * Copyright header added/updated
178  *
179  * Revision 1.4  2005/06/01 10:56:44  marin_dimitrov
180  * v0.4.0
181  *
182  * Revision 1.5  2005/05/19 08:10:20  marin
183  * oops
184  *
185  * Revision 1.4  2005/05/13 15:38:26  marin
186  * fixed javadoc errors
187  *
188  * Revision 1.3  2005/05/11 14:02:03  marin
189  * formatting
190  *
191  * Revision 1.2  2005/05/11 09:35:03  marin
192  * fixed imports + changed Identifiable to TopEntity
193  *
194  * Revision 1.1.1.1  2005/05/10 15:12:12  marin
195  * no message
196  *
197  * Revision 1.3  2005/02/04 11:37:40  alex_simov
198  * mistyping: 'tagret' -> 'target' in serialize()
199  *
200  * Revision 1.2  2004/12/11 11:15:43  marin_dimitrov
201  * formatting:
202  * 1. indent is 4 spaces
203  * 2. line break indent is 8 spaces
204  * 3. no tabs
205  *
206  * Revision 1.1  2004/11/30 13:21:22  marin_dimitrov
207  * parser stuff moved from org.wsmo.io --> org.wsmo.io.parser
208  *
209  * Revision 1.7  2004/11/26 11:26:10  marin_dimitrov
210  * Parser::parse now throws ParserException and InvalidModelException
211  *
212  * Revision 1.6  2004/11/09 10:59:49  damyan_rm
213  * fixed using Identifiable. see [ 1058788 ] Parser::parse() should return Entity
214  *
215  * Revision 1.5  2004/10/31 19:43:57  marin_dimitrov
216  * 1. fixed @author and @version tags
217  * 2. history log added at the end of file
218  *
219  */