org.activemath.content.mediator.kbimpl
Class WebServiceCaller

java.lang.Object
  extended by org.activemath.content.mediator.KBCaller
      extended by org.activemath.content.mediator.kbimpl.WebServiceCaller

public class WebServiceCaller
extends KBCaller

This class generate instances as adaptors for each repository with web service interface.


Constructor Summary
WebServiceCaller(String name, String ontologyURL, String mappingURL, String serverURL, String testContentId)
          All the parameters are initialised here.
 
Method Summary
 String getContent(String item)
          Returns the whole content of the learning object corresponding to the given uri.
 String getIdentifier()
          Because the serverURL is unique in the internet world, we use it as the Identifier by Management.
 String getMappingURL()
          Returns the URL of the mapping file.
 String getName()
          Each KBCaller has name, which can be returned by this method.
 String getOntologyURL()
          Returns the URL of the owl-file which specifies the metadata structure of the kb.
 String getUniqueURIPrefix()
          Return the Server Binding URL of the corresponding Web Service with a "/".
 Set queryClass(String item)
          Returns the set of class labels the given item belongs to.
 Set queryProperty(String item)
          Returns a Set of lists, where each list comprises two elements: [attribute,value].
 Set queryRelation(String rel, String item)
          Returns the set of all items x for which holds: x rel item.
 Set queryRelation(String rel, String item, String c)
          Returns the set of all items x for which holds: x rel item.
 void testQuery()
          Test necessary queries to ensure, that the repository can be accessed succesfully.
 
Methods inherited from class org.activemath.content.mediator.KBCaller
getOIOMapping, getOntologyModel, optimizeKBQuery, setOIOMapping, setOntologyModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebServiceCaller

public WebServiceCaller(String name,
                        String ontologyURL,
                        String mappingURL,
                        String serverURL,
                        String testContentId)
All the parameters are initialised here.

Parameters:
name - of the repository
ontologyURL - (URL for ontology of the metadata structure of the repository.)
mappingURL - (URL for the mapping from the repository's ontology to Ontology Instructional Objects (OIO))
serverURL - (URL for binding for querying data on the repository via web service)
testContentId - (identifier for a test content in order to validate the repository.)
Method Detail

testQuery

public void testQuery()
               throws Exception
Test necessary queries to ensure, that the repository can be accessed succesfully.

Throws:
Exception

queryClass

public Set queryClass(String item)
Description copied from class: KBCaller
Returns the set of class labels the given item belongs to.

Specified by:
queryClass in class KBCaller
Returns:
a set of Strings

queryRelation

public Set queryRelation(String rel,
                         String item)
Description copied from class: KBCaller
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, ...}

Specified by:
queryRelation in class KBCaller
Returns:
a set of Strings

queryProperty

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

Specified by:
queryProperty in class KBCaller
Returns:
a Set of Lists

getContent

public String getContent(String item)
Description copied from class: KBCaller
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.

Specified by:
getContent in class KBCaller
Returns:
the whole body of a learning object as String.

getName

public String getName()
Description copied from class: KBCaller
Each KBCaller has name, which can be returned by this method.

Specified by:
getName in class KBCaller
Returns:
The Name of the KBCaller.

getOntologyURL

public String getOntologyURL()
Description copied from class: KBCaller
Returns the URL of the owl-file which specifies the metadata structure of the kb.

Specified by:
getOntologyURL in class KBCaller
Returns:
a Sting determining URL.

getMappingURL

public String getMappingURL()
Description copied from class: KBCaller
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.

Specified by:
getMappingURL in class KBCaller
Returns:
a String determining the mapping's URL.

getIdentifier

public String getIdentifier()
Because the serverURL is unique in the internet world, we use it as the Identifier by Management.

Returns:
the identifier (serverURL)

getUniqueURIPrefix

public String getUniqueURIPrefix()
Return the Server Binding URL of the corresponding Web Service with a "/". As We have saved the binding URL as Identifier, so we need to return the Identifier with a "/" at the end.

Specified by:
getUniqueURIPrefix in class KBCaller
Returns:
a String denoting the unique string each URI of a learning object belonging to this repository caller starts with.
See Also:
KBCaller.getUniqueURIPrefix()

queryRelation

public Set queryRelation(String rel,
                         String item,
                         String c)
Description copied from class: KBCaller
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.

Specified by:
queryRelation in class KBCaller
Returns:
a set of Strings