DIG 1.1 Reasoners API, April 26, 2004 (12:45 PM)

org.kr.dl.dig.reasoner.v1_1.impl
Class HTTPReasoner

java.lang.Object
  extended byorg.kr.dl.dig.reasoner.v1_1.impl.HTTPReasoner
All Implemented Interfaces:
Reasoner

public class HTTPReasoner
extends Object
implements Reasoner

An implementation of Reasoner that passes its requests to a remote reasoner via HTTP POST requests (see the DIG specification for more details). Allows the use of external reasoners conforming to the DIG interface, such as RACER.

Version:
$Id: HTTPReasoner.java,v 1.2 2004/04/26 08:55:45 dturi Exp $
Author:
Daniele Turi

Field Summary
 
Fields inherited from interface org.kr.dl.dig.reasoner.v1_1.Reasoner
XML_HEADER
 
Constructor Summary
HTTPReasoner(URL url)
          Creates a new client, talking to the DL reasoner at url.
 
Method Summary
 ResponsesDocument asks(AsksDocument asks)
          Returns the ResponsesDocument corresponding to the asks.
 IdentifierDocument getIdentifier()
          Returns the IdentifierDocument corresponding to the getIdentifier request.
 URL getUrl()
          Gets url.
 URI newKB()
          Obtains the URI for a new knowledge base from the reasoner.
 ResponseDocument parseResponse(URLConnection connection)
          Parses the reasoner response at connection into a ResponseDocument.
 ResponsesDocument parseResponses(URLConnection connection)
          Parses the reasoner responses at connection into a ResponsesDocument.
 boolean releaseKB(URI kb)
          Instructs the reasoner to release the knowledge base kb.
 void setUrl(URL url)
          Sets url.
 ResponseDocument tells(TellsDocument tells)
          Returns the ResponseDocument corresponding to the tells.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPReasoner

public HTTPReasoner(URL url)
             throws ReasonerException
Creates a new client, talking to the DL reasoner at url.

Parameters:
url - The URL of the DL reasoner.
Method Detail

getUrl

public URL getUrl()
Gets url.

Returns:
url.

setUrl

public void setUrl(URL url)
Sets url.

Parameters:
url - a new URL.

getIdentifier

public IdentifierDocument getIdentifier()
                                 throws ReasonerException
Returns the IdentifierDocument corresponding to the getIdentifier request.

Specified by:
getIdentifier in interface Reasoner
Returns:
the IdentifierDocument corresponding to the getIdentifier request.
Throws:
ReasonerException - with code:
  • 602 if the reasoner response does not parse or, if logger is finest, validate;
  • 104 if an IOException occurs;

tells

public ResponseDocument tells(TellsDocument tells)
                       throws ReasonerException
Returns the ResponseDocument corresponding to the tells.

Specified by:
tells in interface Reasoner
Parameters:
tells - an TellsDocument.
Returns:
the ResponseDocument corresponding to the tells.
Throws:
ReasonerException - with code:
  • 602 if the reasoner response does not parse or, if logger is finest, validate;
  • 104 if an IOException occurs.

asks

public ResponsesDocument asks(AsksDocument asks)
                       throws ReasonerException
Returns the ResponsesDocument corresponding to the asks.

Specified by:
asks in interface Reasoner
Parameters:
asks - an AsksDocument.
Returns:
the ResponsesDocument corresponding to the asks.
Throws:
ReasonerException - with code:
  • 602 if the reasoner response does not parse or, if logger is finest, validate;
  • 104 if an IOException occurs;

parseResponse

public ResponseDocument parseResponse(URLConnection connection)
                               throws ReasonerException
Parses the reasoner response at connection into a ResponseDocument.

Parameters:
connection - The URLConnection of the reasoner.
Returns:
the ResponseDocument corresponding to the reasoner response.
Throws:
ReasonerException - with code:
  • 602 if the reasoner response does not parse or, if logger is finest, validate;
  • 104 if an IOException occurs.

parseResponses

public ResponsesDocument parseResponses(URLConnection connection)
                                 throws ReasonerException
Parses the reasoner responses at connection into a ResponsesDocument.

Parameters:
connection - The URLConnection of the reasoner.
Returns:
the ResponsesDocument corresponding to the reasoner responses.
Throws:
ReasonerException - with code:
  • 602 if the reasoner responses do not parse or, if logger is finest, validate;
  • 104 if an IOException occurs.

newKB

public URI newKB()
          throws ReasonerException
Obtains the URI for a new knowledge base from the reasoner.

Specified by:
newKB in interface Reasoner
Returns:
the URI for a new knowledge base from the reasoner.
Throws:
ReasonerException - with code:
  • 602 if the reasoner responses do not parse or, if logger is finest, validate;
  • 104 if an IOException occurs;
  • 202 if the reasoner returns a malformed URI.

releaseKB

public boolean releaseKB(URI kb)
                  throws ReasonerException
Instructs the reasoner to release the knowledge base kb.

Specified by:
releaseKB in interface Reasoner
Parameters:
kb - the URI of a knowledge base.
Returns:
true if the operation succeeds.
Throws:
ReasonerException - with code:
  • 602 if the reasoner response does not parse or, if logger is finest, validate;
  • 104 if an IOException occurs;

DIG 1.1 Reasoners API, April 26, 2004 (12:45 PM)