|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.ic.doc.automed.p2p.qproc.planner.QueryPlannerResult
public class QueryPlannerResult
Nested Class Summary | |
---|---|
class |
QueryPlannerResult.Accounting
Represents a class to keep records of different time parameters e.g. |
static class |
QueryPlannerResult.CoverageSet
A class to encapsulate a set of statistics about a coverage set |
static class |
QueryPlannerResult.EdgeMap
|
class |
QueryPlannerResult.MappingStorageHandler
An implementation of the SQLMapEntry interface for materialising mappings to the database |
Field Summary | |
---|---|
private QueryPlannerResult.Accounting |
account
|
private java.util.List |
coverageSets
|
private QueryMapping |
currMapping
|
private ArrayKeyMap |
e2P
|
private java.util.Map |
edgeMaps
|
(package private) java.lang.String |
ESCAPE_DOLLAR
Return a Postgres-friendly stringn for an IQL expression |
private static java.lang.String |
HDM_PREFIX
|
private static int |
IDCOUNTER
|
private SQLableMap |
jMap
|
private java.lang.String |
name
|
private java.util.Map |
nodeEdgeIDMap
|
private RuntimeParameters |
params
|
private static java.util.Map |
peerCache
remember the descriptions of the peer locations that have been wrapped |
private boolean |
processed
|
private Graph |
qGraph
|
private java.lang.String |
qpeer
|
private java.util.List |
queryMappings
|
private Schema |
schema
|
private java.util.Map |
schemaEdgeMap
|
private java.util.Map |
schemaMap
|
private java.lang.String |
schemaName
|
private static int |
section
|
private java.util.Map |
seenIDs
mapping coverage-set -> List |
private static long |
serialVersionUID
|
private static StringMatcher |
smatcher
|
Constructor Summary | |
---|---|
QueryPlannerResult()
|
Method Summary | |
---|---|
void |
addCoveredEdge(Edge e)
Insert an edge into the map to indicate that it is covered by some procesing node (i.e. |
void |
addEdges2Peer(java.util.Map e2P)
|
void |
addMapping(Edge e,
HDMGraph g)
|
void |
addMappings(java.lang.Object key,
java.util.Collection omappings)
|
void |
addMappings(java.lang.Object key,
java.util.Collection omappings,
boolean memOnly)
|
void |
addMappings(QueryPlannerResult qpresult,
int topK,
boolean memOnly)
Copy mappings from one result object to another. |
void |
addPeerLocations(HDMObject eo,
boolean source,
int mid,
java.util.Map lm)
Save peer locations to the database. |
void |
addQueryMapping(QueryMapping qmapping)
Add one query mapping to the result. |
void |
addQueryMappings(java.util.Collection qmappings)
Add a collection of query mappings to the result. |
void |
cacheMappings(Edge e,
java.util.Collection mappings)
A memory-cache of the mappings of a given k-edge. |
void |
clear()
|
void |
clear(boolean alsoMappingsInRep)
|
void |
clearAll()
Clear all SMR tables |
private void |
clearCommon()
|
void |
clearQuery()
Remove everything in the storage that are associated to a given k-query |
void |
clearTopK()
|
void |
copyAccounting(QueryPlannerResult qpresult)
Transfer accountingn from the input object to this object |
private java.lang.String |
escapeIQL(java.lang.String iqlStr)
|
QueryPlannerResult.Accounting |
getAccounting()
Return an accounting object used for recording the time statistics of different methods. |
java.util.Collection |
getCachedMappings(Edge e)
Look up mappings of an edge in the edge map (see method getEdgeMetadata()) |
private java.lang.String |
getCoverageSetID(java.lang.String schema,
java.lang.String peer)
|
java.util.Collection |
getCoverageSets()
Return the coverage sets |
java.util.Collection |
getCoverageSets(Edge kedge)
Obtain statistics about all s-coverage sets of a given k-edge in the AutoMed repository of the peer that owns this result object. A s-coverage set is represented by QueryPlannerResult.CoverageSet class, which has the
following fields:
k-edge (Edge ) of the k-query to which the set
belongs
coverageSetName which is a string delimited by
'|' each element of which is a string of the form
schema:peer .In essence, this is a set of schema-peer pairs, which cover the source and target objects of at least one mapping of the k-edge. |
QueryMapping |
getCurrentQueryMapping()
|
java.util.Map |
getEdges2Peer()
|
java.util.Map |
getEdgesByPeer()
Return a list of edge entries that are supported by each peer Returns a Map object: peer -> List |
private java.util.Collection |
getGraphObjects(java.lang.String sql)
A method to retrieve HDMGraph objects from the database. |
java.util.Map |
getJoinMap()
|
private java.lang.Integer |
getK2OMappingID(HDMObject o,
int mid,
boolean source)
Returns the knmapid of the k-node-to-object mapping between a k-node and an HDM object. |
private int |
getLastSeqID(java.lang.String sequence)
Get the last value of a number sequence |
java.util.Map |
getMappingContainer()
|
java.util.Map |
getMappings()
Return a map containing all mappings: edge->TreeSet<ObjectMapping> |
java.util.Collection |
getMappings(Edge kedge)
Get all mappings of a given k-edge of the query that is represented by this result object. |
java.util.Collection |
getMappings(Edge kedge,
java.lang.String mid)
Get a mapping object from the database given its id |
private java.util.Collection |
getMappings(java.lang.Object[] key,
int startRID,
int topK)
Get top-m mappings of a given edge |
java.util.Collection |
getMappings(java.lang.Object kedge,
java.lang.Object qid,
java.lang.String peerName,
int startRID,
int topK)
Get all mappings of a given edge of a given query. |
java.util.Collection |
getMappings(java.lang.String sourceObj,
java.lang.String sourceSchema,
java.lang.String sourcePeer,
java.lang.String targetObj,
java.lang.String targetSchema,
java.lang.String targetPeer)
Query the object mappings |
java.util.Collection |
getMappingsTopK(Edge e,
long eid,
java.lang.String kqid,
java.lang.String qpeer,
java.lang.String csetid,
int fetchSize)
Obtain a top-m mapping set of a coverage set (identified by key) of a given k-edge (identified by eid). |
java.lang.Object |
getParameter(java.lang.String paramName)
|
RuntimeParameters |
getParams()
|
java.util.Map |
getPeerCache()
|
java.util.Map |
getPeerLocations(HDMObject o,
java.lang.String schema)
Get a hash map[peer:schema->val-summary] of a given HDM object in the AutoMed repository. |
private java.lang.Integer |
getPSchemaID(java.lang.String sname,
java.lang.String pname)
Get the id of the peer-schema pair given the peer and schema names. |
Graph |
getQueryGraph()
|
int |
getQueryID()
|
QueryMapping |
getQueryMapping(java.lang.String qid)
Retrieve a query mapping given its id |
java.util.List |
getQueryMappings()
Return the collection of query mappings |
java.lang.String |
getQueryPeer()
|
java.util.Map |
getSchemaImplementation()
Return a hash map of schema and the nodes |
Schema |
getSelectedSchema()
|
private static java.lang.Object |
getSQL(java.lang.String sql)
Get objects by executing a custom SQL command. |
boolean |
hasMapping()
|
boolean |
isCoveringEdge(Edge e)
Check whether or not an edge is covered by this result set. A result set covers an edge if either it has mappings for that edge or that there is some peer claimed to have mappings for it. |
boolean |
isCoveringQuery()
Check coverage mapping depending whether or not there were peers recorded to have processed every edge of this query |
boolean |
isDiskOnly()
|
boolean |
isEmpty()
|
boolean |
isMemory()
Returns true if this objects store the result mappings in memory |
boolean |
isMemoryOnly()
|
boolean |
isProcessed()
|
boolean |
isQueryComplete(QueryMapping qmap)
|
boolean |
isQuerySaved()
Returns true if the query has been saved into the database |
java.util.Set |
keySet()
Return the key set of the k-edge map |
private static java.lang.Object |
putSQL(java.lang.String sql,
boolean ignoreError)
Put objects by executing an SQL statement |
private static java.lang.Object |
putSQL(java.lang.String sql,
boolean ignoreError,
java.lang.Object obj)
This is used to execute an SQL statement, in which one element is an object |
private void |
readObject(java.io.ObjectInputStream in)
|
void |
removeAllMappings(java.lang.Object key)
Remove mappings that by source and target k-nodes of given k-edge |
void |
removeMappings()
Remove the existing mappings of the current query from the local repository. This is invoked by the top-k component before it is re-run in order to obtain fresh copies of the mappings from the remote peers. |
void |
removeMappings(java.lang.Object key)
Remove mappings by k-edge id |
private boolean |
removeSQL(java.lang.String sql,
boolean ignoreError)
Remove entries from storage using an SQL query |
private void |
resetCoverageSets()
Reset the coverage set objects to their original values |
void |
resetTopK()
Reset top-k status to the point before the mappings were fetched to the local peer. |
private void |
saveQueryGraph()
Store the k-query into the database |
void |
setCoverageSets(java.util.Collection csets)
|
void |
setCurrentQueryMapping(QueryMapping qmap)
|
void |
setEdge2Peer(java.lang.Object key,
java.lang.Object value)
Add a mapping between a k-edge and the peer that processes it |
void |
setIsProcessed(boolean processed)
|
void |
setParameters(RuntimeParameters params)
|
void |
setQueryGraph(Graph qGraph,
java.lang.String qpeer,
boolean store)
|
void |
setSelectedSchema(Schema s)
|
java.lang.String |
toString()
|
private void |
writeObject(java.io.ObjectOutputStream out)
customise serialisable so that we can also serialise the static id counter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private java.lang.String name
private static final int section
private Graph qGraph
private SQLableMap jMap
private transient java.util.Map seenIDs
private transient java.util.List coverageSets
private transient Schema schema
private transient java.util.Map schemaEdgeMap
private transient java.util.Map schemaMap
private transient java.util.Map edgeMaps
private transient java.util.Map nodeEdgeIDMap
private static final transient StringMatcher smatcher
private static java.util.Map peerCache
private ArrayKeyMap e2P
private RuntimeParameters params
private java.lang.String schemaName
private boolean processed
private java.util.List queryMappings
private QueryMapping currMapping
private static transient int IDCOUNTER
private java.lang.String qpeer
private static final java.lang.String HDM_PREFIX
final java.lang.String ESCAPE_DOLLAR
private QueryPlannerResult.Accounting account
Constructor Detail |
---|
public QueryPlannerResult()
Method Detail |
---|
public void setParameters(RuntimeParameters params)
public void setQueryGraph(Graph qGraph, java.lang.String qpeer, boolean store)
public boolean isQuerySaved()
private void saveQueryGraph()
public boolean isQueryComplete(QueryMapping qmap)
public void setEdge2Peer(java.lang.Object key, java.lang.Object value)
key
- is the edgevalue
- is the peerpublic java.util.Map getEdgesByPeer()
public java.util.Map getEdges2Peer()
public void addEdges2Peer(java.util.Map e2P)
public void addQueryMapping(QueryMapping qmapping)
qmapping
- public void addQueryMappings(java.util.Collection qmappings)
qmappings
- public QueryMapping getCurrentQueryMapping()
public void setCurrentQueryMapping(QueryMapping qmap)
public java.util.List getQueryMappings()
public QueryMapping getQueryMapping(java.lang.String qid)
qid
-
public boolean isProcessed()
public void setIsProcessed(boolean processed)
public Graph getQueryGraph()
public int getQueryID()
public java.lang.String getQueryPeer()
public java.util.Map getJoinMap()
public boolean isEmpty()
public java.util.Map getMappings()
public boolean isMemory()
public boolean isDiskOnly()
public boolean isMemoryOnly()
public void setSelectedSchema(Schema s)
public Schema getSelectedSchema()
public void addCoveredEdge(Edge e)
e
- public void addMapping(Edge e, HDMGraph g)
public void addMappings(java.lang.Object key, java.util.Collection omappings)
public void addMappings(java.lang.Object key, java.util.Collection omappings, boolean memOnly)
public void addMappings(QueryPlannerResult qpresult, int topK, boolean memOnly)
qpresult
- public void addPeerLocations(HDMObject eo, boolean source, int mid, java.util.Map lm)
locMap
- A HashMap of object->Map[peer->val-summary]private java.lang.Integer getPSchemaID(java.lang.String sname, java.lang.String pname)
sname
- pname
-
private java.lang.Integer getK2OMappingID(HDMObject o, int mid, boolean source)
schemeDef
-
private int getLastSeqID(java.lang.String sequence)
sequence
-
public java.util.Map getPeerLocations(HDMObject o, java.lang.String schema)
o
- and edge-type HDM object
public java.util.Set keySet()
public java.util.Collection getMappings(java.lang.Object kedge, java.lang.Object qid, java.lang.String peerName, int startRID, int topK)
key
-
public java.util.Collection getMappings(Edge kedge)
kedge
-
private java.util.Collection getMappings(java.lang.Object[] key, int startRID, int topK)
key
-
public void removeMappings(java.lang.Object key)
key
- public void removeMappings()
public void removeAllMappings(java.lang.Object key)
key
- public java.util.Collection getMappingsTopK(Edge e, long eid, java.lang.String kqid, java.lang.String qpeer, java.lang.String csetid, int fetchSize)
eid
- key
- fetchSize
-
public java.util.Collection getMappings(Edge kedge, java.lang.String mid)
mid
-
public java.util.Collection getMappings(java.lang.String sourceObj, java.lang.String sourceSchema, java.lang.String sourcePeer, java.lang.String targetObj, java.lang.String targetSchema, java.lang.String targetPeer)
sourceObj
- sourceSchema
- sourcePeer
- targetObj
- targetSchema
- targetPeer
-
public java.util.Collection getCachedMappings(Edge e)
e
-
public void cacheMappings(Edge e, java.util.Collection mappings)
e
- mappings
- public java.util.Map getSchemaImplementation()
deep
- if true then return a deep hash map (i.e. including mapping
objects)
public boolean isCoveringQuery()
public boolean isCoveringEdge(Edge e)
e
-
public boolean hasMapping()
public java.lang.Object getParameter(java.lang.String paramName)
public RuntimeParameters getParams()
public java.util.Map getPeerCache()
private static java.lang.Object putSQL(java.lang.String sql, boolean ignoreError)
sql
- ignoreError
-
private static java.lang.Object putSQL(java.lang.String sql, boolean ignoreError, java.lang.Object obj)
sql
- ignoreError
-
private static java.lang.Object getSQL(java.lang.String sql)
sql
-
private boolean removeSQL(java.lang.String sql, boolean ignoreError)
sql
- ignoreError
-
private void clearCommon()
public void clearTopK()
public void resetTopK()
private void resetCoverageSets()
public void clear(boolean alsoMappingsInRep)
alsoMappingsInRep
- whether or not to also clear mappings that are stored iin the
repository.public void clear()
public void clearQuery()
public void clearAll()
public java.util.Map getMappingContainer()
public java.lang.String toString()
toString
in class java.lang.Object
public void setCoverageSets(java.util.Collection csets)
public java.util.Collection getCoverageSets()
public java.util.Collection getCoverageSets(Edge kedge)
QueryPlannerResult.CoverageSet
class, which has the
following fields:
k-edge
(Edge
) of the k-query to which the set
belongs
coverageSetName
which is a string delimited by
'|'
each element of which is a string of the form
schema:peer
.fetchSize
: the number of mappings that are covered by this
coverage set
localRank
: the max rank of all the mappings covered by
this set
key
- eid
- qid
-
private java.lang.String getCoverageSetID(java.lang.String schema, java.lang.String peer)
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
out
-
java.io.IOException
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
private java.util.Collection getGraphObjects(java.lang.String sql)
sql
-
private java.lang.String escapeIQL(java.lang.String iqlStr)
public QueryPlannerResult.Accounting getAccounting()
public void copyAccounting(QueryPlannerResult qpresult)
qpresult
-
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |