org.activemath.content.mediator.rewriter
Class MappingPattern

java.lang.Object
  extended by org.activemath.content.mediator.rewriter.MappingPattern

public class MappingPattern
extends Object

A MappingPattern consist of a MatchingPattern, which should match with a given query and a Set of ReplacementPatterns which are proceeded to the given query. If there are n ReplacementPatterns, applying the MappingPattern to a query will give us n mapped queries. We allow only one RelationRestriction for the MappingPattern, because more than one makes no sense (because we do not know what to do with the different IDs behind the relations). But for the ReplacementPatterns we allow more than one. We need at least one relation-replacement-restriction if we have a matching-relation-restr. And if there is no matching relation restr., we do not allow any replacement relation restriction. Only one PlaceholderPropertyRestriction is allowed for each pattern. A PlaceholderPropertyRestriction looks like "type=*" and matches for each property constraint which specifies the property "type". (In the xml mapping file there is no exp_value specified.) Mind that "a mapping pattern consists of two patterns" and not "a mapping pattern is a special pattern" holds!


Field Summary
protected static boolean DEBUG
           
 
Constructor Summary
MappingPattern(org.jdom.Element patternE)
           
 
Method Summary
 Pattern getMatchingPattern()
           
 Set getReplacementPatterns()
           
 boolean isApplicableTo(KBQuery kbQuery)
          Returns whether the MappingPattern is applicable to the given KBQuery.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

protected static final boolean DEBUG
Constructor Detail

MappingPattern

public MappingPattern(org.jdom.Element patternE)
               throws MappingParseException
Throws:
MappingParseException
Method Detail

isApplicableTo

public boolean isApplicableTo(KBQuery kbQuery)
Returns whether the MappingPattern is applicable to the given KBQuery. This is the case, if the queries classcontraints contains all classes of the patterns class restriction _and_ the same with relation- and property-constraints.

Parameters:
kbQuery - the query to check for
Returns:
whether the mappingpattern is applicable to the given query.

toString

public String toString()
Overrides:
toString in class Object

getMatchingPattern

public Pattern getMatchingPattern()

getReplacementPatterns

public Set getReplacementPatterns()