wpi.associations.arminerSequence
Class DBReader

java.lang.Object
  extended bywpi.associations.arminerSequence.DBReader

public class DBReader
extends java.lang.Object

A DBReader is used to read data from a database.

Author:
Dana Cristofor, Laurentiu Cristofor, Zack Stoecker-Sylvia (zss@wpi.edu), Keith A. Pray (kap@wpi.edu)

Field Summary
private  ARMinerItemset[] attribute_itemset
          An array of Itemsets to pass back to WEKA if one or more attributes are required
private  int current_instance
          Current instance index
private  weka.core.Instances instances
          The instances passed by WEKA
private  java.util.Hashtable number_hash
          A hashtable of Attribute=Value strings, indexed on item ID Integers.
private static java.lang.String SET_DELIMETERS
          These are the characters to use in a set { and } are included for the beginning and the end, but could be used as delimeters if someone really wanted to.
private  java.util.Hashtable value_hash
          A hashtable of item ID Integers, indexed on Attribute=Value strings
 
Constructor Summary
DBReader(weka.core.Instances instances)
          Loads a WEKA Instances object and sets the valid items
 
Method Summary
 ARMinerItemset getAttributeItemset(int i)
          Function to return an ARMinerItemset containing all items in a particular attribute.
 ARMinerItemset getFirstRow()
          Function to return the first instance as an ARMinerItemset
 ARMinerItemset getNextRow()
          Function to return the instance at current_instance as an ARMinerItemset
 java.util.Hashtable getNumberHash()
          Function to return the item ID Integer to Attribute=Value string hashtable for use in translating back from from numbers to strings by WEKA.
 long getNumColumns()
          Function to return the number of columns (attribute value items)
 long getNumRows()
          Function to return the number of rows (instances)
 boolean hasMoreRows()
          Function to check if there are more rows (instances)
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value_hash

private java.util.Hashtable value_hash
A hashtable of item ID Integers, indexed on Attribute=Value strings


number_hash

private java.util.Hashtable number_hash
A hashtable of Attribute=Value strings, indexed on item ID Integers. Used to pass back to WEKA so it can know what the numbers mean


instances

private weka.core.Instances instances
The instances passed by WEKA


current_instance

private int current_instance
Current instance index


attribute_itemset

private ARMinerItemset[] attribute_itemset
An array of Itemsets to pass back to WEKA if one or more attributes are required


SET_DELIMETERS

private static java.lang.String SET_DELIMETERS
These are the characters to use in a set { and } are included for the beginning and the end, but could be used as delimeters if someone really wanted to. Non-set string attributes should simply be parsed as a single item as long as they do not contain any delimeters.

Constructor Detail

DBReader

public DBReader(weka.core.Instances instances)
         throws weka.core.UnsupportedAttributeTypeException
Loads a WEKA Instances object and sets the valid items

Parameters:
instances - the instances to read itemsets from
Throws:
exception - if the instances contain a numeric attribute
weka.core.UnsupportedAttributeTypeException
Method Detail

getNumRows

public long getNumRows()
Function to return the number of rows (instances)

Returns:
the number of instances

getNumColumns

public long getNumColumns()
Function to return the number of columns (attribute value items)

Returns:
the number of attribute value items

getFirstRow

public ARMinerItemset getFirstRow()
                           throws java.io.IOException
Function to return the first instance as an ARMinerItemset

Returns:
an ARMinerItemset of the first instance
Throws:
java.io.IOException

getNextRow

public ARMinerItemset getNextRow()
Function to return the instance at current_instance as an ARMinerItemset

Returns:
an ARMinerItemset of the current instance

hasMoreRows

public boolean hasMoreRows()
Function to check if there are more rows (instances)

Returns:
true if current_instance < number of instances, false otherwise

getNumberHash

public java.util.Hashtable getNumberHash()
Function to return the item ID Integer to Attribute=Value string hashtable for use in translating back from from numbers to strings by WEKA.

Returns:
a Hashtable where Attribute=Value Strings are keyed by Integers

getAttributeItemset

public ARMinerItemset getAttributeItemset(int i)
Function to return an ARMinerItemset containing all items in a particular attribute. Used by WEKA to specify constraints to AprioriRules.java.

Parameters:
i - the index of the attribute
Returns:
an ARMinerItemset of items in the given attribute

main

public static void main(java.lang.String[] args)