Table of Contents

Class StatementEquivalence

Namespace
Xapi.Validation
Assembly
Xapi.Core.dll

Decides whether two Statements are the same Statement under the standard's immutability rules, for example when an LRS receives a Statement id it already stores (409 Conflict) or a client checks what it sent.

public static class StatementEquivalence
Inheritance
StatementEquivalence
Inherited Members

Remarks

IEEE 9274.1.1, 4.2 "Statement Immutability" (and 5.2 in the Content book): the Actor (except member order), the Verb (except display), the object and the duration are immutable; case, id, the order of Group members, authority, stored, timestamp, version, attachments and referenced Activity definitions are not considered. xAPI 1.0.3 Data 2.3.1 says the same and adds that differences outside those exceptions must not be ignored, so result and context are compared too.

What this means here:

  • Ignored: id, stored, authority, version, the Statement timestamp, attachments (also inside SubStatements), Verb display, and every Activity definition (object, SubStatement and context Activities).
  • Strings, IRIs, names, identifiers, language tags and extension keys and string values compare ignoring case ("Case (upper vs. lower)" is listed as not considered).
  • Group member lists compare as unordered collections; all other lists keep their order.
  • result.duration compares to 0.01 second (4.2.7 "Duration"); see XapiDuration.
  • A SubStatement's timestamp is part of the object, so it is compared, as a UTC instant at millisecond precision (4.2.7 allows an LRS to keep only 3 fraction digits).
  • Extension values compare deeply (object property order ignored, numbers by value).

Methods

AreEquivalent(Statement, Statement)

Returns whether two Statements are equivalent under the immutability rules described above.

public static bool AreEquivalent(Statement a, Statement b)

Parameters

a Statement

The first Statement.

b Statement

The second Statement.

Returns

bool

true when the Statements are equivalent.