project35.soa.ontology.sources
Class AbstractTreeOntologySource

java.lang.Object
  extended by project35.soa.ontology.sources.AbstractTreeOntologySource
All Implemented Interfaces:
java.io.Serializable, OntologySource, TreeOntologySource, ServiceClass
Direct Known Subclasses:
DefaultSubtreeOntologySource, TabIndentedTextSource, XMLOntologySource

public abstract class AbstractTreeOntologySource
extends java.lang.Object
implements TreeOntologySource

This class is used to manage a tree of terms. Subclasses construct tree elements from sources such as tab indented files and xml files. Also contains routines for searching through the tree.


Copyright (c) Kevin Garwood and University of Manchester 2007. All rights reserved. Licensed under the Academic Free License version 3.0. For more information on the terms and conditions, please see the file "LICENSE" that is included in this distribution.

Version:
1.0
Author:
Kevin Garwood (kgarwood@users.sourceforge.net), code contributions from 2002 - September 30, 2007.
See Also:
Serialized Form

Field Summary
protected  java.util.ArrayList anchorTerms
           
protected  java.text.Collator collator
           
protected  java.io.File file
           
protected  java.lang.String fileName
           
protected  boolean isSourceWorking
           
protected  StringMaskValidator maskValidator
           
protected  OntologyContext ontologyContext
           
protected  OntologyServiceMetaData ontologyServiceMetaData
           
protected  Parameter[] parameters
           
protected  java.net.URL resourceDirectory
           
protected  TreeOntologyTerm rootTerm
           
protected  TreeOntologyTerm searchResultTerm
           
protected  java.lang.StringBuffer status
           
protected  java.net.URL url
           
 
Constructor Summary
AbstractTreeOntologySource()
           
 
Method Summary
protected  void addAnchorTerm(java.lang.String anchorTerm)
           
 boolean containsTerm(Project35FormContext project35FormContext, OntologyTerm ontologyTerm)
          determines whether an ontology contains a given term
 Parameter[] getInitialisationParameters()
           
 OntologyServiceMetaData getOntologyServiceMetaData(Project35FormContext project35FormContext)
           
abstract  OntologyTermProvenance getOntologyTermProvenance(Project35FormContext project35FormContext, OntologyTerm ontologyTerm)
           
 OntologyTerm[] getRelatedTerms(Project35FormContext project35FormContext, OntologyRelationshipType relationshipType, OntologyTerm ontologyTerm)
           
 OntologySource getSubOntologySource(Project35FormContext project35FormContext, Parameter[] parameterList)
          returns a part of the original ontology
 OntologyRelationshipType[] getSupportedOntologyRelationships(Project35FormContext project35FormContext)
           
 OntologyTerm[] getTerms(Project35FormContext project35FormContext)
          returns a collection of terms
 TreeOntologyTerm getTreeRoot(Project35FormContext project35FormContext)
           
 void initialiseService(java.net.URL resourceDirectory, Parameter[] parameters)
           
 boolean isWorking()
          indicates whether the ontology source is ready for service
protected  void reviseTreeWithAnchorTerms()
           
protected  TreeOntologyTerm search(java.lang.String mask)
           
protected  TreeOntologyTerm search(java.lang.String mask, TreeOntologyTerm ontologyTerm)
          returns a subtree search result based on a search parameter and a root node
protected  void setDescription(java.lang.String fileName)
           
 java.lang.String test()
          diagnostic method that indicates whether the ontology source is working.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

anchorTerms

protected java.util.ArrayList anchorTerms

collator

protected java.text.Collator collator

rootTerm

protected TreeOntologyTerm rootTerm

searchResultTerm

protected TreeOntologyTerm searchResultTerm

maskValidator

protected StringMaskValidator maskValidator

file

protected java.io.File file

status

protected java.lang.StringBuffer status

isSourceWorking

protected boolean isSourceWorking

fileName

protected java.lang.String fileName

url

protected java.net.URL url

parameters

protected Parameter[] parameters

ontologyContext

protected OntologyContext ontologyContext

resourceDirectory

protected java.net.URL resourceDirectory

ontologyServiceMetaData

protected OntologyServiceMetaData ontologyServiceMetaData
Constructor Detail

AbstractTreeOntologySource

public AbstractTreeOntologySource()
Method Detail

search

protected TreeOntologyTerm search(java.lang.String mask)

search

protected TreeOntologyTerm search(java.lang.String mask,
                                  TreeOntologyTerm ontologyTerm)
returns a subtree search result based on a search parameter and a root node

Parameters:
mask - the search criteria
ontologyTerm - the root term where the search begins
Returns:
a root term whose children represents the results of the search

addAnchorTerm

protected void addAnchorTerm(java.lang.String anchorTerm)

reviseTreeWithAnchorTerms

protected void reviseTreeWithAnchorTerms()

isWorking

public boolean isWorking()
Description copied from interface: OntologySource
indicates whether the ontology source is ready for service

Specified by:
isWorking in interface OntologySource

getInitialisationParameters

public Parameter[] getInitialisationParameters()
Specified by:
getInitialisationParameters in interface ServiceClass

initialiseService

public void initialiseService(java.net.URL resourceDirectory,
                              Parameter[] parameters)
                       throws java.lang.Exception
Specified by:
initialiseService in interface ServiceClass
Throws:
java.lang.Exception

setDescription

protected void setDescription(java.lang.String fileName)

test

public java.lang.String test()
Description copied from interface: OntologySource
diagnostic method that indicates whether the ontology source is working.

Specified by:
test in interface OntologySource

getOntologyServiceMetaData

public OntologyServiceMetaData getOntologyServiceMetaData(Project35FormContext project35FormContext)
Specified by:
getOntologyServiceMetaData in interface OntologySource

getOntologyTermProvenance

public abstract OntologyTermProvenance getOntologyTermProvenance(Project35FormContext project35FormContext,
                                                                 OntologyTerm ontologyTerm)
Specified by:
getOntologyTermProvenance in interface OntologySource

getSupportedOntologyRelationships

public OntologyRelationshipType[] getSupportedOntologyRelationships(Project35FormContext project35FormContext)
Specified by:
getSupportedOntologyRelationships in interface OntologySource

getRelatedTerms

public OntologyTerm[] getRelatedTerms(Project35FormContext project35FormContext,
                                      OntologyRelationshipType relationshipType,
                                      OntologyTerm ontologyTerm)
Specified by:
getRelatedTerms in interface OntologySource

getTerms

public OntologyTerm[] getTerms(Project35FormContext project35FormContext)
Description copied from interface: OntologySource
returns a collection of terms

Specified by:
getTerms in interface OntologySource
Returns:
the ontology terms as a sorted list

containsTerm

public boolean containsTerm(Project35FormContext project35FormContext,
                            OntologyTerm ontologyTerm)
determines whether an ontology contains a given term

Specified by:
containsTerm in interface OntologySource
Parameters:
ontologyTerm - an ontology term
Returns:
true if the ontology contains a term; else the ontology doesn't contain the term

getTreeRoot

public TreeOntologyTerm getTreeRoot(Project35FormContext project35FormContext)
Specified by:
getTreeRoot in interface TreeOntologySource
Parameters:
project35FormContext - a collection of environment variables that refer to different parts of the Project35 application
Returns:
the root term of the ontology

getSubOntologySource

public OntologySource getSubOntologySource(Project35FormContext project35FormContext,
                                           Parameter[] parameterList)
returns a part of the original ontology

Specified by:
getSubOntologySource in interface OntologySource
Parameters:
parameterList - an array containing multiple terms enclosed in double quotation marks
Returns:
another ontology source based on the parameters and the original ontology source