Class AAtomicAllenAlgebraMapper
- java.lang.Object
-
- org.aksw.limes.core.measures.mapper.temporal.allenAlgebra.atomic.AAtomicAllenAlgebraMapper
-
- Direct Known Subclasses:
BeginBegin,BeginEnd,EndBegin,EndEnd
public abstract class AAtomicAllenAlgebraMapper extends Object
Abstract class of atomic Allen's relations. The main idea behind this approach is to represent each Allen's Algebra relation as a Boolean combination of atomic relations. By computing each of the atomic relations only once and only if needed, we can decrease the overall runtime of the computation of a given set of Allen relations. Each event s can be described using two time points b(s) and e(s). To compose the atomic interval relations, we define all possible binary relations between the begin and end points of two event resources s = (b(s), e(s)) and t = (b(t), e(t)).- Version:
- 1.0
- Author:
- Kleanthi Georgala (georgala@informatik.uni-leipzig.de)
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description AAtomicAllenAlgebraMapper()Constructor of AtomicAllenAlgebraMapper class.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static StringgetBeginProperty(String expression)Extract first property (beginDate) from metric expression.abstract TreeMap<String,Set<String>>getConcurrentEvents(ACache source, ACache target, String expression)Returns the set of concurrent target events for each source instance.protected static StringgetEndProperty(String expression)Extract second property (endDate) from metric expression.protected static longgetEpoch(String timeStamp)Returns the epoch value of an input time stampabstract StringgetName()Returns the name of the atomic Allen's temporal mapper.abstract TreeMap<String,Set<String>>getPredecessorEvents(ACache source, ACache target, String expression)Returns the set of predecessor target events for each source instance.protected static TreeMap<String,Set<String>>mapConcurrent(TreeMap<Long,Set<String>> sources, TreeMap<Long,Set<String>> targets)Maps each source event to its set of concurrent target events.protected static TreeMap<String,Set<String>>mapPredecessor(TreeMap<Long,Set<String>> sources, TreeMap<Long,Set<String>> targets)Maps each source event to its set of predecessor target events.protected static TreeMap<Long,Set<String>>orderByBeginDate(ACache cache, String expression, String kbType)Orders a cache of instances based on their begin date property.protected static TreeMap<Long,Set<String>>orderByEndDate(ACache cache, String expression, String kbType)Orders a cache of instances based on their end date property.
-
-
-
Method Detail
-
getBeginProperty
protected static String getBeginProperty(String expression)
Extract first property (beginDate) from metric expression.- Parameters:
expression- , The metric expression- Returns:
- first property of metric expression as string
-
getEndProperty
protected static String getEndProperty(String expression) throws IllegalArgumentException
Extract second property (endDate) from metric expression.- Parameters:
expression- , The metric expression- Returns:
- first property of metric expression as string
- Throws:
IllegalArgumentException- if endDate property is not declared
-
getEpoch
protected static long getEpoch(String timeStamp)
Returns the epoch value of an input time stamp- Parameters:
timeStamp- , the time stamp- Returns:
- the epoch value of the corresponding time stamp
-
orderByBeginDate
protected static TreeMap<Long,Set<String>> orderByBeginDate(ACache cache, String expression, String kbType)
Orders a cache of instances based on their begin date property. For each instance, it retrieves its begin date property, converts its value to an epoch (string) using the SimpleDateFormat function and places the instance inside the corresponding set("bucket") of instances.- Parameters:
cache- , The cache of instancesexpression- , The metric expressionkbType- , source or target- Returns:
- blocks, a map of sets with unique begin dates as keys and set of instances (string representation) as values
-
orderByEndDate
protected static TreeMap<Long,Set<String>> orderByEndDate(ACache cache, String expression, String kbType)
Orders a cache of instances based on their end date property. For each instance, it retrieves its end date property, converts its value to an epoch (string) using the SimpleDateFormat function and places the instance inside the corresponding set("bucket") of instances.- Parameters:
kbType- TODOcache- , The cache of instancesexpression- , The metric expressionkbType- , source or target- Returns:
- blocks, a map of sets with unique end dates as keys and set of instances (string representation) as values
-
mapConcurrent
protected static TreeMap<String,Set<String>> mapConcurrent(TreeMap<Long,Set<String>> sources, TreeMap<Long,Set<String>> targets)
Maps each source event to its set of concurrent target events.- Parameters:
sources- , The set of source instances ordered by begin/end datetargets- , The set of target instances ordered by begin/end date- Returns:
- concurrentEvents, the map of concurrent events
-
mapPredecessor
protected static TreeMap<String,Set<String>> mapPredecessor(TreeMap<Long,Set<String>> sources, TreeMap<Long,Set<String>> targets)
Maps each source event to its set of predecessor target events.- Parameters:
sources- , The set of source instances ordered by begin/end datetargets- , The set of target instances ordered by begin/end date- Returns:
- concurrentEvents, the map of predecessor events
-
getConcurrentEvents
public abstract TreeMap<String,Set<String>> getConcurrentEvents(ACache source, ACache target, String expression)
Returns the set of concurrent target events for each source instance.- Parameters:
source- , The source cachetarget- , The target cacheexpression- , The metric expression- Returns:
- concurrentEvents, set of concurrent target events for each source instance.
-
getPredecessorEvents
public abstract TreeMap<String,Set<String>> getPredecessorEvents(ACache source, ACache target, String expression)
Returns the set of predecessor target events for each source instance.- Parameters:
source- , The source cachetarget- , The target cacheexpression- , The metric expression- Returns:
- predecessorEvents, set of predecessor target events for each source instance.
-
getName
public abstract String getName()
Returns the name of the atomic Allen's temporal mapper.- Returns:
- Mapper name as a string
-
-