uk.ac.ic.doc.automed.p2p.qproc.model
Class ObjectMapping

java.lang.Object
  extended by uk.ac.ic.doc.automed.util.graph.impl.Graph
      extended by uk.ac.ic.doc.automed.util.graph.impl.DataGraph
          extended by uk.ac.ic.doc.automed.util.graph.impl.HDMGraph
              extended by uk.ac.ic.doc.automed.p2p.qproc.model.ObjectMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, GVisualisable, SchemaI, GraphI
Direct Known Subclasses:
QueryMapping

public class ObjectMapping
extends HDMGraph
implements java.io.Serializable, java.lang.Comparable

See Also:
Serialized Form

Field Summary
protected static double EPSILON
           
static int[][] FD_MATCHDATA
          Instance mapping between two peer locations
static double LBOUND_RANGERANK
           
protected static double MIN_RANGERANK
          The minimum krange rank used to assign the mappings who do not have any kranges.
protected  java.util.Map scoverage
           
private static long serialVersionUID
           
private  HDMObject sourceObj
           
private  HDMObject targetObj
           
protected  int type
           
static int TYPE_DIRECT
          source and target objects are the same
static int TYPE_FUNCTIONAL_DEPENDENCE
          matching in which one object is a key and the other is an object in the same schema as the key object (i.e.
static int TYPE_INCLUSION
          matching through key reference (e.g.
static int TYPE_NAME
          matching of the names between two objects in two different schemas in which at least one object is not a key object (e.g.
static int TYPE_NAME_KEY
          matching in which two key objects have their names match with each other but there are no constraints that exist between them (e.g.
static int TYPE_TRANSITIVE
           
static int TYPE_TRANSITIVE_CANDIDATE_KEY
          a transitive key mapping whose target and/or source objects are candidate keys
static int TYPE_TRANSITIVE_KEY
          matching through transitive key reference (e.g.
static int TYPE_TRANSITIVE_KEY_ALT
          a transitive mapping in which the source and/or target is a candidate key whose extents contain auto-generated values
static int TYPE_TRANSITIVE_NAME
          transitive name mapping
private static java.lang.String[] typeAcronyms
           
private static java.lang.String[] typeNames
          Check whether this mapping is between two key constraints of the source and the target objects
 
Fields inherited from class uk.ac.ic.doc.automed.util.graph.impl.HDMGraph
CONSTRAINT_CANDIDATE_KEY, CONSTRAINT_FK_KEY, CONSTRAINT_MANDATORY, CONSTRAINT_PK_KEY, CONSTRAINT_REFLEXIVE, CONSTRAINT_UNIQUE
 
Fields inherited from class uk.ac.ic.doc.automed.util.graph.impl.DataGraph
constraint, constraints, edge, node, propObjs
 
Fields inherited from class uk.ac.ic.doc.automed.util.graph.impl.Graph
EDGE, idCounter, LEFT_BRACE, METADATA, NEW_LINE, RIGHT_ARROW, RIGHT_BRACE, SPACE, VERTICAL_BAR
 
Constructor Summary
  ObjectMapping()
           
protected ObjectMapping(java.lang.String schema)
           
  ObjectMapping(java.lang.String peer, java.lang.String schema)
           
 
Method Summary
 int compareTo(java.lang.Object another)
          Compare with another mapping on the basis of the rank
 int getLength()
          Return the number of edges and semantic constraints in the graph.
 java.util.Map getSCoverage()
          Extract s-coverage of this mappings from the source and target objects.
 SchemeInfo getSourceAsSchemeInfo()
           
 HDMObject getSourceObj()
           
 java.lang.String getSourcePeer()
           
 java.lang.String getSourcePrefix()
           
 java.lang.String getSourceSchema()
           
 java.lang.String getSourceSchemeDef()
           
 java.lang.String getSourceSchemeDef(boolean full)
           
 java.lang.String getSourceSchemeName()
          Return only the scheme definition (without the peer, schema, ...
 int getSourceSchemePos()
          Return the scheme position of the source object.
 SchemeInfo getTargetAsSchemeInfo()
           
 HDMObject getTargetObj()
           
 java.lang.String getTargetPeer()
           
 java.lang.String getTargetPrefix()
           
 java.lang.String getTargetSchema()
           
 java.lang.String getTargetSchemeDef()
           
 java.lang.String getTargetSchemeDef(boolean full)
           
 java.lang.String getTargetSchemeName()
          Return only the scheme definition (without the peer, schema, ...
 int getTargetSchemePos()
          Return the scheme position of the source object.
 int getType()
          Determines the type of this mapping
 java.lang.String getTypeName()
          Return full name of the mapping type
 java.lang.String getTypeName(boolean acronym)
           
 boolean isSameSchema()
          Check that source and target objects come from the same schema.
 boolean isSameSchemaWith(ObjectMapping m)
          Check that the source and target objects of this schema and of the input schema come from the same schema AND that these schemas are the same.
private  boolean isSemanticConstraint(SchemaObjectI c)
          Returns true if a constraint object is a semantic constraint.
 boolean isTransitiveType()
          Returns true if this mapping represents one of the transitive mapping types.
static boolean isTransitiveType(int type)
          Returns true if the specified type constant represents one of the transitive mapping types.
 boolean isType(int toCheck)
           
 void setSourceObj(HDMObject srcObj)
           
 void setTargetObj(HDMObject tgtObj)
           
 java.lang.String toString()
           
 
Methods inherited from class uk.ac.ic.doc.automed.util.graph.impl.HDMGraph
addConstraintObject, addConstraintObject, addEdgeObject, addEdgeObject, addK2ONode, addKNode, addNodeObject, addObject, containsConstraint, containsEdge, containsKNode, containsNode, containsObject, containsObject, createObject, createSchemaObject, equals, getDependentKeyEdge, getDependentObjects, getDependentObjects, getDependentSchemaObjects, getDependentSchemaObjects, getHDMObject, getK2Nodes, getK2O, getK2O, getK2OEdge, getK2OMapEdge, getK2OMapPos, getKFromO, getKFromO, getLabel, getModel, getName, getObject, getObjects, getObjects, getPeer, getPropertyObjects, getRank, getRankFormatted, getSchemaName, getSchemeNamesString, isEmpty, isSameSchema, setProperty, setRank, setSchemaName
 
Methods inherited from class uk.ac.ic.doc.automed.util.graph.impl.DataGraph
addConstraint, clear, containsConstraint, copy, copy, getConstraints, getNodeObject, getObject, remove, removeConstraint
 
Methods inherited from class uk.ac.ic.doc.automed.util.graph.impl.Graph
addEdge, addMetadata, addNode, changeDirection, contains, containsEdge, containsEdge, containsEdge, containsNode, containsNode, edgeIterator, finalize, firstEdge, firstInEdge, firstNode, firstOutEdge, getAdjEdges, getAdjNodes, getEdge, getEdgeByID, getEdges, getID, getInEdges, getMetadata, getMetadata, getNode, getNode, getNodeByID, getNodeCount, getNodes, getOutDegree, getOutEdges, getOutNodes, getUndirectedEdge, getUndirectedEdge, hasMetadata, isFirstNode, lastEdge, lastNode, nodeIterator, numberOfEdges, numberOfNodes, predNode, removeEdge, removeEdge, removeNode, removeNode, reset, source, succNode, target
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

type

protected int type

sourceObj

private HDMObject sourceObj

targetObj

private HDMObject targetObj

scoverage

protected transient java.util.Map scoverage

typeNames

private static final java.lang.String[] typeNames
Check whether this mapping is between two key constraints of the source and the target objects


typeAcronyms

private static final java.lang.String[] typeAcronyms

TYPE_DIRECT

public static final int TYPE_DIRECT
source and target objects are the same

See Also:
Constant Field Values

TYPE_FUNCTIONAL_DEPENDENCE

public static final int TYPE_FUNCTIONAL_DEPENDENCE
matching in which one object is a key and the other is an object in the same schema as the key object (i.e. functionally dependent on it) (e.g. S1:<<_,doc,id>> and S1:<<_,doc,author>> where S1:<<_,doc,id>> is the key object of schema S1)

See Also:
Constant Field Values

TYPE_INCLUSION

public static final int TYPE_INCLUSION
matching through key reference (e.g. PK-FK)

See Also:
Constant Field Values

TYPE_TRANSITIVE_CANDIDATE_KEY

public static final int TYPE_TRANSITIVE_CANDIDATE_KEY
a transitive key mapping whose target and/or source objects are candidate keys

See Also:
Constant Field Values

TYPE_TRANSITIVE_KEY

public static final int TYPE_TRANSITIVE_KEY
matching through transitive key reference (e.g. PK-FK1; PK-FK2 and FK1 and FK2 belong to the same table)

See Also:
Constant Field Values

TYPE_TRANSITIVE

public static final int TYPE_TRANSITIVE
See Also:
Constant Field Values

TYPE_TRANSITIVE_KEY_ALT

public static final int TYPE_TRANSITIVE_KEY_ALT
a transitive mapping in which the source and/or target is a candidate key whose extents contain auto-generated values

See Also:
Constant Field Values

TYPE_NAME_KEY

public static final int TYPE_NAME_KEY
matching in which two key objects have their names match with each other but there are no constraints that exist between them (e.g. S1:<<_,doc,id>> and S2:<<_,doc,title>> where S1:<<_,doc,id>> is the key object of schema S1 and S2:<<_,doc,title>> is the key object of the schema S2)

See Also:
Constant Field Values

TYPE_NAME

public static final int TYPE_NAME
matching of the names between two objects in two different schemas in which at least one object is not a key object (e.g. S1:<<_,doc,title>> and S2:<<_,pub,title>> where S1:<<_,doc,title>> is the key object of schema S1 and S2:<<_,pub,title>> is NOT the key object of the schema S2)

See Also:
Constant Field Values

TYPE_TRANSITIVE_NAME

public static final int TYPE_TRANSITIVE_NAME
transitive name mapping

See Also:
Constant Field Values

FD_MATCHDATA

public static final int[][] FD_MATCHDATA
Instance mapping between two peer locations


LBOUND_RANGERANK

public static final double LBOUND_RANGERANK

EPSILON

protected static final double EPSILON

MIN_RANGERANK

protected static final double MIN_RANGERANK
The minimum krange rank used to assign the mappings who do not have any kranges. It is chosen to be higher than the lower-bound value of the krange rank but still smaller than all possible k-range values that can be generated.

Constructor Detail

ObjectMapping

public ObjectMapping()

ObjectMapping

protected ObjectMapping(java.lang.String schema)

ObjectMapping

public ObjectMapping(java.lang.String peer,
                     java.lang.String schema)
Method Detail

setSourceObj

public void setSourceObj(HDMObject srcObj)

getSourceObj

public HDMObject getSourceObj()

setTargetObj

public void setTargetObj(HDMObject tgtObj)

getTargetObj

public HDMObject getTargetObj()

getType

public int getType()
Determines the type of this mapping

Returns:

getLength

public int getLength()
Return the number of edges and semantic constraints in the graph.

Overrides:
getLength in class HDMGraph
Returns:

getSourceSchemePos

public int getSourceSchemePos()
Return the scheme position of the source object.

Returns:

getSourceAsSchemeInfo

public SchemeInfo getSourceAsSchemeInfo()

getTargetSchemePos

public int getTargetSchemePos()
Return the scheme position of the source object.

Returns:

getSourceSchemeName

public java.lang.String getSourceSchemeName()
Return only the scheme definition (without the peer, schema, ... prefix)

Returns:

getTargetSchemeName

public java.lang.String getTargetSchemeName()
Return only the scheme definition (without the peer, schema, ... prefix)

Returns:

getTargetAsSchemeInfo

public SchemeInfo getTargetAsSchemeInfo()

getSourcePrefix

public java.lang.String getSourcePrefix()

getTargetPrefix

public java.lang.String getTargetPrefix()

getSourceSchema

public java.lang.String getSourceSchema()

getTargetSchema

public java.lang.String getTargetSchema()

getSourcePeer

public java.lang.String getSourcePeer()

getTargetPeer

public java.lang.String getTargetPeer()

getSourceSchemeDef

public java.lang.String getSourceSchemeDef()

getTargetSchemeDef

public java.lang.String getTargetSchemeDef()

getSourceSchemeDef

public java.lang.String getSourceSchemeDef(boolean full)

getTargetSchemeDef

public java.lang.String getTargetSchemeDef(boolean full)

getTypeName

public java.lang.String getTypeName()
Return full name of the mapping type

Returns:

getTypeName

public java.lang.String getTypeName(boolean acronym)

isSameSchema

public boolean isSameSchema()
Check that source and target objects come from the same schema.

Parameters:
g -
Returns:

isSameSchemaWith

public boolean isSameSchemaWith(ObjectMapping m)
Check that the source and target objects of this schema and of the input schema come from the same schema AND that these schemas are the same.

Parameters:
g -
Returns:

isSemanticConstraint

private boolean isSemanticConstraint(SchemaObjectI c)
Returns true if a constraint object is a semantic constraint.

Parameters:
c -
Returns:

isTransitiveType

public boolean isTransitiveType()
Returns true if this mapping represents one of the transitive mapping types.

Parameters:
type -
Returns:

isTransitiveType

public static boolean isTransitiveType(int type)
Returns true if the specified type constant represents one of the transitive mapping types.

Parameters:
type -
Returns:

isType

public boolean isType(int toCheck)

getSCoverage

public java.util.Map getSCoverage()
Extract s-coverage of this mappings from the source and target objects. Returns a map: Peer -> List of Schemas.

Returns:

compareTo

public int compareTo(java.lang.Object another)
Compare with another mapping on the basis of the rank

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
another -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class HDMGraph