/[cashew-s-editor]/cashews/src/nongnu/cashews/owls/expression/LogicLanguage.java
ViewVC logotype

Diff of /cashews/src/nongnu/cashews/owls/expression/LogicLanguage.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by gnu_andrew, Thu Mar 31 16:50:14 2005 UTC revision 1.2 by gnu_andrew, Thu Mar 31 18:03:25 2005 UTC
# Line 1  Line 1 
1  /* LogicLanguage.java -- Representation of an OWL-S logic language.  /* LogicLanguage.java -- Representation of an OWL-S logic language.
2     Copyright (C) 2005  The University of Sheffield.   Copyright (C) 2005  The University of Sheffield.
3    
4  This file is part of the CASheW-s editor.   This file is part of the CASheW-s editor.
5    
6  The CASheW-s editor is free software; you can redistribute it and/or modify   The CASheW-s editor is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by   it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)   the Free Software Foundation; either version 2, or (at your option)
9  any later version.   any later version.
10    
11  The CASheW-s editor is distributed in the hope that it will be useful, but   The CASheW-s editor is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of   WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  General Public License for more details.   General Public License for more details.
15    
16  You should have received a copy of the GNU General Public License   You should have received a copy of the GNU General Public License
17  along with The CASheW-s editor; see the file COPYING.  If not, write to the   along with The CASheW-s editor; see the file COPYING.  If not, write to the
18  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19  02111-1307 USA.   02111-1307 USA.
20  */  */
21    
22  package nongnu.cashews.owls.expression;  package nongnu.cashews.owls.expression;
# Line 27  import java.util.ArrayList; Line 27  import java.util.ArrayList;
27  import java.util.List;  import java.util.List;
28    
29  /**  /**
30   * This class represents a particular logical formalism, such   * This class represents a particular logical formalism, such as KIF, DRS or
31   * as KIF, DRS or SWRL.  At present, it simply allows for the specification   * SWRL. At present, it simply allows for the specification of zero or more
32   * of zero or more URIs, which point to the documentation for the   * URIs, which point to the documentation for the formalism.
33   * formalism.   *
  *  
34   * @author Andrew John Hughes (gnu_andrew@member.fsf.org)   * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
35   */   */
36  public class LogicLanguage  public class LogicLanguage
37  {  {
38    
39    /**    /**
40     * A representation of the logical formalism, SWRL,     * A representation of the logical formalism, SWRL, as defined by the W3C.
    * as defined by the W3C.  
41     */     */
42    public static final LogicLanguage SWRL = new SWRL();    public static final LogicLanguage SWRL = new SWRL();
43    
44    /**    /**
45     * A representation of the logical formalism, DRS,     * A representation of the logical formalism, DRS, as defined by the DAML
46     * as defined by the DAML team.     * team.
47     */     */
48    public static final LogicLanguage DRS = new DRS();    public static final LogicLanguage DRS = new DRS();
49    
50    /**    /**
51     * A representation of the logical formalism, KIF,     * A representation of the logical formalism, KIF, as defined by Stanford
52     * as defined by Stanford University.     * University.
53     */     */
54    public static final LogicLanguage KIF = new KIF();    public static final LogicLanguage KIF = new KIF();
55    
56    /**    /**
57     * A list of <code>URI</code>s which specify the location     * A list of <code>URI</code> s which specify the location of the
58     * of the documentation for this formalism.     * documentation for this formalism.
59     *     *
60     * @serial the URIs of this formalism's documentation.     * @serial the URIs of this formalism's documentation.
61     * @see java.net.URI     * @see java.net.URI
62     */     */
63    private List<URI> uris;    private List<URI> uris;
64    
65    /**    /**
66     * The default constructor for a <code>LogicLanguage</code>     * The default constructor for a <code>LogicLanguage</code> instance.
    * instance.  
67     */     */
68    public LogicLanguage()    public LogicLanguage()
69    {    {
# Line 74  public class LogicLanguage Line 71  public class LogicLanguage
71    }    }
72    
73    /**    /**
74     * Adds a <code>URI</code> to the list specifying the documentation     * Adds a <code>URI</code> to the list specifying the documentation for this
75     * for this formalism.     * formalism.
76     *     *
77     * @param uri the URI to add.     * @param uri the URI to add.
78     * @see java.net.URI     * @see java.net.URI
79     */     */
# Line 86  public class LogicLanguage Line 83  public class LogicLanguage
83    }    }
84    
85    /**    /**
86     * Returns the list of <code>URI</code>s for this logic     * Returns the list of <code>URI</code> s for this logic formalism.
87     * formalism.     *
88     *     * @return a cloned list of the <code>URI</code> s of this formalism.
    * @return a cloned list of the <code>URI</code>s of this formalism.  
89     */     */
90    public List<URI> getURIs()    public List<URI> getURIs()
91    {    {
92      List<URI> clonedURIs = new ArrayList<URI>();      List<URI> clonedURIs = new ArrayList<URI>();
93      for (URI uri : uris)      for (URI uri : uris)
94        {        {
95          try          try
96            {            {
97              URI newURI = new URI(uri.toString());              URI newURI = new URI(uri.toString());
98              clonedURIs.add(newURI);              clonedURIs.add(newURI);
99            }            }
100          catch (URISyntaxException e)          catch (URISyntaxException e)
101            {            {
102              throw new IllegalStateException("The list of URIs includes an "+              throw new IllegalStateException("The list of URIs includes "
103                                              "Âinvalid UR.", e);                                              + "an invalid URI.", e);
104            }            }
105        }        }
106      return clonedURIs;      return clonedURIs;
107    }    }
108      
109    /**    /**
110     * A specific subclass of <code>LogicLanguage</code>, which represents     * A specific subclass of <code>LogicLanguage</code>, which represents the
111     * the SWRL logic formalism.  Instances of this are not modifiable.     * SWRL logic formalism. Instances of this are not modifiable.
112     *     *
113     * @author Andrew John Hughes (gnu_andrew@member.fsf.org)     * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
114     * @see LogicLanguage     * @see LogicLanguage
115     */     */
116    private static final class SWRL    private static final class SWRL extends LogicLanguage
     extends LogicLanguage  
