Class RuleUtil


  • public class RuleUtil
    extends Object
    Convenience methods to execute SHACL rules.
    Author:
    Holger Knublauch
    • Constructor Detail

      • RuleUtil

        public RuleUtil()
    • Method Detail

      • executeRules

        public static org.apache.jena.rdf.model.Model executeRules​(org.apache.jena.rdf.model.Model dataModel,
                                                                   org.apache.jena.rdf.model.Model shapesModel,
                                                                   org.apache.jena.rdf.model.Model inferencesModel,
                                                                   ProgressMonitor monitor)
        Executes all rules from a given shapes Model on a given data Model. If the shapesModel does not include the system graph triples then these will be added. If inferencesModel is not null then it must be part of the dataModel (e.g. a sub-graph) of a Jena MultiUnion object. Otherwise, the function will create a new inferences Model which is merged with the dataModel for the duration of the execution.
        Parameters:
        dataModel - the data Model
        shapesModel - the shapes Model
        inferencesModel - the Model for the inferred triples or null
        monitor - an optional progress monitor
        Returns:
        the Model of inferred triples (i.e. inferencesModel if not null, or a new Model)
      • executeRules

        public static org.apache.jena.rdf.model.Model executeRules​(org.apache.jena.rdf.model.RDFNode focusNode,
                                                                   org.apache.jena.rdf.model.Model shapesModel,
                                                                   org.apache.jena.rdf.model.Model inferencesModel,
                                                                   ProgressMonitor monitor)
        Executes all rules from a given shapes Model on a given focus node (in its data Model). This only executes the rules from the shapes that have the focus node in their target. If the shapesModel does not include the system graph triples then these will be added. If inferencesModel is not null then it must be part of the dataModel (e.g. a sub-graph) of a Jena MultiUnion object. Otherwise, the function will create a new inferences Model which is merged with the dataModel for the duration of the execution.
        Parameters:
        focusNode - the focus node in the data Model
        shapesModel - the shapes Model
        inferencesModel - the Model for the inferred triples or null
        monitor - an optional progress monitor
        Returns:
        the Model of inferred triples (i.e. inferencesModel if not null, or a new Model)
      • getShapesWithTargetNode

        public static List<Shape> getShapesWithTargetNode​(org.apache.jena.rdf.model.RDFNode focusNode,
                                                          ShapesGraph shapesGraph)