Class 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 Detail

      • RuleEngine

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

      • 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
      • getInferencesModel

        public org.apache.jena.rdf.model.Model getInferencesModel()
      • 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)