DLV
Class OutputDescriptor

java.lang.Object
  extended byDLV.OutputDescriptor

public class OutputDescriptor
extends java.lang.Object

This class describes how to build the output of DLV. An OutputDescriptor associates an OutputDescriptorItem for each predicate name (deafult is @link{ODIPredicate}). Each OutputDescriptorItem instance allows to correctly build a specified Predicate object during DLV output handling process, note that if you specify a FilePredicate or a JDBCPredicate data will be stored in the correspondig storage device (text files or relational databases respectively).

    Example. Call DLV and store DLV output in several storage devices.
    
            .... // suppose stm is a java.sql.Statement instance
    
            Program p=new Program();                      //build a Program object
            p.addProgramFile("a.dl");                     //add a text file containing a program
            DlvHandler dlv=new DlvHandler("dl.exe");      //build a Dlvhandler object
            OutputDescriptor oDes=dlv.getOutputDescriptor(); // get the OutputDescriptor ossociated to dlv obejct
    
            dlv.addDescriptor("pred1",new ODIFilePredicate("file.dl")); //export in file "file.dl" literals named "pred1"
            dlv.addDescriptor("pred2",new ODIJDBCPredicate("tableName",stm); //export in database table "tableName" literals named "pred2"
    
            dlv.run(); // run dlv
            

See Also:
OutputDescriptorItem, Predicate, DlvHandler

Constructor Summary
OutputDescriptor()
          Builds a new (empty) OutputDescriptor.
OutputDescriptor(OutputDescriptorItem defaultDescriptor)
          Builds a new OutputDescriptor specifying the default descriptor to be used.
 
Method Summary
 void addDescriptor(java.lang.String predicateName, OutputDescriptorItem o)
          Associates a predicate name with an OutputDescriptorItem.
 void clear()
          Removes all associations.
 OutputDescriptorItem getDescriptor(java.lang.String predicateName)
          Returns the OutputDescriptorItem associated with predicate name "predicateName".
 boolean multipleModelAllowed()
          Returns true if this OutputDescriptor supports multiple model generation, false otherwise.
 void removeDescriptor(java.lang.String predicateName)
          Removes (if exists) the OutputDescriptorItem associated with Predicate "predicateName".
 void reset()
          Resets this OutputDescriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputDescriptor

public OutputDescriptor()
Builds a new (empty) OutputDescriptor.


OutputDescriptor

public OutputDescriptor(OutputDescriptorItem defaultDescriptor)
Builds a new OutputDescriptor specifying the default descriptor to be used. The default descriptor is used to build Predicate objects that does not have a speciad descriptor associated with.

Method Detail

addDescriptor

public void addDescriptor(java.lang.String predicateName,
                          OutputDescriptorItem o)
Associates a predicate name with an OutputDescriptorItem.

Parameters:
predicateName - A predicate name.
o - an OutputDescriptorItem.

getDescriptor

public OutputDescriptorItem getDescriptor(java.lang.String predicateName)
Returns the OutputDescriptorItem associated with predicate name "predicateName". The default descriptor is returned if no special descriptor is assigned for "predicateName".

Parameters:
predicateName - A predicate name.
Returns:
The OutputDescriptorItem associated with predicate name "predicateName".

removeDescriptor

public void removeDescriptor(java.lang.String predicateName)
Removes (if exists) the OutputDescriptorItem associated with Predicate "predicateName".

Parameters:
predicateName - A predicate name.

reset

public void reset()
Resets this OutputDescriptor. Default descriptor is set to ODIPredicate, all associations are removed.


clear

public void clear()
Removes all associations.


multipleModelAllowed

public boolean multipleModelAllowed()
Returns true if this OutputDescriptor supports multiple model generation, false otherwise. Predicate and in most cases FilePredicate supports multiple models in output, but obviously JDBCPredicate does not allow to export more than one model.

Returns:
true if this OutputDescriptor supports multiple model generation, false otherwise.
See Also:
OutputDescriptorItem