1   /*
2    * AbstractOntoGazetteer.java
3    *
4    * Copyright (c) 2002, The University of Sheffield.
5    *
6    * This file is part of GATE (see http://gate.ac.uk/), and is free
7    * software, licenced under the GNU Library General Public License,
8    * Version 2, June1991.
9    *
10   * A copy of this licence is included in the distribution in the file
11   * licence.html, and is also available at http://gate.ac.uk/gate/licence.html.
12   *
13   * borislav popov 02/2002
14   *
15   */
16  package gate.creole.gazetteer;
17  
18  /**AbstratOntoGazetteer
19   * This class implemnents the methods common for all ontology-aware gazetteers.*/
20  public abstract class AbstractOntoGazetteer
21  extends AbstractGazetteer implements OntoGazetteer {
22  
23    /** the url of the mapping definition */
24    protected java.net.URL mappingURL;
25  
26    /** class name of the linear gazetteer to be called */
27    protected String gazetteerName;
28  
29    /** reference to the linear gazetteer */
30    protected Gazetteer gaz;
31  
32    /**
33     * Sets the class name of the linear gazetteer to be loaded.
34     * @param name class name of a Gazetteer
35     */
36    public void setGazetteerName(String name) {
37      gazetteerName = name;
38    }
39  
40    /**
41     * Gets the class name of the linear gazetteer
42     * @return the class name of the linear gazetteer
43     */
44    public String getGazetteerName() {
45      return gazetteerName;
46    }
47  
48    /**
49     * Sets the URL of the mapping definition
50     * @param url the URL of the mapping definition
51     */
52    public void setMappingURL(java.net.URL url) {
53      mappingURL = url;
54    }
55  
56    /**
57     * Gets the URL of the mapping definition
58     * @return the URL of the mapping definition
59     */
60    public java.net.URL getMappingURL() {
61      return mappingURL;
62    }
63  
64    /**
65     * Gets the linear gazetteer
66     * @return the linear gazetteer
67     */
68    public Gazetteer getGazetteer(){
69      return gaz;
70    }
71  
72    /**
73     * Sets the linear gazetteer
74     * @param gaze the linear gazetteer to be associated with this onto gazetteer.
75     */
76    public void setGazetteer(Gazetteer gaze) {
77      gaz = gaze;
78    }
79  
80    /**Overrides {@link gate.creole.gazetteer.Gazetteer}
81     * and retrieves the linear definition from the underlying
82     * linear gazetteer*/
83    public LinearDefinition getLinearDefinition() {
84      if (null == gaz){
85        throw new gate.util.GateRuntimeException(
86        "linear gazetteer should be set before \n"+
87        "attempting to retrieve the linear definition");
88      }
89      return gaz.getLinearDefinition();
90    }
91  
92  } // class AbstractOntoGazetteer