Class Neo4jHeuristicsCalculator

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

public class Neo4jHeuristicsCalculator extends Object
Computes the search heuristic H(Q, G) of a parsed Cypher MATCH query Q against a captured graph G, returning a Truthness (how close G is to satisfying Q). It works in Truthness end-to-end, reusing the shared TruthnessUtils primitives for the aggregations.

H(Q, G) = andAggregation(H_match(P_s, G), H_where(C_all, matched_elements(P_s, G))), where P_s is the structural pattern and C_all the conditions.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Base value a partial score is scaled from, so that a query that matched nothing still ranks below one that matched something.
    static final double
    Distance reported when a query could not be evaluated at all, so that a failure never looks closer to satisfied than a genuine miss.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    Neo4jHeuristicsCalculator(org.evomaster.client.java.sql.internal.TaintHandler taintHandler)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Converts a heuristic to the distance form: 1 - ofTrue, which lies in [0,1] by construction of Truthness, where 0 means the query is satisfied.
    org.evomaster.client.java.distance.heuristics.Truthness
     
    org.evomaster.client.java.distance.heuristics.Truthness
    computeHeuristicMatchNodes(int required, int available)
    Count-based node availability: enough graph nodes to bind the pattern's nodes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • C

      public static final double C
      Base value a partial score is scaled from, so that a query that matched nothing still ranks below one that matched something. Named C after the constant in Formalizing.md; it is the same value TruthnessUtils.TRUE_TRUTHNESS uses for its ofFalse.
      See Also:
    • MAX_NEO4J_DISTANCE

      public static final double MAX_NEO4J_DISTANCE
      Distance reported when a query could not be evaluated at all, so that a failure never looks closer to satisfied than a genuine miss.
      See Also:
  • Constructor Details

    • Neo4jHeuristicsCalculator

      public Neo4jHeuristicsCalculator()
    • Neo4jHeuristicsCalculator

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

    • computeHeuristic

      public org.evomaster.client.java.distance.heuristics.Truthness computeHeuristic(MatchOperation query, Neo4jGraph graph)
    • computeDistance

      public double computeDistance(MatchOperation query, Neo4jGraph graph)
      Converts a heuristic to the distance form: 1 - ofTrue, which lies in [0,1] by construction of Truthness, where 0 means the query is satisfied.
    • computeHeuristicMatchNodes

      public org.evomaster.client.java.distance.heuristics.Truthness computeHeuristicMatchNodes(int required, int available)
      Count-based node availability: enough graph nodes to bind the pattern's nodes. Pure cardinality, no label/property check (those are conditions evaluated by H_where).