com.hp.hpl.jena.reasoner.dig
Class DIGConnection

java.lang.Object
  extended by com.hp.hpl.jena.reasoner.dig.DIGConnection

public class DIGConnection
extends java.lang.Object

Encapsulates the connection to a DIG reasoner.

Version:
Release @release@ ($Id: DIGConnection.java,v 1.13 2005/09/08 15:31:48 ian_dickinson Exp $)
Author:
Ian Dickinson, HP Labs (email)

Field Summary
static java.lang.String DEFAULT_REASONER_URL
          Default URL for connecting to a local DIG reasoner on port 8081
static java.lang.String XSI
          Namespace for XSI
 
Constructor Summary
DIGConnection()
           
 
Method Summary
 void bindKB(boolean rebind, DIGProfile profile)
          Bind a DIG KB to this adapter, by requesting a KB URI through the newKB verb.
 void errorCheck(org.w3c.dom.Document response, DIGProfile profile)
          Check the response from the DIG server to see if there is an error code, and raise an excption if so.
 java.lang.String getReasonerURL()
          Answer the URL of the external reasoner this connection is bound to.
 java.util.Iterator getWarnings()
          Answer an iterator over the warnings received since the last tell operation
 void release()
          Release this connection back to the connection pool.
 org.w3c.dom.Document sendDigVerb(org.w3c.dom.Document digVerb, DIGProfile profile)
          Send a verb to the attached DIG reasoner and answer the result.
 void serialiseDocument(org.w3c.dom.Document doc, java.io.Writer out)
          Serialise the given document to the given output writer.
 void setReasonerURL(java.lang.String url)
          Set the URL of the external reasoner with which this connection communicates.
 boolean warningCheck(org.w3c.dom.Document response)
          Append any warning messages from this response to the list of recent warnings, which is first cleared.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_REASONER_URL

public static final java.lang.String DEFAULT_REASONER_URL
Default URL for connecting to a local DIG reasoner on port 8081

See Also:
Constant Field Values

XSI

public static final java.lang.String XSI
Namespace for XSI

See Also:
Constant Field Values
Constructor Detail

DIGConnection

public DIGConnection()
Method Detail

sendDigVerb

public org.w3c.dom.Document sendDigVerb(org.w3c.dom.Document digVerb,
                                        DIGProfile profile)

Send a verb to the attached DIG reasoner and answer the result. The verb is encoded as an XML document object.

Parameters:
digVerb - A DIG verb (information request, ask or tell) as an XML document
Returns:
The resulting XML document formed from the response from the reasoner
Throws:
DigReasonerException - for any errors in XML encoding or HTTP transmission

serialiseDocument

public void serialiseDocument(org.w3c.dom.Document doc,
                              java.io.Writer out)

Serialise the given document to the given output writer.

Parameters:
doc - An XML document to serialise
out - A writer that will consume the seralised form of the document

bindKB

public void bindKB(boolean rebind,
                   DIGProfile profile)

Bind a DIG KB to this adapter, by requesting a KB URI through the newKB verb. If there is already a binding, do nothing unless rebind is true.

Parameters:
rebind - If true, any existing KB will be released before binding to a new KB

errorCheck

public void errorCheck(org.w3c.dom.Document response,
                       DIGProfile profile)

Check the response from the DIG server to see if there is an error code, and raise an excption if so.

Parameters:
response - The response from the DIG server

warningCheck

public boolean warningCheck(org.w3c.dom.Document response)

Append any warning messages from this response to the list of recent warnings, which is first cleared.

Parameters:
response - The response from the DIG server
Returns:
True if any warnings were detected.

getWarnings

public java.util.Iterator getWarnings()

Answer an iterator over the warnings received since the last tell operation

Returns:
An iterator over warnings

release

public void release()

Release this connection back to the connection pool.


getReasonerURL

public java.lang.String getReasonerURL()

Answer the URL of the external reasoner this connection is bound to.

Returns:
The current external reasoner URL

setReasonerURL

public void setReasonerURL(java.lang.String url)

Set the URL of the external reasoner with which this connection communicates.

Parameters:
url - The URL of the new external reasoner connection point


Copyright © 2000, 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP