Interface ICValidator

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Subinterfaces:
    ICVConnection
    All Known Implementing Classes:
    AbstractICVConnection

    public interface ICValidator
    extends java.lang.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 Detail

      • 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​(java.util.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

        CloseableIterator<BindingSet> getViolationBindings​(java.util.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​(java.util.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​(java.util.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

        java.util.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 java.lang.AutoCloseable