Ontology Application Development
Ontology Programming NotesThe definition of the API are still evolving.
Design
These different than a full blown ontology set of services; the apis are simplified so the hydrologists and other hydrologic information systems can utlize them.
There are really two levels that the ontologies need to operate, ontology and search.
For the first is really the data source for the ontology, which might be a database or a set of owl files. The second is the definition of the behaviors of the search of the HIS components.
- IOntologyQueryService
- Based on the original Hydroseek services, this API abstracts datasource to provide a set of search services over a hierarchical vocabulary.
- IOntologyQueryServiceExtended, extends iOntologyQueryService
- This extends the Onotology Services API with an additional call to handle AJAX query.
- IHisOntologyService
- Goal is to return variable information, and associated concepts.
- uses a iOntologyQueryService to provide services for a hydrologic information system. Any iOntologyQueryService can be used.
IOntologyQueryService Interface
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Xml.Linq;
namespace Cuahsi.His.Ontology
{
/// <summary>
/// Ontology Services API.
/// <para>This defined the interface over the datasource that holds the ontology;
/// eg. OwlRDF, database tables, or excel files. </para>
/// <para>The interface to query the variable information is in the IHisOntologyService</para>
/// </summary>
[ServiceContract(Namespace = "uri:cuahsi.his.ontology.200906")]
public interface IOntologyQueryService
{
//[OperationContract]
//void InitializeComponent();
[OperationContract]
XDocument GetConceptsTree();
[OperationContract]
XDocument GetSearchableConceptsAsXml();
[OperationContract]
string[] GetSearchableConceptsAsStrings();
[OperationContract]
string GetOntologyConceptCode(string keyword);
[OperationContract]
string GetOntologyKeyword(string conceptCode);
[OperationContract]
XDocument GetRelevantConceptsAndVariablesXml(String keyword);
}
/// <summary>
/// This extends the Onotology Services API with an additional call to handle AJAX query.
/// </summary>
/// <seealso cref="IOntologyQueryService"/>
[ServiceContract(Namespace = "uri:cuahsi.his.ontology.ajax.200906")]
public interface IOntologyQueryServiceExtended : IOntologyQueryService
{
[OperationContract]
string[] GetWordList(string prefixText, int count);
/// <summary>
/// This is intended to allow for fuzzy matching of the terms in the concept tree
/// </summary>
/// <param name="term"></param>
/// <param name="exactMatch"></param>
/// <returns></returns>
[OperationContract]
XDocument GetOntologyKeywords(string term, Boolean exactMatch);
}
}
IHisOntologyService
namespace Cuahsi.His.Ontology
{
public interface IHisOntologyService
{
# region intialize
IOntologyQueryService OntologyQueryService
{
get;
set;
}
#endregion
#region what codes are used
/// <summary>
/// Returns the concept codes that are used in this datasource
/// </summary>
/// <returns></returns>
[OperationContract]
string[] GetDataSourceConceptCodes(string DataSourceCode);
/// <summary>
/// This will return a list of concepts from the input conceptCode.
/// This should be a heirachical format that can be used in a user interface.
/// </summary>
/// <param name="conceptCode"></param>
/// <returns></returns>
XDocument GetConceptTree(string conceptCode);
/// <summary>
/// Returns the labels/names of concepts that are contained in this datasource.
/// </summary>
/// <returns></returns>
[OperationContract]
string[] GetSearchableConcepts();
#endregion
#region return mappings
/// <summary>
/// Returns the terms which will return results from GetDataSourceMappedVariables
/// <para> This will include the concepts, and depending on how a datasource has implemented
/// the service, it may include the variable names</para>
/// </summary>
/// <returns></returns>
[OperationContract]
string[] GetSearchableTerms();
// should this be WaterML variable?
[OperationContract]
XDocument GetDataSourceMappedVariables(string DataSourceCode);
#endregion
}
}