Package com.complexible.stardog.icv

# Interface ICValidator

All Superinterfaces:
  `AutoCloseable`

All Known Subinterfaces:
  `ICVConnection`

All Known Implementing Classes:
  `AbstractICVConnection`

public interface ICValidator extends AutoCloseable

End-user interface for Integrity Constraint Validation support on a Stardog database. This is for users who wish to check validations, view violations, etc. separately from the database management and use of IC's. Particularly, if the user is operating in lax mode in which invalid data is allowed into the database, this can be used to query and find the violations and to otherwise resolve them.

All operations which modify the constraints for a database are atomic.

Since:
  0.7
Version:
  6.0
Author:
  Michael Grove

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `Set<Constraint>`
  `getConstraints()`
  Return all of the constraints in the database
  `default StatementIterator`
  `getValidationReport(Constraint... theConstraints)`
  Returns the SHACL validation report for the given SHACL constraints validated over the whole database.
  `default StatementIterator`
  `getValidationReport(Collection<IRI> theActiveGraphs, Options theOptions, Constraint... theConstraints)`
  Returns the SHACL validation report for the given SHACL constraints in the specified set of named graphs.
  `default StatementIterator`
  `getValidationReport(Collection<IRI> theActiveGraphs, Constraint... theConstraints)`
  Returns the SHACL validation report for the given SHACL constraints in the specified set of named graphs.
  `default CloseableIterator<BindingSet>`
  `getViolationBindings(Constraint... theConstraints)`
  Returns the violations for the given integrity constraints in the whole database as binding sets.
  `CloseableIterator<BindingSet>`
  `getViolationBindings(Collection<IRI> theActiveGraphs, Constraint... theConstraints)`
  Returns the violations for the given integrity constraints in the specified set of named graphs as binding sets.
  `default boolean`
  `isValid(Constraint... theConstraints)`
  Returns `true` if the given integrity constraints are violated in the database.
  `default boolean`
  `isValid(Collection<IRI> theActiveGraphs, Constraint... theConstraints)`
  Returns `true` if the given integrity constraints are violated in the specified set of named graphs.
  `ValidationReporter`
  `reporter()`
  Returns a validation reporter that can be used to retrieve the SHACL validation reports.

- ## Method Details

  - ### isValid

    default boolean isValid(Constraint... theConstraints) throws StardogException
    Returns `true` if the given integrity constraints are violated in the database. If no constraints are given then all the `current constraints` in the database are used. This function is equivalent to calling `isValid(Collection, Constraint...)` with `ContextSets.LOCAL` as the active graphs.
    Parameters:
      `theConstraints` - the constraints to check. If no constraints are given, the defined constraints will be used.
    Returns:
      true if the constraints are violated, false otherwise
    Throws:
      `StardogException` - if there was an error while checking the validity of the data in the database

  - ### isValid

    default boolean isValid(Collection<IRI> theActiveGraphs, Constraint... theConstraints) throws StardogException
    Returns `true` if the given integrity constraints are violated in the specified set of named graphs. If no constraints are given then all the `current constraints` in the database are used.
    Parameters:
      `theActiveGraphs` - the contexts to use in the validation. If the default context is to be used then `ContextSets.DEFAULT_ONLY` must be used. If all contexts are to be used, then `ContextSets.LOCAL` must be used
      `theConstraints` - the constraints to check. If no constraints are given, the defined constraints will be used.
    Returns:
      true if the constraints are violated, false otherwise
    Throws:
      `StardogException` - if there was an error while checking the validity of the data in the database

  - ### getViolationBindings

    default CloseableIterator<BindingSet> getViolationBindings(Constraint... theConstraints) throws StardogException
    Returns the violations for the given integrity constraints in the whole database as binding sets. If no constraints are given then all the `current constraints` in the database are used.This function is equivalent to calling `getViolationBindings(Collection, Constraint...)` with `ContextSets.LOCAL` as the active graphs.
    Parameters:
      `theConstraints` - the constraints to check. If no constraints are given, the defined constraints will be used.
    Returns:
      an iteration over the violations. An empty iteration will be returned if the data is valid
    Throws:
      `StardogException` - if there was an error calculating the violations

  - ### getViolationBindings

    CloseableIterator<BindingSet> getViolationBindings(Collection<IRI> theActiveGraphs, Constraint... theConstraints) throws StardogException
    Returns the violations for the given integrity constraints in the specified set of named graphs as binding sets. If no constraints are given then all the `current constraints` in the database are used.
    Parameters:
      `theActiveGraphs` - the contexts to use in the validation. If the default context is to be used then `ContextSets.DEFAULT_ONLY` must be used. If all contexts are to be used, then `ContextSets.LOCAL` must be used
      `theConstraints` - the constraints to check. If no constraints are given, the current constraints will be used.
    Returns:
      an iteration over the violations. An empty iteration will be returned if the data is valid
    Throws:
      `StardogException` - if there was an error calculating the violations

  - ### getValidationReport

    default StatementIterator getValidationReport(Constraint... theConstraints) throws StardogException
    Returns the SHACL validation report for the given SHACL constraints validated over the whole database. If no constraints are given then all the SHACL constraints `in the database` are used. Non-SHACL constraints are ignored by this function.
    Parameters:
      `theConstraints` - the SHACL constraints to validate. If no constraints are given, the constraints in the database will be used.
    Returns:
      a SHACL validation report as defined in the SHACL specification
    Throws:
      `StardogException` - if there was an error calculating the violations

  - ### getValidationReport

    default StatementIterator getValidationReport(Collection<IRI> theActiveGraphs, Constraint... theConstraints) throws StardogException
    Returns the SHACL validation report for the given SHACL constraints in the specified set of named graphs. If no constraints are given then all the SHACL constraints `in the database` are used. Non-SHACL constraints are ignored by this function.
    Parameters:
      `theActiveGraphs` - the contexts to use in the validation. If the default context is to be used then `ContextSets.DEFAULT_ONLY` must be used. If all contexts are to be used, then `ContextSets.LOCAL` must be used
      `theConstraints` - the SHACL constraints to validate. If no constraints are given, the constraints in the database will be used.
    Returns:
      a SHACL validation report as defined in the SHACL specification
    Throws:
      `StardogException` - if there was an error calculating the violations

  - ### getValidationReport

    default StatementIterator getValidationReport(Collection<IRI> theActiveGraphs, Options theOptions, Constraint... theConstraints) throws StardogException
    Returns the SHACL validation report for the given SHACL constraints in the specified set of named graphs. If no constraints are given then all the SHACL constraints `in the database` are used. Non-SHACL constraints are ignored by this function.
    Parameters:
      `theActiveGraphs` - the contexts to use in the validation. If the default context is to be used then `ContextSets.DEFAULT_ONLY` must be used. If all contexts are to be used, then `ContextSets.LOCAL` must be used
      `theOptions` - the options used to tune the validation process.
      `theConstraints` - the SHACL constraints to validate. If no constraints are given, the constraints in the database will be used.
    Returns:
      a SHACL validation report as defined in the SHACL specification
    Throws:
      `StardogException` - if there was an error calculating the violations

  - ### reporter

    ValidationReporter reporter()
    Returns a validation reporter that can be used to retrieve the SHACL validation reports.
    Returns:
      validation reporter

  - ### getConstraints

    Set<Constraint> getConstraints() throws StardogException
    Return all of the constraints in the database
    Returns:
      the constraints
    Throws:
      `StardogException` - if there was an error obtaining the constraints

  - ### close

    void close()
    Specified by:
      `close` in interface `AutoCloseable`