DSpace does not define any metadata vocabularies to confine the set of keywords that users can use while describing items. The need for a limited set of keywords is important since it eliminates the ambiguity of a free description system, consequently simplifying the task of finding specific items of information.
The ontology add-on allows the user to choose from a defined set of keywords organised in an ontology tree and then use these keywords to describe items while they are being submitted.
We have also developed a small search engine that displays the classification tree (or ontology) allowing the user to select the branches that best describe the information that she seeks.
The add-on supports several ontologies at the same as long as they are provided with the appropriate syntax. The ontologies are described in XML with the following (simple) structure:
<node id="acmccs98" label="ACMCCS98"> <isComposedBy> <node id="A." label="General Literature"/> </isComposedBy> <isRelatedTo> <node id="D.3.2"/> </isRelatedTo> </node>
The add-on was developed and tested for DSpace 1.1.1 and 1.2. It is not guaranteed that it will work on previous or subsequent versions of DSpace (any feedback on this would be very welcome).
Language changes can easily be made by editing the add-on *.jsp files:
This plug-in was tested with DSpace version 1.1.1 and 1.2. We can't make any assumptions on whether it will work on previous or future versions of DSpace.
This guide does not provide info on how to install DSpace. We assume you already have a running instance of DSpace. It doesn’t matter if you are running a customised version of DSpace because the installation steps do not automatically change the source code.
For installation instructions on how to install DSpace, please refer to http://www.dspace.org/technology/system-docs/
This add-on is distributed as source-code therefore it must be appended to
the DSpace sources (not to the deployed version). DSpace must be rebuilt and
redeployed using the standard DSpace ant script (i.e. ant update).
During this guide we will use the variables $DSPACE_SRC and $DSPACE_BIN to identify the directories where DSpace sources and DSpace binaries (installation directory) live, respectively.
We recommend setting the following environment variables by running the shell commands:
$DSPACE_SRC=/tmp/dspace-1.1.1-source (the place where you keep you DSpace sources)
$DSPACE_BIN=/dspace (this is the DSpace default installation directory)
$ADDON_SRC=/tmp/ontology-addon-src
(the place where you unpacked the plug-in)
Copy the add-on source files and java server pages to the appropriate DSpace
directories.
Please note that your existing classes will not be overwritten or changed.
$ cd $ADDON_SRC $ cp jsp $DSPACE_SRC -R $ cp src $DSPACE_SRC -R
Edit DSpace web.xml file and register the add-on servlets.
The web.xml can be found in
$DSPACE_SRC/jsp/WEB-INF/web.xml (DSpace 1.1.1) $DSPACE_SRC/etc/dspace-web.xml (DSpace 1.2)
Add the following lines to the appropriate sections:
<!-- Servlets --> <servlet>
<servlet-name>ontology</servlet-name>
<servlet-class>pt.uminho.dsi.ontology.servlet.OntologyServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>keyword-search</servlet-name>
<servlet-class>pt.uminho.dsi.ontology.servlet.KeywordSearchServlet</servlet-class>
</servlet>
<!-- Servlet Mappings -->
<filter-mapping>
<filter-name>registered-only</filter-name>
<url-pattern>/commentApproval</url-pattern>
</filter-mapping>
Copy the file ontology-tags.tld to your WEB-INF directory:
$ cp $ADDON_SRC/etc/ontology-tags.tld $DSPACE_SRC/jsp/WEB-INF
Edit the file header-default.jsp that comes with your DSpace distribution and paste the following lines in the head section of the html file:
$vi $DSPACE_SRC/jsp/layout/header-default.jsp (Paste the following lines in the head section) <!-- addons specific includes -->
<script type="text/javascript" src="/ontology/javascript/ontology.js"></script>
<link rel="stylesheet" href="/ontology/css/ontology.css">
<!-- addons specific includes -->
In order to allow users to choose keywords from an given ontology, the ontology tree must be shown during the submission of items.
Edit file
$DSPACE_SRC/jsp/submit/edit-metadata-2.jsp
and place the following link right after the declaration of the keyword textboxes (<input type=text name="subject_<%= i %>">):
<a href="javascript:void(null);"
onclick='javascript:popUp("/ontology/jsp/ontology.jsp?ID=subject_<%= i %>")'>
popup ontology
</a>
Please note: When the input textbox's name is subject_<%= i+1 %>" you should pass the ID parameter as subject_<%= i+1 %>. This information enables the popup window to paste back the chosen keywords to the appropriate textbox.
You should have added 5 of these links.
In the beginning of edit-metadata-2.jsp file you should add the attribute name="edit_metadata_2" to the form declaration so:
Change
<form action="<%= request.getContextPath() %>/submit#field"
method=post>
to
<form action="<%= request.getContextPath() %>/submit#field"
method=post
name="edit_metadata_2">
If you have very deep ontologies, it is possible that the keywords will not be fully visible in the default input text boxes. You could change the size of the text boxes or even replace them by text area fields to increase their size. It is also a good idea to make the input fields read-only to stop user from entering their custom keywords.
<textarea rows=2 cols=<%= subjectWidth %>
name=subject_<%= i %>
wrap=soft
readonly="readonly"
class="subjectTextArea">
<%= subjects[i].value %>
</textarea>
In order for the add-on to find and load your ontologies, you must specify the full path of where these files can be found on your file system.
Edit the file OntologyTag and setup the path in the variable ontologyDeploymentDirectory.
$ vi $DSPACE_SRC/src/pt/uminho/dsi/ontology/jsptag/OntologyTag.java (set ontologyDeploymentDirectory to the path where you have installed DSpace and where the ontologies can be found)
The Xalan library that is distributed with DSpace is incompatible with the ontology add-on. Please download and copy the latest version of xalan.jar to your DSpace lib directory. (It might be a good idea to backup your old xalan.jar)
Xalan can be found in http://xml.apache.org/xalan-j/
$ cp xalan.jar $DSPACE_SRC/lib
To have access to the search engine interface place a link on the desired web page or redirect you browser to http://dspace_url:port_number/keyword-search.
<a href="/keyword-search">Ontology Search</a>
Rebuild and update DSpace.
Please note after deploying a new version of DSpace it is best to restart Tomcat
server so that cached data can be updated.
$ cd $DSPACE_SRC $ ant update
And that’s all!
Thank you for your patience!