de.unidu.is.retrieval.pire
Class PDatalogIR

java.lang.Object
  extended byde.unidu.is.retrieval.AbstractRetriever
      extended byde.unidu.is.retrieval.pire.PDatalogIR
All Implemented Interfaces:
IR, MomentsIR, Retriever

public class PDatalogIR
extends AbstractRetriever
implements MomentsIR

An IR interface (for XML documents) to PIRE (using probabilistic Datalog).

PIRE only deals with flat documents, but that is sufficient for the IR specification. Datatype and operator names are automatically converted into the PIRE versions.

Currently, only wsum queries are supported.

Since:
2004-01-03
Version:
$Revision: 1.20 $, $Date: 2005/03/14 17:33:14 $
Author:
Henrik Nottelmann

Constructor Summary
PDatalogIR(DB db, java.lang.String collectionName)
          Creates a new instance, which does not store added documents on disc.
PDatalogIR(DB db, java.lang.String collectionName, java.lang.String docDir)
          Creates a new instance, which stores added documents on disc.
 
Method Summary
 void addToIndex(java.lang.String docID, org.w3c.dom.Document document)
          Add the XML document to the index.
 void addToIndex(java.lang.String docID, java.lang.String document)
          Add the XML document to the index.
 void close()
          Closes the retriever, and optionally frees used system resources (e.g.
 void computeIndex()
          Computes the index, based on the document values which were added before.
 void computeMoments()
          Computes the moments of the indexing weights.
 org.w3c.dom.Document getDocument(ProbDoc doc)
          Returns the full XML document
 org.w3c.dom.Document getDocument(java.lang.String docID)
          Returns the full XML document
 Moments getMoments(Query query)
          Returns the expectation and the variance of the RSVs for the specified query.
 PIRE getPIRE()
          Returns the PIRE object used internally.
 double getRD(java.lang.String attName, java.lang.String operator, java.lang.String key)
          Returns the value corresponding to the specified key in the resource description (the rd relation), e.g. for defining the parameters of the mapping function.
 java.util.List getResult(Query query)
          Returns result for the specified query.
 void initIndex()
          Inits the index.
 void registerSchema(Schema schema)
          Registers the specified schema.
 void removeIndex()
          Removes the index.
 void setRD(java.lang.String attName, java.lang.String operator, java.lang.String key, double value)
          Sets the value corresponding to the specified key in the resource description (the rd relation), e.g. for defining the parameters of the mapping function.
 
Methods inherited from class de.unidu.is.retrieval.AbstractRetriever
getDocuments, getResultSummaries, getSchema, getSummaries, getSummary, getSummary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.unidu.is.retrieval.Retriever
getDocuments, getResultSummaries, getSchema, getSummaries, getSummary, getSummary
 

Constructor Detail

PDatalogIR

public PDatalogIR(DB db,
                  java.lang.String collectionName)
Creates a new instance, which does not store added documents on disc.

Parameters:
db - database
collectionName - name of the collection

PDatalogIR

public PDatalogIR(DB db,
                  java.lang.String collectionName,
                  java.lang.String docDir)
Creates a new instance, which stores added documents on disc.

Parameters:
db - database
collectionName - name of the collection
docDir - directory for added documents
Method Detail

registerSchema

public void registerSchema(Schema schema)
Registers the specified schema.

Specified by:
registerSchema in interface IR
Parameters:
schema - collection schema
See Also:
IR.registerSchema(de.unidu.is.retrieval.Schema)

initIndex

public void initIndex()
               throws IndexException
Inits the index.

Specified by:
initIndex in interface IR
Throws:
IndexException
See Also:
IR.initIndex()

addToIndex

public void addToIndex(java.lang.String docID,
                       org.w3c.dom.Document document)
                throws DocumentMismatchException,
                       DocumentNotStorableException
Add the XML document to the index.

If a directory was specified in the constructor, then the document is also stored in that directory.

Specified by:
addToIndex in interface IR
Parameters:
docID - document id
document - XML document
Throws:
DocumentMismatchException
DocumentNotStorableException
See Also:
IR.addToIndex(java.lang.String, org.w3c.dom.Document)

addToIndex

public void addToIndex(java.lang.String docID,
                       java.lang.String document)
                throws DocumentMismatchException,
                       DocumentNotStorableException
Add the XML document to the index.

If a directory was specified in the constructor, then the document is also stored in that directory.

Specified by:
addToIndex in interface IR
Parameters:
docID - document id
document - XML document
Throws:
DocumentMismatchException
DocumentNotStorableException
See Also:
IR.addToIndex(java.lang.String, java.lang.String)

computeIndex

public void computeIndex()
                  throws IndexException
Computes the index, based on the document values which were added before.

Specified by:
computeIndex in interface IR
Throws:
IndexException
See Also:
IR.computeIndex()

computeMoments

public void computeMoments()
                    throws IndexException
Computes the moments of the indexing weights.

Specified by:
computeMoments in interface MomentsIR
Throws:
IndexException

removeIndex

public void removeIndex()
                 throws IndexException
Removes the index.

Specified by:
removeIndex in interface IR
Throws:
IndexException

getResult

public java.util.List getResult(Query query)
                         throws UnsupportedQueryException
Returns result for the specified query.

Currently, only wsum queries are supported.

Specified by:
getResult in interface Retriever
Parameters:
query - XIRQL query
Returns:
list of ProbDoc instances
Throws:
UnsupportedQueryException
See Also:
Retriever.getResult(de.unidu.is.retrieval.Query)

getDocument

public org.w3c.dom.Document getDocument(java.lang.String docID)
                                 throws DocumentNotFoundException
Returns the full XML document

Specified by:
getDocument in interface Retriever
Parameters:
docID - document id
Returns:
full XML document, or null if it does not exist
Throws:
DocumentNotFoundException
See Also:
Retriever.getDocument(java.lang.String)

getDocument

public org.w3c.dom.Document getDocument(ProbDoc doc)
                                 throws DocumentNotFoundException
Returns the full XML document

Specified by:
getDocument in interface Retriever
Overrides:
getDocument in class AbstractRetriever
Parameters:
doc - document descriptor
Returns:
full XML document, or null if it does not exist
Throws:
DocumentNotFoundException
See Also:
Retriever.getDocument(de.unidu.is.retrieval.ProbDoc)

getMoments

public Moments getMoments(Query query)
                   throws UnsupportedQueryException
Returns the expectation and the variance of the RSVs for the specified query.

Currently, only wsum queries are supported.

Parameters:
query - XIRQL query
Returns:
moments (expectation and variance) or null, if not supported
Throws:
UnsupportedQueryException

getRD

public double getRD(java.lang.String attName,
                    java.lang.String operator,
                    java.lang.String key)
Returns the value corresponding to the specified key in the resource description (the rd relation), e.g. for defining the parameters of the mapping function.

Parameters:
attName - attribute name
operator - operator name
key - value key
Returns:
value

setRD

public void setRD(java.lang.String attName,
                  java.lang.String operator,
                  java.lang.String key,
                  double value)
Sets the value corresponding to the specified key in the resource description (the rd relation), e.g. for defining the parameters of the mapping function.

Parameters:
attName - attribute name
operator - operator name
key - value key
value - value

getPIRE

public PIRE getPIRE()
Returns the PIRE object used internally.


close

public void close()
Closes the retriever, and optionally frees used system resources (e.g. closes a network connection).

Specified by:
close in interface Retriever
Overrides:
close in class AbstractRetriever
See Also:
Retriever.close()