public final class Rule extends Object implements Comparable<Rule>
Constructor and Description 

Rule(org.openrdf.model.URI id,
boolean fixpoint,
int phase,
org.openrdf.query.algebra.TupleExpr deleteExpr,
org.openrdf.query.algebra.TupleExpr insertExpr,
org.openrdf.query.algebra.TupleExpr whereExpr)
Creates a new rule.

Modifier and Type  Method and Description 

int 
compareTo(Rule other)
Rules with the same ID are equal.

boolean 
equals(Object object)
Two rules are equal if they have the same ID.

static int 
evaluate(Iterable<Rule> rules,
QuadModel model,
QuadModel deltaModel,
Supplier<org.openrdf.rio.RDFHandler> deleteSink,
Supplier<org.openrdf.rio.RDFHandler> insertSink) 
void 
evaluate(QuadModel model,
QuadModel deltaModel,
org.openrdf.query.algebra.StatementPattern deltaPattern,
Supplier<org.openrdf.rio.RDFHandler> deleteSink,
Supplier<org.openrdf.rio.RDFHandler> insertSink) 
static List<Rule> 
fromDLOG(Reader reader) 
static List<Rule> 
fromRDF(Iterable<org.openrdf.model.Statement> model)
Parses all the rules contained in the supplied RDF statements.

List<String> 
getCommonVariables()
Returns a sorted list with the variables returned by the WHERE expression that are
referenced either in the DELETE or in the INSERT expressions.

org.openrdf.query.algebra.TupleExpr 
getDeleteExpr()
Returns the optional DELETE expression

Set<org.openrdf.query.algebra.StatementPattern> 
getDeletePatterns()
Returns the statement patterns in the DELETE expression, if any.

org.openrdf.model.URI 
getID()
Returns the rule ID.

org.openrdf.query.algebra.TupleExpr 
getInsertExpr()
Returns the optional INSERT expression

Set<org.openrdf.query.algebra.StatementPattern> 
getInsertPatterns()
Returns the statement patterns in the INSERT expression, if any.

int 
getPhase()
Returns the evaluation phase this rule is associated to.

org.openrdf.query.algebra.TupleExpr 
getWhereExpr()
Returns the optional WHERE expression.

Set<org.openrdf.query.algebra.StatementPattern> 
getWherePatterns()
Returns the statement patterns in the WHERE expression, if any.

int 
hashCode()
The returned hash code depends exclusively on the rule ID.

boolean 
isFixpoint()
Returns true if the rule must be evaluated using a fixpoint semantics

boolean 
isSafe()
Returns true if the rule is safe, i.e., if all the variables referenced in the DELETE and
INSERT expressions are present in the bindings produced by the WHERE expression.

boolean 
isSimple()
Returns true if the rule is simple, i.e., if the WHERE expression consists only of BGPs,
FILTERs (without the EXISTS construct) and outer level BINDs.

boolean 
isSpecific()
Returns true if the rule matches only specific types of statements.

boolean 
isStreamable()
Returns true if the rule can be evaluated in a streaming way.

static List<Rule> 
mergeSameWhereExpr(Iterable<Rule> rules)
Merges rules with the same WHERE expression, priority and fixpoint flag.

boolean 
mightActivate(org.openrdf.query.algebra.evaluation.impl.EvaluationStatistics statistics)
Returns true if the rule may be activated given the dataset statistics supplied.

Rule 
rewriteGlobalGM(org.openrdf.model.URI globalGraph)
Rewrites the rule according to the GLOBAL graph inference mode, using the global graph URI
specified.

Rule 
rewriteSeparateGM()
Rewrites the rule according to the SEPARATE graph inference mode.

Rule 
rewriteStarGM(org.openrdf.model.URI globalGraph)
Rewrites the rule according to the STAR graph inference mode, using the global graph URI
supplied.

Rule 
rewriteVariables(org.openrdf.query.BindingSet bindings)
Rewrites the rule by replacing selected variables with constant values as dictated by the
supplied bindings.

<T extends Collection<? super org.openrdf.model.Statement>> 
toRDF(T output)
Emits the RDF serialization of the rule.

