Enable Search Using an Ontology Service

Release 9.3.1 E-mail This Topic Printable Version Give Us Feedback

Enable Search Using an Ontology Service

An ontology service allows users to search not only for a specific term, but also terms related to that term according to the ontology's definition of related terms. For more about using the ontology service once its configured in a Geoportal, see How to Search with an Ontology Service



The sample ontology service that comes with the Geoportal extension is already preconfigured and ready to be integrated with your Geoportal. Follow the steps below to deploy the sample Ontology Service. Note: steps below are described for the Tomcat servlet container. If you are using different servlet container software, the steps will need to be adapted to accomodate your environment.

  1. Configure Java Virtual Memory Before deploying the ontology service, we recommend allocating more Java Virtual Machine memory to Tomcat if possible. The sample ontology service can cause Java Heap Space errors if there is not enough memory allocated.



    The process to change Tomcat's memory allocation differs from one system environment compared to another. If Tomcat is started as a windows service, the process is different than if its started from the command line. Instructions for a windows-service startup are given below; for other setups, see Tomcat documentation.



    To change the memory allocation (Tomcat 6.0 -- instructions similar for Tomcat 5.x):
    • Navigate to <TOMCAT installation folder>\bin folder
    • Doubleclick on the "tomcat6w" file
    • In the Apache Tomcat properties dialog window, select the "Java" tab
    • Near the bottom of the resulting window, there are three fields. You must set the value in the first two - Initial Memory Pool and Maximum Memory Pool - to at least 128. Note that the initial memory pool setting must match or exceed the maximum memory pool setting; if not, errors will result.
    • After changing the settings, select "Ok".
  2. Deploy and Configure the OntologyService web application

    • To deploy the sample ontology service, copy the OntologyService.war file into your <TOMCAT>\webapps folder, and restart Tomcat for the file to deploy.



      Important: the ontology service will need time (usually about 45 seconds or so) to initialize itself. So when the service is started, it will not be available immediately. To check its status after starting the service, use its access url:



      http://<host>:<port>/OntologyService



      where the "host" is the machine hosting the service and the "port" is your Tomcat port number.
    • When the service has initialized, this page will display an interface where you can test the ontology service as a standalone. Notice that entering a search term results in a lucene query at the bottom of the interface. When the "submit" button is clicked, the request is processed and the ontology for that term is returned.
    • Again, be patient for the ontology service to respond. It takes longer to do searches based on the ontology service because this sample implementation is built upon third party software libraries not optimized for performance. If your organization deploys its own ontology service, performance can be improved.
    • You can further customize the ontology service by overriding its default settings in the <TOMCAT>\webapps\OntologyService\WEB-INF\web.xml file. You may have to restart Tomcat for configuration changes to take affect:
      setting meaning default value
      <init-param><param-name>categories relative or full path to the "Categories" enumeration (this is an XML file containing association between category keyword and category name) categories-lite.xml
      <init-param><param-name>gemet relative or full path to the "GEMET" database file (this is XML file containing definition of all terms and relationship between them) gemet_ont.owl
      <load-on-startup>1</load-on-startup> comment this out if you do not want the ontology service to load when Tomcat is started. This is good for verifying that your Geoportal is functioning smoothly and to isolate if errors are related to your ontology service uncommented
  3. Integrate the OntologyService with the Geoportal
    • Open the gpt.xml file (from the \\geoportal\WEB-INF\classes\gpt\config folder) in a text editor
    • Find the section where the <lucene> configuration is defined
    • Beneath the commented out <!-- adapter section, paste the following code and update its parameters as described below:



      <adaptor name="like"

      className="com.esri.gpt.catalog.lucene.StandardNetworkParserAdaptor">

      <attribute key="baseUrl" value="Ontology_Service_base_URL"/>

      </adaptor>




      • name - name of the adaptor; will be used within user interface to call Ontology Service; can be short for convenience or leave as default "like". Tip: setting this to something intuitive for users, such as "like", may help with usability.
      • className - standard parser adaptor class supplied with the Geoportal extension. Do not change.
      • attribute key - "baseUrl"; required by standard parser adaptor. Do not change.
      • attribute value - ontology service base URL; for this sample implementation of the Ontology Service, input the following value replacing 'host' with your organization's host server name, and 'port' with the servlet engine port number:



        "http://<host>:<port>/OntologyService/query?term="
    • Save the gpt.xml file
    • Restart Tomcat for the changes to take affect