Class RuleEngine

java.lang.Object
org.topbraid.shacl.engine.AbstractEngine
org.topbraid.shacl.rules.RuleEngine
All Implemented Interfaces:
NodeExpressionContext

public class RuleEngine extends AbstractEngine
A SHACL Rules engine with a pluggable architecture for different execution languages including Triple rules, SPARQL rules and JavaScript rules. In preparation for inclusion into SHACL 1.1, this engine also supports sh:values rules, see https://www.topquadrant.com/graphql/values.html and treats sh:defaultValues as inferences.
Author:
Holger Knublauch
  • Constructor Details

    • RuleEngine

      public RuleEngine(org.apache.jena.query.Dataset dataset, URI shapesGraphURI, ShapesGraph shapesGraph, org.apache.jena.rdf.model.Model inferences)
  • Method Details

    • executeAll

      public void executeAll() throws InterruptedException
      Throws:
      InterruptedException
    • executeAllDefaultValues

      public void executeAllDefaultValues() throws InterruptedException
      Throws:
      InterruptedException
    • executeShapes

      public void executeShapes(List<Shape> ruleShapes, org.apache.jena.rdf.model.RDFNode focusNode) throws InterruptedException
      Executes the rules attached to a given list of shapes, either for a dedicated focus node or all target nodes of the shapes.
      Parameters:
      ruleShapes - the shapes to execute
      focusNode - the (optional) focus node or null for all target nodes
      Throws:
      InterruptedException - if the monitor has canceled this
    • executeShape

      public void executeShape(Shape shape, String baseMessage, org.apache.jena.rdf.model.RDFNode focusNode) throws InterruptedException
      Throws:
      InterruptedException
    • getInferencesModel

      public org.apache.jena.rdf.model.Model getInferencesModel()
    • getShapesModel

      public org.apache.jena.rdf.model.Model getShapesModel()
      Overrides:
      getShapesModel in class AbstractEngine
    • infer

      public void infer(org.apache.jena.graph.Triple triple, Rule rule, Shape shape)
    • setExcludeNeverMaterialize

      public void setExcludeNeverMaterialize(boolean value)
      If set to true then all sh:values rules in property shapes marked with dash:neverMaterialize will be skipped.
      Parameters:
      value - the new flag (defaults to false)
    • setExcludeValues

      public void setExcludeValues(boolean value)
      If set to true then all sh:values rules will be skipped.
      Parameters:
      value - the new flag (defaults to false)
    • setProgressMonitor

      public void setProgressMonitor(ProgressMonitor value)
      Overrides:
      setProgressMonitor in class AbstractEngine