Package com.complexible.stardog.icv
Interface ICValidator
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
ICVConnection
- All Known Implementing Classes:
AbstractICVConnection
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 TypeMethodDescriptionvoidclose()Return all of the constraints in the databasedefault StatementIteratorgetValidationReport(Constraint... theConstraints) Returns the SHACL validation report for the given SHACL constraints validated over the whole database.default StatementIteratorgetValidationReport(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 StatementIteratorgetValidationReport(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.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 booleanisValid(Constraint... theConstraints) Returnstrueif the given integrity constraints are violated in the database.default booleanisValid(Collection<IRI> theActiveGraphs, Constraint... theConstraints) Returnstrueif the given integrity constraints are violated in the specified set of named graphs.reporter()Returns a validation reporter that can be used to retrieve the SHACL validation reports.
-
Method Details
-
isValid
Returnstrueif the given integrity constraints are violated in the database. If no constraints are given then all thecurrent constraintsin the database are used. This function is equivalent to callingisValid(Collection, Constraint...)withContextSets.LOCALas 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 Returnstrueif the given integrity constraints are violated in the specified set of named graphs. If no constraints are given then all thecurrent constraintsin the database are used.- Parameters:
theActiveGraphs- the contexts to use in the validation. If the default context is to be used thenContextSets.DEFAULT_ONLYmust be used. If all contexts are to be used, thenContextSets.LOCALmust be usedtheConstraints- 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 thecurrent constraintsin the database are used.This function is equivalent to callinggetViolationBindings(Collection, Constraint...)withContextSets.LOCALas 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 thecurrent constraintsin the database are used.- Parameters:
theActiveGraphs- the contexts to use in the validation. If the default context is to be used thenContextSets.DEFAULT_ONLYmust be used. If all contexts are to be used, thenContextSets.LOCALmust be usedtheConstraints- 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
Returns the SHACL validation report for the given SHACL constraints validated over the whole database. If no constraints are given then all the SHACL constraintsin the databaseare 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 constraintsin the databaseare 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 thenContextSets.DEFAULT_ONLYmust be used. If all contexts are to be used, thenContextSets.LOCALmust be usedtheConstraints- 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 constraintsin the databaseare 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 thenContextSets.DEFAULT_ONLYmust be used. If all contexts are to be used, thenContextSets.LOCALmust be usedtheOptions- 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
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:
closein interfaceAutoCloseable
-