Class Neo4jConditionEvaluator

java.lang.Object
org.evomaster.client.java.controller.neo4j.heuristics.Neo4jConditionEvaluator

public class Neo4jConditionEvaluator extends Object
Evaluates the truthness ρ(condition, m) of a single CypherCondition under a structural mapping m, recursively over the typed boolean tree the parser produces (And/Or/Xor/Not, comparisons, label/type/property leaves).

A condition that cannot be valuated under the mapping (an absent property, an unbound variable, an opaque/raw operand) scores UNVALUATABLE rather than null: a low but non-zero ofTrue that still takes part in the aggregation. Never returns null.

  • Field Details

    • UNVALUATABLE

      public static final org.evomaster.client.java.distance.heuristics.Truthness UNVALUATABLE
      Score of a condition that cannot be valuated under the mapping. It is aggregated like any other score, so such a condition lowers the result without hiding the gradient of its siblings.

      Compared by identity, so that NOT can propagate it instead of inverting its low ofTrue into a near-true score.

  • Constructor Details

    • Neo4jConditionEvaluator

      public Neo4jConditionEvaluator()
    • Neo4jConditionEvaluator

      public Neo4jConditionEvaluator(org.evomaster.client.java.sql.internal.TaintHandler taintHandler)
  • Method Details

    • evaluateCondition

      public org.evomaster.client.java.distance.heuristics.Truthness evaluateCondition(CypherCondition condition, Neo4jMapping mapping)
      Returns ρ(condition, mapping), never null: a condition that cannot be valuated (an absent property, an unbound variable, an opaque RawCondition) scores UNVALUATABLE. Dispatch is done with a CypherConditionVisitor so every condition type is handled explicitly: there is no instanceof chain and no silent fall-through for an unhandled type.
    • stringEqualityTruthness

      public static org.evomaster.client.java.distance.heuristics.Truthness stringEqualityTruthness(String a, String b)
      Direct string equality truthness: TRUE when the strings are equal, otherwise ofTrue is the left-alignment edit distance scaled from base C (so it never drops below C) and ofFalse = 1. Used where a string is compared for equality on its own: relationship types and string-valued property/WHERE equality.

      Both arguments must be non-null: this is only reached with two resolved strings (a relationship type, or two string values already confirmed present by equalityTruthness(java.lang.Object, java.lang.Object)). A Cypher null literal never reaches here, since it is handled one level up by equalityTruthness(java.lang.Object, java.lang.Object).

    • stringSimilarityTruthness

      public static org.evomaster.client.java.distance.heuristics.Truthness stringSimilarityTruthness(String a, String b)
      Un-based string similarity (ofTrue = 1 - normalize(distance)), used only as the per-label score inside labelInSet(java.lang.String, java.util.Set<java.lang.String>), which then re-bases the best of them with scaleTrue(C, ...). Kept separate from stringEqualityTruthness(java.lang.String, java.lang.String) so the base C is applied exactly once on the label path (applying it here as well would double-count it).
    • labelInSet

      public static org.evomaster.client.java.distance.heuristics.Truthness labelInSet(String label, Set<String> labels)
      label_in_set(L, labels): TRUE if the exact label is present; FALSE if the element has no labels; otherwise the best per-label string similarity scaled from base C.
    • getStartsWith

      public static org.evomaster.client.java.distance.heuristics.Truthness getStartsWith(String str, String prefix)
    • getEndsWith

      public static org.evomaster.client.java.distance.heuristics.Truthness getEndsWith(String str, String suffix)
    • getContains

      public static org.evomaster.client.java.distance.heuristics.Truthness getContains(String str, String substring)