Enable Search Using an Ontology Service
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. 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.
-
Configure Java Virtual Memory (Tomcat web servers only):
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:
- Navigate to <TOMCAT installation folder>\bin folder
- Doubleclick on the tomcat6w file (or Tomcat5w if using Tomcat 5.5.x)
- 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. Caution:
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.
-
Deploy and Configure the
OntologyService web application
- 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. So 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
- On 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><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><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
- 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. So when the service is
started, it will not be available immediately.
-
Integrate the OntologyService with the Geoportal
- 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> 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 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 OntologyService web application's host server name, and port with the servlet engine port number:
"http://<host>:<port>/OntologyService/query?threshold=0.25&term="
Caution:do not forget to leave the query?threshold=0.25&term= part in the URL.
- Save the gpt.xml file.
- Restart the geoportal web application for the changes to take affect.