117    {    {
118    
119      /**      /**
# Line 129  public class LogicLanguage Line 124  public class LogicLanguage
124      }      }
125    
126      /**      /**
127       * This method always throws an exception in this subclass       * This method always throws an exception in this subclass in order to
128       * in order to prevent derivations of the SWRL formalism.       * prevent derivations of the SWRL formalism.
129       *       *
130       * @throws UnsupportedOperationException as the formalism       * @throws UnsupportedOperationException as the formalism can
131       *         can not be modified.       *         not be modified.
132       */       */
133      public void addURI(URI uri)      public void addURI(URI uri)
134      {      {
135        throw new UnsupportedOperationException("The SWRL logic language "+        throw new UnsupportedOperationException("The SWRL logic language "
136                                                "instance is not modifable.");                                                + "instance is not modifable.");
137      }      }
138    
139      /**      /**
140       * Returns the list of <code>URI</code>s for the SWRL logic       * Returns the list of <code>URI</code> s for the SWRL logic formalism.
141       * formalism.       *
      *  
142       * @return the SWRL <code>URI</code>s.       * @return the SWRL <code>URI</code>s.
143       */       */
144      public List<URI> getURIs()      public List<URI> getURIs()
145      {      {
146        List<URI> swrl = new ArrayList<URI>();        List<URI> swrl = new ArrayList<URI>();
147        try        try
148          {          {
149            swrl.add(new URI("http://www.w3.org/2003/11/swrl"));            swrl.add(new URI("http://www.w3.org/2003/11/swrl"));
150          }          }
151        catch (URISyntaxException e)        catch (URISyntaxException e)
152          {          {
153            throw new IllegalStateException("The SWRL URL is invalid.", e);            throw new IllegalStateException("The SWRL URL is invalid.", e);
154          }          }
155        return swrl;        return swrl;
156      }      }
157    
158    }    }
159    
160    /**    /**
161     * A specific subclass of <code>LogicLanguage</code>, which represents     * A specific subclass of <code>LogicLanguage</code>, which represents the
162     * the DRS logic formalism.  Instances of this are not modifiable.     * DRS logic formalism. Instances of this are not modifiable.
163     *     *
164     * @author Andrew John Hughes (gnu_andrew@member.fsf.org)     * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
165     * @see LogicLanguage     * @see LogicLanguage
166     */     */
167    private static final class DRS    private static final class DRS extends LogicLanguage
     extends LogicLanguage  
