Record Class BranchChange

java.lang.Object
java.lang.Record
ai.chatur.cortex.BranchChange
Record Components:
subject - the full subject IRI
predicate - the full predicate IRI, or the prefixed short form when adding a statement
object - the current object — the full IRI of a resource, or the lexical form of a literal — or null when adding a statement
literal - whether the object is a literal
datatype - the datatype IRI of a literal object, or null for a resource
language - the language tag of a language-tagged literal object, or null for a resource or a literal without one
newObject - the replacement object, or null to delete the statement
retracted - whether the change addresses a statement the branch stages for removal rather than one it stages for addition; only meaningful for CortexBranches.updateBranch(java.lang.String, java.util.List<ai.chatur.cortex.BranchChange>), and only as a deletion — a staged retraction can be cancelled but not edited

public record BranchChange(String subject, String predicate, String object, boolean literal, String datatype, String language, String newObject, boolean retracted) extends Record
A reviewer's change to a single statement: a deletion, an edit replacing the object, or an addition.

object and newObject between them say which of the three it is. object names the statement as it stands and newObject the statement to put in its place, so a null on either side means that side does not exist:

  • both non-null — replace the object of the statement,
  • newObject == null — delete the statement,
  • object == null — add the statement; there is nothing to replace.

The same record describes an edit to a statement staged on a branch, applied by CortexBranches.updateBranch(java.lang.String, java.util.List<ai.chatur.cortex.BranchChange>), and a proposed edit to an already-approved statement, staged for review by CortexIngestor.revise(ai.chatur.cortex.ResourceEdit).

  • Constructor Details

    • BranchChange

      public BranchChange(String subject, String predicate, String object, boolean literal, String datatype, String language, String newObject, boolean retracted)
      Creates an instance of a BranchChange record class.
      Parameters:
      subject - the value for the subject record component
      predicate - the value for the predicate record component
      object - the value for the object record component
      literal - the value for the literal record component
      datatype - the value for the datatype record component
      language - the value for the language record component
      newObject - the value for the newObject record component
      retracted - the value for the retracted 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.
    • subject

      public String subject()
      Returns the value of the subject record component.
      Returns:
      the value of the subject record component
    • predicate

      public String predicate()
      Returns the value of the predicate record component.
      Returns:
      the value of the predicate record component
    • object

      public String object()
      Returns the value of the object record component.
      Returns:
      the value of the object record component
    • literal

      public boolean literal()
      Returns the value of the literal record component.
      Returns:
      the value of the literal record component
    • datatype

      public String datatype()
      Returns the value of the datatype record component.
      Returns:
      the value of the datatype record component
    • language

      public String language()
      Returns the value of the language record component.
      Returns:
      the value of the language record component
    • newObject

      public String newObject()
      Returns the value of the newObject record component.
      Returns:
      the value of the newObject record component
    • retracted

      public boolean retracted()
      Returns the value of the retracted record component.
      Returns:
      the value of the retracted record component