Record Class GraphUpdateChange

java.lang.Object
java.lang.Record
com.complexible.common.rdf.GraphUpdateChange

public record GraphUpdateChange(IRI source, IRI target, boolean clearSource, boolean clearDestination) extends Record

Payload of an IndexChange.UpdateContext change: a graph-level MOVE/COPY/ADD between two named graphs. The source and target are IRIs (SPARQL MOVE/COPY/ADD only names IRIs, and the HTTP replication command carries them as URI parameters). The source() and target() accessors are never null: a null argument is normalized to the default graph (Values.DEFAULT_GRAPH, aka Contexts.DEFAULT), so consumers never have to special-case null. The flags mirror GraphUpdateOp:

  • ADD : clearSource=false, clearDestination=false
  • COPY : clearSource=false, clearDestination=true
  • MOVE : clearSource=true, clearDestination=true

clearSource implies clearDestination; the fourth combination is rejected at construction.

The operation must be deterministically computable from data local to a node, so the source and target must be distinct local named graphs — not the same graph (a self-move would clear the destination and then copy from the now-empty source), and not a virtual graph (federated, external) or a wildcard meta-context. These invariants are enforced at construction so an invalid change can never be carried through a transaction, log record, or replication command.

Since:
12.0
Version:
12.0
Author:
Simon Gratzer
  • Constructor Summary

    Constructors
    Constructor
    Description
    GraphUpdateChange(IRI source, IRI target, boolean clearSource, boolean clearDestination)
    Creates an instance of a GraphUpdateChange record class.
  • Method Summary

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

    Methods inherited from class java.lang.Object

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

    • GraphUpdateChange

      public GraphUpdateChange(IRI source, IRI target, boolean clearSource, boolean clearDestination)
      Creates an instance of a GraphUpdateChange record class.
      Parameters:
      source - the value for the source record component
      target - the value for the target record component
      clearSource - the value for the clearSource record component
      clearDestination - the value for the clearDestination 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.
    • source

      public IRI source()
      Returns the value of the source record component.
      Returns:
      the value of the source record component
    • target

      public IRI target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component
    • clearSource

      public boolean clearSource()
      Returns the value of the clearSource record component.
      Returns:
      the value of the clearSource record component
    • clearDestination

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