Class GraphValidation

java.lang.Object
org.apache.jena.shacl.GraphValidation

public class GraphValidation extends Object
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 Details

    • GraphValidation

      public GraphValidation()
  • Method Details