java.lang.Object
org.apache.jena.shacl.GraphValidation
Operations to work on graph with SHACL.
Example: update with possible exception:
Shapes shapes = ... try { GraphValidation.updateEx(shapes, graph, ()->{ ... application code ... }); } catch (ShaclValidationException ex) { ShLib.printReport(ex.getReport()); }If validation fails, the transaction is aborted. Example: update with report:
Shapes shapes = ... ValidationReport report = GraphValidation.updateEx(shapes, graph, ()->{ ... application code ... }); if ( ! report.conforms() ) { // Update aborted. ShLib.printReport(report); }Example: update regardless and then report:
Shapes shapes = ... ... graph changes ... ValidationReport report = ShaclValidation.validate(shapes, graph); if ( ! report.conforms() ) { // Changes happened. ShLib.printReport(report); }
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ValidationReport
Update the graph.static ValidationReport
updateAndReport
(Shapes shapes, org.apache.jena.graph.Graph data, Runnable update) Update the graph.
-
Constructor Details
-
GraphValidation
public GraphValidation()
-
-
Method Details
-
updateAndReport
public static ValidationReport updateAndReport(Shapes shapes, org.apache.jena.graph.Graph data, Runnable update) Update the graph. This operation aborts and throws aShaclValidationException
if there are any validation results from shapes (of any severity). If the update results in a valid graph, return without exception (with aValidationReport
withValidationReport.conforms
returning true). -
update
public static ValidationReport update(Shapes shapes, org.apache.jena.graph.Graph data, Runnable update) throws ShaclValidationException Update the graph. This operation aborts and throws aShaclValidationException
if there are any validation results from shapes (of any severity). If the update results in a valid graph, return without exception (with aValidationReport
withValidationReport.conforms
returning true).- Throws:
ShaclValidationException
-