String 
toString()
The returned string has the form
{@code ID (phase: N, fixpoint): DELETE ...

public Rule(org.openrdf.model.URI id, boolean fixpoint, int phase, @Nullable org.openrdf.query.algebra.TupleExpr deleteExpr, @Nullable org.openrdf.query.algebra.TupleExpr insertExpr, @Nullable org.openrdf.query.algebra.TupleExpr whereExpr)
id
 the rule ID, not nullfixpoint
 true, if the rule should be evaluated with a fixpoint semanticsphase
 the evaluation phase associated to this rule (defaults to zero)deleteExpr
 the optional DELETE expression; if present, must be a BGPinsertExpr
 the optional INSERT expression; if present, must be a BGPwhereExpr
 the optional WHERE expression (absent in case of rules asserting axiomatic
quads)public org.openrdf.model.URI getID()
public boolean isFixpoint()
public int getPhase()
@Nullable public org.openrdf.query.algebra.TupleExpr getDeleteExpr()
@Nullable public org.openrdf.query.algebra.TupleExpr getInsertExpr()
@Nullable public org.openrdf.query.algebra.TupleExpr getWhereExpr()
public Set<org.openrdf.query.algebra.StatementPattern> getDeletePatterns()
public Set<org.openrdf.query.algebra.StatementPattern> getInsertPatterns()
public Set<org.openrdf.query.algebra.StatementPattern> getWherePatterns()
public List<String> getCommonVariables()
public boolean isSafe()
rewriteVariables(BindingSet)
).public boolean isSimple()
public boolean isStreamable()
isSimple()
); (ii) its where part contains at most one statement
pattern; and (iii) the delete part is missing or it contains exactly the statement pattern
of the where part (which must be non empty).public boolean isSpecific()
public boolean mightActivate(org.openrdf.query.algebra.evaluation.impl.EvaluationStatistics statistics)
statisitcs
are 0.0 only if no
triple is returned for a certain statement pattern).statistics
 the statistics objectpublic Rule rewriteGlobalGM(@Nullable org.openrdf.model.URI globalGraph)
globalGraph
 the URI of the global graph where to insert new quads; if null, quads will be
inserted in the default graph sesame:nil
public Rule rewriteSeparateGM()
public Rule rewriteStarGM(@Nullable org.openrdf.model.URI globalGraph)
rewriteSeparateGM()
, however
'importing' (as far as matching in the WHERE clause is concerned) also quads in the global
graph; and (iii) in case the WHERE clause is missing or a match is found on quads in the
global graph, deletions and insertions are performed on the global graph itself (this can
be useful to setup the global graph 'before' applying rules on the other graphs)globalGraph
 the URI of the global graph whose quads are 'imported' in other graphs; if null,
the default graph sesame:nil
will be usedpublic Rule rewriteVariables(@Nullable org.openrdf.query.BindingSet bindings)
bindings
 the variable = value bindings to use for the rewriting; if null or empty, no
rewriting will take placepublic static List<Rule> mergeSameWhereExpr(Iterable<Rule> rules)
rules
 the rules to mergepublic void evaluate(QuadModel model, @Nullable QuadModel deltaModel, @Nullable org.openrdf.query.algebra.StatementPattern deltaPattern, @Nullable Supplier<org.openrdf.rio.RDFHandler> deleteSink, @Nullable Supplier<org.openrdf.rio.RDFHandler> insertSink)
public static int evaluate(Iterable<Rule> rules, QuadModel model, @Nullable QuadModel deltaModel, @Nullable Supplier<org.openrdf.rio.RDFHandler> deleteSink, @Nullable Supplier<org.openrdf.rio.RDFHandler> insertSink)
public int compareTo(Rule other)
compareTo
in interface Comparable<Rule>
public boolean equals(Object object)
public int hashCode()
public String toString()
ID (phase: N, fixpoint): DELETE ... INSERT ... WHERE ...
, where the
fixpoint
, DELETE ...
, INSERT ...
and WHERE ...
may be
present or absent based on the properties of the rule.public <T extends Collection<? super org.openrdf.model.Statement>> T toRDF(T output)
output
 the collection where to add emitted RDF statements, not nullpublic static List<Rule> fromDLOG(Reader reader) throws IOException
IOException
Copyright © 2015–2016 FBKirst. All rights reserved.