public boolean matches(final Relation relation,final boolean symmetric){
  final Entity sourceEntity=relation.getSource();
  final Entity targetEntity=relation.getTarget();
  final String sourceType=sourceEntity.getTypeName();
  final String targetType=targetEntity.getTypeName();
  final boolean relationType=type.equalsIgnoreCase(relation.getRelationshipType()) && subType.equalsIgnoreCase(relation.getRelationSubType());
  if (!symmetric) {
    return relationType && typesEqual(sourceType,targetType);
  }
 else {
    return relationType && (typesEqual(sourceType,targetType) || typesEqual(targetType,sourceType));
  }
}

public boolean matches ( final Relation relation , final boolean symmetric ) { final Entity sourceEntity = relation . getSource ( ) ; final Entity targetEntity = relation . getTarget ( ) ; final String sourceType = sourceEntity . getTypeName ( ) ; final String targetType = targetEntity . getTypeName ( ) ; final boolean relationType = type . equalsIgnoreCase ( relation . getRelationshipType ( ) ) && subType . equalsIgnoreCase ( relation . getRelationSubType ( ) ) ; if ( ! symmetric ) { return relationType && typesEqual ( sourceType , targetType ) ; } else { return relationType && ( typesEqual ( sourceType , targetType ) || typesEqual ( targetType , sourceType ) ) ; } }
check is the relation provided matches this constraint . no inheritence and matches the full ( not short ) type name .
