org.activemath.content.mediator
Class KBCaller

java.lang.Object
  extended by org.activemath.content.mediator.KBCaller
Direct Known Subclasses:
AMRepositoryCaller, ExerciseRepositoryCaller, MathsThesaurusCaller, MBaseCaller, OIOCaller, WebServiceCaller

public abstract class KBCaller
extends Object

This abstract class defines the methods needed for querying a KB via the content mediator. The developer should subclass this class to offer an interface to the KB. Mind that each KBCaller has to be registered at the mediator using the mediator.registerKB() method.


Constructor Summary
KBCaller()
           
 
Method Summary
abstract  String getContent(String uri)
          Returns the whole content of the learning object corresponding to the given uri.
abstract  String getMappingURL()
          Returns the URL of the mapping file.
abstract  String getName()
          Each KBCaller has name, which can be returned by this method.
 OIOMapping getOIOMapping()
           
 com.hp.hpl.jena.ontology.OntModel getOntologyModel()
           
abstract  String getOntologyURL()
          Returns the URL of the owl-file which specifies the metadata structure of the kb.
abstract  String getUniqueURIPrefix()
          Returns a unique prefix of the URIs belonging to this repository.
protected  KBQuery optimizeKBQuery(KBQuery query)
          Overide this method to offer a DB-specific optimization.
abstract  Set queryClass(String item)
          Returns the set of class labels the given item belongs to.
abstract  Set queryProperty(String item)
          Returns a Set of lists, where each list comprises two elements: [attribute,value].
abstract  Set queryRelation(String rel, String item)
          Returns the set of all items x for which holds: x rel item.
abstract  Set queryRelation(String rel, String item, String c)
          Returns the set of all items x for which holds: x rel item.
 void setOIOMapping(OIOMapping mapping)
           
 void setOntologyModel(com.hp.hpl.jena.ontology.OntModel model)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KBCaller

public KBCaller()
Method Detail

optimizeKBQuery

protected KBQuery optimizeKBQuery(KBQuery query)
Overide this method to offer a DB-specific optimization.


queryClass

public abstract Set queryClass(String item)
Returns the set of class labels the given item belongs to.

Parameters:
item -
Returns:
a set of Strings

queryRelation

public abstract Set queryRelation(String rel,
                                  String item)
Returns the set of all items x for which holds: x rel item. E.g. queryRelation(function, is_a) will return the set {even function, odd function, ...}

Parameters:
item -
rel -
Returns:
a set of Strings

queryRelation

public abstract Set queryRelation(String rel,
                                  String item,
                                  String c)
Returns the set of all items x for which holds: x rel item. E.g. queryRelation(function, is_a, en) will return the set {even function, odd function, ...}. Additionally, when a symbol has several definitions with different coverages, then the definition with the coverage c is selected.

Parameters:
item -
rel -
Returns:
a set of Strings

queryProperty

public abstract Set queryProperty(String item)
Returns a Set of lists, where each list comprises two elements: [attribute,value]. The set contains the metadata specification of the given item.

Parameters:
item -
Returns:
a Set of Lists

getName

public abstract String getName()
Each KBCaller has name, which can be returned by this method.

Returns:
The Name of the KBCaller.

getOntologyURL

public abstract String getOntologyURL()
Returns the URL of the owl-file which specifies the metadata structure of the kb.

Returns:
a Sting determining URL.

getMappingURL

public abstract String getMappingURL()
Returns the URL of the mapping file. A mapping file specifies the correspondence of metadata concepts between the Ontology of Instructional Objects and the metadata ontology describing the metadata structure of a KBCaller.

Returns:
a String determining the mapping's URL.

getUniqueURIPrefix

public abstract String getUniqueURIPrefix()
Returns a unique prefix of the URIs belonging to this repository. E.g. returning "mbase://" will let the mediator access this KBCaller in order to retrieve the metadata or the content of a certain Learning object.

Returns:
a String denoting the unique string each URI of a learning object belonging to this repository caller starts with.

getContent

public abstract String getContent(String uri)
Returns the whole content of the learning object corresponding to the given uri. Use this method to fetch a whole learning object from a foreign repository.

Parameters:
uri -
Returns:
the whole body of a learning object as String.

setOntologyModel

public final void setOntologyModel(com.hp.hpl.jena.ontology.OntModel model)

getOntologyModel

public final com.hp.hpl.jena.ontology.OntModel getOntologyModel()

setOIOMapping

public final void setOIOMapping(OIOMapping mapping)

getOIOMapping

public final OIOMapping getOIOMapping()