Package org.apache.jena.shacl
Class GraphValidation
- java.lang.Object
-
- org.apache.jena.shacl.GraphValidation
-
public class GraphValidation extends java.lang.ObjectOperations 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 Constructor Description GraphValidation()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ValidationReportupdate(Shapes shapes, Graph data, java.lang.Runnable update)Update the graph.static ValidationReportupdateAndReport(Shapes shapes, Graph data, java.lang.Runnable update)Update the graph.
-
-
-
Method Detail
-
updateAndReport
public static ValidationReport updateAndReport(Shapes shapes, Graph data, java.lang.Runnable update)
Update the graph. This operation aborts and throws aShaclValidationExceptionif there are any validation results from shapes (of any severity). If the update results in a valid graph, return without exception (with aValidationReportwithValidationReport.conformsreturning true).
-
update
public static ValidationReport update(Shapes shapes, Graph data, java.lang.Runnable update) throws ShaclValidationException
Update the graph. This operation aborts and throws aShaclValidationExceptionif there are any validation results from shapes (of any severity). If the update results in a valid graph, return without exception (with aValidationReportwithValidationReport.conformsreturning true).- Throws:
ShaclValidationException
-
-