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  import java.util.*;
19  /**AbstratOntoGazetteer
20   * This class implemnents the methods common for all ontology-aware gazetteers.*/
21  public abstract class AbstractOntoGazetteer
22  extends AbstractGazetteer implements OntoGazetteer {
23  
24    /** the url of the mapping definition */
25    protected java.net.URL mappingURL;
26  
27    /** class name of the linear gazetteer to be called */
28    protected String gazetteerName;
29  
30    /** reference to the linear gazetteer */
31    protected Gazetteer gaz;
32  
33    /**
34     * Sets the class name of the linear gazetteer to be loaded.
35     * @param name class name of a Gazetteer
36     */
37    public void setGazetteerName(String name) {
38      gazetteerName = name;
39    }
40  
41    /**
42     * Gets the class name of the linear gazetteer
43     * @return the class name of the linear gazetteer
44     */
45    public String getGazetteerName() {
46      return gazetteerName;
47    }
48  
49    /**
50     * Sets the URL of the mapping definition
51     * @param url the URL of the mapping definition
52     */
53    public void setMappingURL(java.net.URL url) {
54      mappingURL = url;
55    }
56  
57    /**
58     * Gets the URL of the mapping definition
59     * @return the URL of the mapping definition
60     */
61    public java.net.URL getMappingURL() {
62      return mappingURL;
63    }
64  
65    /**
66     * Gets the linear gazetteer
67     * @return the linear gazetteer
68     */
69    public Gazetteer getGazetteer(){
70      return gaz;
71    }
72  
73    /**
74     * Sets the linear gazetteer
75     * @param gaze the linear gazetteer to be associated with this onto gazetteer.
76     */
77    public void setGazetteer(Gazetteer gaze) {
78      gaz = gaze;
79    }
80  
81    /**Overrides {@link gate.creole.gazetteer.Gazetteer}
82     * and retrieves the linear definition from the underlying
83     * linear gazetteer*/
84    public LinearDefinition getLinearDefinition() {
85      if (null == gaz){
86        throw new gate.util.GateRuntimeException(
87        "linear gazetteer should be set before \n"+
88        "attempting to retrieve the linear definition");
89      }
90      return gaz.getLinearDefinition();
91    }
92  
93  } // class AbstractOntoGazetteer