|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fuberlin.wiwiss.d2rq.rdql.TablePrefixer
A class for collecting database table information and for creating table aliases.
Field Summary | |
protected java.util.Map |
aliasMap
given alias map from String (aliased Table) to Alias |
protected static java.util.regex.Pattern |
allowedTablePattern
|
private static java.lang.Class[] |
intParameterTypes
|
static boolean |
mayPrefixPrefixedString
|
private static java.lang.Class[] |
noneParameterTypes
|
protected java.util.Map |
prefixedAliasMap
new aliases. |
protected static java.lang.String |
prefixSeparator
|
static int |
prefixStringContinuation
|
protected java.util.Set |
referedTables
Database table names (Strings) in their alias form. |
protected java.lang.String |
tablePrefix
The common prefix to use in aliasing. |
protected int |
tablePrefixLength
|
protected static java.lang.String |
triplePrefix
|
Constructor Summary | |
TablePrefixer()
use without tablePrefixing |
|
TablePrefixer(int tripleNumber)
produce a uniform tablePrefix based on a number. |
|
TablePrefixer(java.lang.String prefix)
set a arbitrary tablePrefix |
Method Summary | |
static java.util.Collection |
createCollectionFromCollectionWithMap(java.util.Collection collection,
java.util.Map map)
Creates a filtered collection that contains the mapped values of collection . |
java.util.Map |
getAliasMap()
|
java.util.Map |
getPrefixedAliasMap()
|
java.util.Set |
getReferedTables()
|
boolean |
mayChangeID()
optimization information for Prefixable objects. |
static java.util.Collection |
newEmptyCollection(java.util.Collection oldType)
Creates a collection of same type as oldType |
java.lang.Object |
prefix(java.util.Collection obj)
|
java.lang.Object |
prefix(Column obj)
|
java.lang.Object |
prefix(Join obj)
|
java.lang.Object |
prefix(java.lang.Object obj)
Prefixes an object based on its interface declarations. |
java.lang.Object |
prefix(PropertyBridge obj)
|
java.lang.Object |
prefix(java.lang.String obj)
Strings are assumed to be tables. |
protected java.lang.String |
prefixAndReferTable(java.lang.String tableName)
Prefixes a table name and makes sure a FROM-Term exists. |
java.util.Collection |
prefixCollection(java.util.Collection collection)
|
java.util.Collection |
prefixCollectionAndMap(java.util.Collection collection,
java.util.Map map)
puts previous and result into map while prefixing a collection. |
java.util.Collection |
prefixCollectionIntoCollectionAndMap(java.util.Collection collection,
java.util.Collection results,
java.util.Map map)
Iterates over a collection and stores the results into both a collection and a map (unprefixed -> prefixed). |
Column |
prefixColumn(Column column)
|
java.util.Map |
prefixColumnColumnMap(java.util.Map map)
|
java.util.Set |
prefixConditions(java.util.Set conditions)
|
java.lang.Object |
prefixIfPrefixable(java.lang.Object obj)
this is used in handling NodeMaker and ValueSource classes some of which do not implement Prefixable |
Join |
prefixJoin(Join join)
|
NodeMaker |
prefixNodeMaker(NodeMaker obj)
|
Prefixable |
prefixPrefixable(Prefixable obj)
Prefixes an object that adheres to Prefixable interface. |
PropertyBridge |
prefixPropertyBridge(PropertyBridge propertyBridge)
|
java.util.Set |
prefixSet(java.util.Set collection)
Creates a new HashSet of prefixed values. |
java.lang.String |
prefixString(java.lang.String table)
Actual prefixing method with some plausibility checks. |
java.lang.String |
prefixTable(java.lang.String table)
Tables are refered to and prefixed |
ValueSource |
prefixValueSource(ValueSource obj)
|
protected java.lang.String |
replaceTablesInExpression(java.lang.String expression)
Tries to prefix table names in expression . |
void |
setAliasMap(java.util.Map aliasMap)
|
void |
setReferedTables(java.util.Set referedTables)
|
void |
setTablePrefix(java.lang.String newPrefix)
sets up tablePrefix including prefixSeparator and initializes prefixedAliasMap. |
void |
setTablePrefixToTripleNumber(int n)
|
protected java.lang.String |
substituteIfTable(java.lang.String identifier)
Just substitutes argument if it is known to be a table name (seen before). |
java.util.Map |
unprefixedColumnNameNumberMap(java.util.Map columnNameNumber)
Extracts keys matching this tablePrefix and renames them. |
java.lang.String |
unprefixString(java.lang.String table)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String tablePrefix
protected int tablePrefixLength
protected static final java.lang.String prefixSeparator
protected static final java.lang.String triplePrefix
protected java.util.Map aliasMap
protected java.util.Set referedTables
protected java.util.Map prefixedAliasMap
public static boolean mayPrefixPrefixedString
public static int prefixStringContinuation
protected static java.util.regex.Pattern allowedTablePattern
private static java.lang.Class[] intParameterTypes
private static java.lang.Class[] noneParameterTypes
Constructor Detail |
public TablePrefixer()
public TablePrefixer(java.lang.String prefix)
public TablePrefixer(int tripleNumber)
Method Detail |
public boolean mayChangeID()
public void setTablePrefix(java.lang.String newPrefix)
public void setTablePrefixToTripleNumber(int n)
public java.util.Map getAliasMap()
public void setAliasMap(java.util.Map aliasMap)
public java.util.Set getReferedTables()
public void setReferedTables(java.util.Set referedTables)
public java.util.Map getPrefixedAliasMap()
public java.lang.String prefixString(java.lang.String table)
table
-
public java.lang.String unprefixString(java.lang.String table)
public java.util.Map unprefixedColumnNameNumberMap(java.util.Map columnNameNumber)
columnNameNumber
- keys are prefixed.
protected java.lang.String replaceTablesInExpression(java.lang.String expression)
expression
.
Issues: The code may fail, if there are strings in the expressions
that match with table names. Generally we would be better off,
to have not unparsed expressions floating around.
expression
- an SQL expression like "Tab.Col = 2"
protected java.lang.String substituteIfTable(java.lang.String identifier)
protected java.lang.String prefixAndReferTable(java.lang.String tableName)
public java.lang.Object prefixIfPrefixable(java.lang.Object obj)
public java.lang.Object prefix(java.lang.Object obj)
public Prefixable prefixPrefixable(Prefixable obj)
Prefixable
interface.
public NodeMaker prefixNodeMaker(NodeMaker obj)
public ValueSource prefixValueSource(ValueSource obj)
public java.util.Collection prefixCollectionIntoCollectionAndMap(java.util.Collection collection, java.util.Collection results, java.util.Map map)
collection
- input collectionresults
- store collectionmap
- store map
results
public java.lang.Object prefix(java.util.Collection obj)
public java.util.Collection prefixCollection(java.util.Collection collection)
public static java.util.Collection newEmptyCollection(java.util.Collection oldType)
oldType
oldType
- a collection exemplar
public java.util.Collection prefixCollectionAndMap(java.util.Collection collection, java.util.Map map)
public static java.util.Collection createCollectionFromCollectionWithMap(java.util.Collection collection, java.util.Map map)
collection
.
collection
- provides the keysmap
- provides the values
collection
public java.util.Set prefixSet(java.util.Set collection)
public java.lang.Object prefix(java.lang.String obj)
public java.lang.String prefixTable(java.lang.String table)
public java.lang.Object prefix(Column obj)
public Column prefixColumn(Column column)
public java.lang.Object prefix(Join obj)
public Join prefixJoin(Join join)
public java.lang.Object prefix(PropertyBridge obj)
public PropertyBridge prefixPropertyBridge(PropertyBridge propertyBridge)
public java.util.Set prefixConditions(java.util.Set conditions)
public java.util.Map prefixColumnColumnMap(java.util.Map map)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |