import java.util.*; /* this class checks whether a particular attribute belongs to the given relation */ public class RelationLookup { /* this HashTable consists of String and a Set */ public Hashtable lookuptable; public boolean lookup(String relation, Object attribute) { HashSet hs = (HashSet)lookuptable.get(relation); return ( hs.contains(attribute) ) ; } /* the Hashtable lookuptable consists of a String(key) and HashSet(value) the relation is the key and the attribute set is the HastSet CURRENTLY WE ARE HARD-CODING THE RELATION NAMES AND ITS ATTRIBUTES. IN FUTURE WE SHOULD GET THIS DATA FROM THE METADATA OBJECT OF THE TABLE FROM THE ORACLE DATABASE */ /* ISSUES: CAPITAL LETTERS, AND STATIC CLASS */ public RelationLookup() { lookuptable = new Hashtable(); HashSet hs; hs = new HashSet(); // adding table location "L" hs.add(new String("NAME")); hs.add(new String("X")); hs.add(new String("Y")); lookuptable.put(new String("L"), hs); hs = new HashSet(); //adding table demography "D" hs.add(new String("NAME")); hs.add(new String("AGE")); hs.add(new String("SEX")); lookuptable.put(new String("D"), hs); } }