-
Notifications
You must be signed in to change notification settings - Fork 149
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 application that is part of the Geoportal Server project is already preconfigured and ready to be integrated with your geoportal. If you would like to leverage multiple ontologies, you can do so by deploying multiple ontology services and referencing additional adapter parameters in gpt.xml. Follow the steps below to deploy the sample Ontology Service.
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 (e.g., 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:
- Navigate to \\\bin folder
- Doubleclick on the tomcat6w file
- In the Apache Tomcat properties 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.
- After changing the settings, select Ok.
To deploy the sample ontology service, deploy the OntologyService.war file as a web application using the same methods you used to deploy your geoportal.war file. The OntologyService web application will need time (usually about 45 seconds or so) to initialize itself. This means that when the service is started, it will not be available immediately. Caution: If you are using WebLogic to deploy the OntologyService, you will have to unzip the OntologyService.war file and deploy it as a folder rather than deploy it as a .war file. Failure to do this will result in the OntologyService not retrieving results.
To check if the service is running, access its URL. The URL is shown below, where the host is the machine hosting the service and the port is your web server port number. The page will display an interface where you can test the ontology service as a standalone.
http://<host>:<port>/OntologyService
In the OntologyService interface, 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 \\OntologyService\WEB-INF\web.xml file. You may have to restart the OntologyService web application for configuration changes to take affect:
setting | meaning | default value |
<init-param></init-param><param-name></param-name>categories | 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></init-param><param-name></param-name>gemet | 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 your web server 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 |
- Navigate to the \\geoportal\WEB-INF\classes\gpt\config folder and open the gpt.xml file in a text editor
- Find the section where the <lucene></lucene> configuration is defined
- Find the commented out adapter section, and uncomment the code:
<adaptor
name="like"
className="com.esri.gpt.catalog.lucene.StandardNetworkParserAdaptor">
<attribute
key="baseUrl"
value="http://serverName/OntologyService/query?threshold=0.25&term="/>
</adaptor>
- Update the parameters in this section as described below:
- 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. 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 OntologyService web application's host server name, and port with the servlet engine port number: http://host:port/OntologyService/query?threshold=0.25&term=.
- Save the gpt.xml file.
- Restart the geoportal web application for the changes to take affect.
Back to Customizations