com.clarkparsia.stardog.icv
Interface ICValidator

All Known Subinterfaces:
ICVConnection

public interface ICValidator

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:
0.8
Author:
Michael Grove

Method Summary
 void addConstraint(Constraint... theConstraint)
          Add the specified integrity constraint(s) to the database.
 IO addConstraints()
          Return an IO which can add a constraint ontology specified in RDF to the database.
 void clearConstraints()
          Remove all IC's defined for this database
 String convertConstraint(Collection<URI> theActiveGraphs, Constraint theConstraint)
          Returns the SPARQL query representation for this constraint over the given named graphs.
 String convertConstraint(Constraint theConstraint)
          Returns the SPARQL query representation for the given constraint.
 Set<Constraint> getConstraints()
          Return all of the constraints in the database
 Iteration<ConstraintViolation<BindingSet>,StardogException> getViolationBindings(Collection<URI> theActiveGraphs, Constraint... theConstraints)
          Returns the violations for the given integrity constraints in the specified set of named graphs as binding sets.
 Iteration<ConstraintViolation<BindingSet>,StardogException> getViolationBindings(Constraint... theConstraints)
          Returns the violations for the given integrity constraints in the whole database as binding sets.
 boolean isValid(Collection<URI> theActiveGraphs, Constraint... theConstraints)
          Returns true if the given integrity constraints are violated in the specified set of named graphs.
 boolean isValid(Constraint... theConstraints)
          Returns true if the given integrity constraints are violated in the database.
 void removeConstraint(Constraint... theConstraint)
          Remove the specified integrity constraint(s) from the database
 IO removeConstraints()
          Return a IO which can be used to remove constraints specified in RDF from the database.
 

Method Detail

addConstraints

IO addConstraints()
                  throws StardogException
Return an IO which can add a constraint ontology specified in RDF to the database. Specifying the context in the IO object has no effect, you cannot put the integrity constraints into a specific named graph in the database.

Returns:
an IO to use for adding the constraints
Throws:
StardogException - a handle to IO could not be obtained to add constraints

addConstraint

void addConstraint(Constraint... theConstraint)
                   throws StardogException
Add the specified integrity constraint(s) to the database.

Parameters:
theConstraint - the IC(s) to add
Throws:
StardogException - the constraint could not be added

removeConstraints

IO removeConstraints()
                     throws StardogException
Return a IO which can be used to remove constraints specified in RDF from the database. Specifying the context in the IO object has no effect, you cannot remove the integrity constraints from a specific named graph in the database.

Returns:
an IO to use for removing constraints
Throws:
StardogException - a handle to the IO could not be obtained to remove constraints

removeConstraint

void removeConstraint(Constraint... theConstraint)
                      throws StardogException
Remove the specified integrity constraint(s) from the database

Parameters:
theConstraint - the IC(s) to remove
Throws:
StardogException - the constraint could not be removed

isValid

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.ALL 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

boolean isValid(Collection<URI> 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.ALL 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

Iteration<ConstraintViolation<BindingSet>,StardogException> 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.ALL 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

Iteration<ConstraintViolation<BindingSet>,StardogException> getViolationBindings(Collection<URI> 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.ALL 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

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

clearConstraints

void clearConstraints()
                      throws StardogException
Remove all IC's defined for this database

Throws:
StardogException - if there was an error while removing the constraints

convertConstraint

String convertConstraint(Constraint theConstraint)
                         throws StardogException
Returns the SPARQL query representation for the given constraint. Executing the resulting query will return an answer is the constraint is valid and will not return any results if it is violated.

Throws:
StardogException

convertConstraint

String convertConstraint(Collection<URI> theActiveGraphs,
                         Constraint theConstraint)
                         throws StardogException
Returns the SPARQL query representation for this constraint over the given named graphs. Executing the resulting query will return an answer is the constraint is valid for the given named graphs and will not return any results if it is violated.

Throws:
StardogException


Copyright © 2010-2013 Clark & Parsia. All Rights Reserved.