net.xqhs.graphs.context
Interface ContinuousContextMatchingPlatform

All Superinterfaces:
ContinuousMatchingProcess
All Known Implementing Classes:
CCMImplementation

public interface ContinuousContextMatchingPlatform
extends ContinuousMatchingProcess

The interface is meant to be implemented by classes offering complete, real-time (asynchronous) context matching functionality.

An implementation relies on a principal, context graph, and a set of context patterns. A class using the implementation is able to set notification receivers in case that matches are identified.

Author:
Andrei Olaru

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.xqhs.graphs.context.ContinuousMatchingProcess
ContinuousMatchingProcess.MatchNotificationReceiver
 
Method Summary
 ContinuousContextMatchingPlatform addContextPattern(ContextPattern pattern)
          Adds a context pattern to the set of context patterns, if not already existing.
 ContinuousContextMatchingPlatform addMatchNotificationTarget(ContextPattern pattern, ContinuousMatchingProcess.MatchNotificationReceiver receiver)
          Adds a notification target for matches of the specified pattern.
 ContinuousContextMatchingPlatform removeContextPattern(ContextPattern pattern)
          Removes a pattern from the platform.
 ContinuousContextMatchingPlatform setContextGraph(ContextGraph graph)
          Assigns a new context graph to this implementation.
 ContinuousMatchingProcess startMatchingAgainstAllPatterns(Graph graph, int thresholdK, ContinuousMatchingProcess.MatchNotificationReceiver receiver)
          Creates a new ContinuousMatchingProcess, unrelated to the platform except for the set of patterns, to match all patterns against the specified Graph instance.
 ContinuousMatchingProcess startMatchingAgainstGraph(Graph pattern, int thresholdK, ContinuousMatchingProcess.MatchNotificationReceiver receiver)
          Creates a new ContinuousMatchingProcess, unrelated to the platform except for the current sequence of the Context Graph (not the matching sequence), that matches the context graph against the specified pattern.
 
Methods inherited from interface net.xqhs.graphs.context.ContinuousMatchingProcess
addMatchNotificationTarget, isContinuouslyMatching, removeMatchNotificationTarget, startContinuousMatching, stopContinuousMatching
 

Method Detail

setContextGraph

ContinuousContextMatchingPlatform setContextGraph(ContextGraph graph)
Assigns a new context graph to this implementation. It will also set the time keeper of the graph to the time keeper of the platform.

The platform will begin matching the current set of patterns to the new graph immediately.

Parameters:
graph - - the ContextGraph.
Returns:
the platform itself.

addContextPattern

ContinuousContextMatchingPlatform addContextPattern(ContextPattern pattern)
Adds a context pattern to the set of context patterns, if not already existing.

The pattern will not allow modifications after this method is called (it will be Config.locked().

Matching against the pattern will begin immediately.

Parameters:
pattern - - the GraphPattern to add.
Returns:
the platform itself.

removeContextPattern

ContinuousContextMatchingPlatform removeContextPattern(ContextPattern pattern)
Removes a pattern from the platform.

Parameters:
pattern - - the ContextPattern to remove.
Returns:
the platform itself.

addMatchNotificationTarget

ContinuousContextMatchingPlatform addMatchNotificationTarget(ContextPattern pattern,
                                                             ContinuousMatchingProcess.MatchNotificationReceiver receiver)
Adds a notification target for matches of the specified pattern.

Parameters:
pattern - - the GraphPattern whose new matches will be notified to the receiver.
receiver - - the receiver of notifications.
Returns:
the platform itself.

startMatchingAgainstAllPatterns

ContinuousMatchingProcess startMatchingAgainstAllPatterns(Graph graph,
                                                          int thresholdK,
                                                          ContinuousMatchingProcess.MatchNotificationReceiver receiver)
Creates a new ContinuousMatchingProcess, unrelated to the platform except for the set of patterns, to match all patterns against the specified Graph instance.

The matching process is started immediately

When matches of any k below or equal to the specified threshold are detected, the notification receiver is invoked.

Parameters:
graph - - the graph to match the patterns against.
thresholdK - - the threshold k (see Match).
receiver - - the receiver for match notifications.
Returns:
the newly created and started ContinuousMatchingProcess instance.

startMatchingAgainstGraph

ContinuousMatchingProcess startMatchingAgainstGraph(Graph pattern,
                                                    int thresholdK,
                                                    ContinuousMatchingProcess.MatchNotificationReceiver receiver)
Creates a new ContinuousMatchingProcess, unrelated to the platform except for the current sequence of the Context Graph (not the matching sequence), that matches the context graph against the specified pattern.

Matching is done against a shadow of the context graph. Any subsequent changes to the context graph will not be visible in the matching process.

Except for the snapshot of the context graph, this method uses no resources of the platform.

The matching process is started immediately.

When matches of any k below or equal to the specified threshold are detected, the notification receiver is invoked.

Parameters:
pattern - - the pattern to match (can be a normal Graph).
thresholdK - - the threshold k (see Match).
receiver - - the receiver for match notifications.
Returns:
the newly created and started ContinuousMatchingProcess instance.