Record Class IngestResult

java.lang.Object
java.lang.Record
ai.chatur.cortex.IngestResult
Record Components:
valid - whether the assertions pass the lint check against the ontology and conform to the configured SHACL shapes
branch - the name of the branch the assertions were staged on, or null if validation failed or every assertion was already approved and nothing remained to stage
errors - the lint violations or the SHACL validation report, or null if validation passed

public record IngestResult(boolean valid, String branch, String errors) extends Record
The outcome of ingesting assertions into the knowledge graph.

Exactly three combinations of the two nullable components occur: valid=true, branch!=null when at least one novel statement was staged for review; valid=true, branch=null when validation passed but every assertion already existed in the graph, so nothing was staged; and valid=false, errors!=null when validation failed. branch == null is therefore ambiguous on its own between "validation failed" and "nothing novel to stage" — always read it together with valid. No type here enforces this; a sealed interface with one case per outcome would, at the cost of a larger API surface for callers to switch over.

  • Constructor Summary

    Constructors
    Constructor
    Description
    IngestResult(boolean valid, String branch, String errors)
    Creates an instance of a IngestResult record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the branch record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the errors record component.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.
    boolean
    Returns the value of the valid record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • IngestResult

      public IngestResult(boolean valid, String branch, String errors)
      Creates an instance of a IngestResult record class.
      Parameters:
      valid - the value for the valid record component
      branch - the value for the branch record component
      errors - the value for the errors record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • valid

      public boolean valid()
      Returns the value of the valid record component.
      Returns:
      the value of the valid record component
    • branch

      public String branch()
      Returns the value of the branch record component.
      Returns:
      the value of the branch record component
    • errors

      public String errors()
      Returns the value of the errors record component.
      Returns:
      the value of the errors record component