org.semwebcentral.sweetrules.analyzer
Class SweetPredicateStratifier

java.lang.Object
  extended byorg.semwebcentral.sweetrules.analyzer.SweetPredicateStratifier

public final class SweetPredicateStratifier
extends java.lang.Object

Created on Nov 8, 2004 Produces a predicate stratification

Author:
Shashidhara K Ganjugunte, Dr. Benjamin Grosof, Dr. Said Tabet, Chitravanu Neogy

Field Summary
static int DEFAULT_STRATUM_NUMBER
          The default stratum number for the predicates
private static SweetPredicateStratifier predicateStratifier
          The predicate stratifier
 
Constructor Summary
private SweetPredicateStratifier()
          The hidden constructor for the predicate stratifier
 
Method Summary
 java.util.Hashtable generateStratification(org.semwebcentral.sweetrules.ruleml.sweetrulemlobjectmodel.RulebaseType rb)
          Generates a predicate stratification for the given rulebase It first builds the predicate dependency graph and then generates the stratification
 java.util.Hashtable generateStratification(SweetPredicateDependencyGraph pdg)
          Generates a predicate stratification if possible
 SweetPredicate getFirstMaxStratumPredicate(java.util.Hashtable stratificationTable)
          Given a hashtable of predicates and their stratifications This returns "a" predicate with highest stratum number (if there are multiple max stratum predicates the first one in the hash table is returned)
static SweetPredicateStratifier getInstance()
          Gets the instance of the predicate stratifer
 int getMaxStratumNumber(java.util.Hashtable stratificationTable)
          Gets the maximum stratum in the stratification table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_STRATUM_NUMBER

public static final int DEFAULT_STRATUM_NUMBER
The default stratum number for the predicates

See Also:
Constant Field Values

predicateStratifier

private static SweetPredicateStratifier predicateStratifier
The predicate stratifier

Constructor Detail

SweetPredicateStratifier

private SweetPredicateStratifier()
The hidden constructor for the predicate stratifier

Method Detail

getInstance

public static SweetPredicateStratifier getInstance()
Gets the instance of the predicate stratifer

Returns:
The predicate stratifier instance

generateStratification

public java.util.Hashtable generateStratification(org.semwebcentral.sweetrules.ruleml.sweetrulemlobjectmodel.RulebaseType rb)
                                           throws SweetPredicateStratificationNotDefinedException
Generates a predicate stratification for the given rulebase It first builds the predicate dependency graph and then generates the stratification

Parameters:
rb - The rulebase to process
Returns:
The stratification table key -> SweetPredicate object and value -> Stratum number stored as Integer
Throws:
SweetPredicateStratificationNotDefinedException - if stratification cannot be performed
java.lang.IllegalArgumentException - if either of the arguments are null

generateStratification

public java.util.Hashtable generateStratification(SweetPredicateDependencyGraph pdg)
                                           throws SweetPredicateStratificationNotDefinedException
Generates a predicate stratification if possible

Parameters:
pdg - The predicate dependency graph
Returns:
The stratification table key -> SweetPredicate object and value -> Stratum number stored as Integer
Throws:
SweetPredicateStratificationNotDefinedException - if stratification cannot be performed
java.lang.IllegalArgumentException - if either of the arguments is null

getMaxStratumNumber

public int getMaxStratumNumber(java.util.Hashtable stratificationTable)
Gets the maximum stratum in the stratification table

Parameters:
stratificationTable - The stratification table to process
Returns:
The maximum stratum number

getFirstMaxStratumPredicate

public SweetPredicate getFirstMaxStratumPredicate(java.util.Hashtable stratificationTable)
Given a hashtable of predicates and their stratifications This returns "a" predicate with highest stratum number (if there are multiple max stratum predicates the first one in the hash table is returned)

Parameters:
stratificationTable - The stratification table to loop through
Returns:
The first predicate in the table with highest stratum number