168    {    {
169    
170      /**      /**
171       * The default constructor for the DRS language, which stores       * The default constructor for the DRS language, which stores the URIs for
172       * the URIs for its specification documents.       * its specification documents.
173       */       */
174      public DRS()          public DRS()
175      {      {
176      }      }
177    
178      /**      /**
179       * This method always throws an exception in this subclass       * This method always throws an exception in this subclass in order to
180       * in order to prevent derivations of the DRS formalism.       * prevent derivations of the DRS formalism.
181       *       *
182       * @throws UnsupportedOperationException as the formalism       * @throws UnsupportedOperationException as the formalism can
183       *         can not be modified.       *         not be modified.
184       */       */
185      public void addURI(URI uri)      public void addURI(URI uri)
186      {      {
187        throw new UnsupportedOperationException("The DRS logic language "+        throw new UnsupportedOperationException("The DRS logic language "
188                                                "instance is not modifable.");                                                + "instance is not modifable.");
189      }      }
190    
191      /**      /**
192       * Returns the list of <code>URI</code>s for the DRS logic       * Returns the list of <code>URI</code> s for the DRS logic formalism.
193       * formalism.       *
      *  
194       * @return the DRS <code>URI</code>s.       * @return the DRS <code>URI</code>s.
195       */       */
196      public List<URI> getURIs()      public List<URI> getURIs()
197      {      {
198        List<URI> drs = new ArrayList<URI>();        List<URI> drs = new ArrayList<URI>();
199        try        try
200          {          {
201            drs.add(new URI("http://www.daml.org/services/owl-s/1.1/" +            drs.add(new URI("http://www.daml.org/services/owl-s/1.1/"
202                            "generic/drs.owl"));                            + "generic/drs.owl"));
203          }          }
204        catch (URISyntaxException e)        catch (URISyntaxException e)
205          {          {
206            throw new IllegalStateException("The DRS URL is invalid.", e);            throw new IllegalStateException("The DRS URL is invalid.", e);
207          }          }
208        return drs;        return drs;
209      }      }
210    
211    }    }
212    
213    /**    /**
214     * A specific subclass of <code>LogicLanguage</code>, which represents     * A specific subclass of <code>LogicLanguage</code>, which represents the
215     * the KIF logic formalism.  Instances of this are not modifiable.     * KIF logic formalism. Instances of this are not modifiable.
216     *     *
217     * @author Andrew John Hughes (gnu_andrew@member.fsf.org)     * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
218     * @see LogicLanguage     * @see LogicLanguage
219     */     */
220    private static final class KIF    private static final class KIF extends LogicLanguage
     extends LogicLanguage  
221    {    {
222    
223      /**      /**
224       * The default constructor for the KIF language, which stores       * The default constructor for the KIF language, which stores the URIs for
225       * the URIs for its specification documents.       * its specification documents.
226       */       */
227      public KIF()          public KIF()
228      {      {
229      }      }
230    
231      /**      /**
232       * This method always throws an exception in this subclass       * This method always throws an exception in this subclass in order to
233       * in order to prevent derivations of the KIF formalism.       * prevent derivations of the KIF formalism.
234       *       *
235       * @throws UnsupportedOperationException as the formalism       * @throws UnsupportedOperationException as the formalism can not be
236       *         can not be modified.       *         modified.
237       */       */
238      public void addURI(URI uri)      public void addURI(URI uri)
239      {      {
240        throw new UnsupportedOperationException("The KIF logic language "+        throw new UnsupportedOperationException("The KIF logic language "
241                                                "instance is not modifable.");                                                + "instance is not modifable.");
242      }      }
243    
244      /**      /**
245       * Returns the list of <code>URI</code>s for the KIF logic       * Returns the list of <code>URI</code> s for the KIF logic formalism.
246       * formalism.       *
      *  
247       * @return the KIF <code>URI</code>s.       * @return the KIF <code>URI</code>s.
248       */       */
249      public List<URI> getURIs()      public List<URI> getURIs()
250      {      {
251        List<URI> kif = new ArrayList<URI>();        List<URI> kif = new ArrayList<URI>();
252        try        try
253          {          {
254            kif.add(new URI("http://logic.stanford.edu/kif/kif.html"));            kif.add(new URI("http://logic.stanford.edu/kif/kif.html"));
255          }          }
256        catch (URISyntaxException e)        catch (URISyntaxException e)
257          {          {
258            throw new IllegalStateException("The KIF URL is invalid.", e);            throw new IllegalStateException("The KIF URL is invalid.", e);
259          }          }
260        return kif;        return kif;
261      }      }
262    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26