Package org.aksw.jenax.arq.util.expr
Class DnfUtils
java.lang.Object
org.aksw.jenax.arq.util.expr.DnfUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddConstantConstraint(Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.NodeValue> map, Map.Entry<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.NodeValue> constraint) static voidaddConstantConstraint(Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.NodeValue> map, org.apache.jena.sparql.core.Var var, org.apache.jena.sparql.expr.NodeValue nodeValue) static org.apache.jena.sparql.expr.ExprandifyLeftSided(org.apache.jena.sparql.expr.ExprList exprs) Concatenates the sub exressions using Logical_And and(and(and(0, 1), 2, 3)static voidcollectAnd(org.apache.jena.sparql.expr.Expr expr, org.apache.jena.sparql.expr.ExprList list) static voidstatic booleancontainsDirectFuncChild(org.apache.jena.sparql.expr.Expr expr, Class<?> clazz) static List<org.apache.jena.sparql.expr.ExprList>dnfToClauses(Iterable<org.apache.jena.sparql.expr.Expr> exprs) This method only words if the input expressions are in DNF, otherwise you will likely get junk back.static org.apache.jena.sparql.expr.Exprstatic org.apache.jena.sparql.expr.Expreval(org.apache.jena.sparql.expr.Expr expr) static org.apache.jena.sparql.expr.ExprListeval(org.apache.jena.sparql.expr.ExprList exprs) static Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.expr.NodeValue> extractCommonConstantConstraints(Set<Set<org.apache.jena.sparql.expr.Expr>> dnf) For each clause determine the constant constraints, and return those, that are common to all clauses.extractConstantConstraints(Collection<? extends Collection<? extends org.apache.jena.sparql.expr.Expr>> dnf) static Set<org.apache.jena.sparql.core.Var>fixedVars(org.apache.jena.sparql.expr.Expr expr) Similar to OpVars.fixedVars - but analyzes a boolean expression.static Set<org.apache.jena.sparql.core.Var>fixedVarsClause(Iterable<? extends org.apache.jena.sparql.expr.Expr> clause) Return a set of fixed variables in the given clause.static org.apache.jena.sparql.expr.Exprhandle(org.apache.jena.sparql.expr.ExprFunction expr) static booleanisSatisfiable(Set<Set<org.apache.jena.sparql.expr.Expr>> dnf) static List<org.apache.jena.sparql.expr.ExprList>toClauses(org.apache.jena.sparql.expr.Expr expr) static List<org.apache.jena.sparql.expr.ExprList>toClauses(org.apache.jena.sparql.expr.ExprList exprs) static org.apache.jena.sparql.expr.ExprtoListDnf(org.apache.jena.sparql.expr.ExprList exprs) toSetDnf(org.apache.jena.sparql.expr.Expr expr) toSetDnf(org.apache.jena.sparql.expr.ExprList exprs) toSetDnf(org.apache.jena.sparql.expr.Expr expr, boolean allowEmptyClauseInsteadOfNull)
-
Constructor Details
-
DnfUtils
public DnfUtils()
-
-
Method Details
-
fixedVars
Similar to OpVars.fixedVars - but analyzes a boolean expression. Returns the set of variables that must be bound for the expression to be satisfiable. Internally converts the expression to a CNF and checks for which variables are required in all clauses. A variable is not required if it is used in - !bound(?x) - coalesce(?x) - does not appear in a clause at all. -
fixedVarsClause
public static Set<org.apache.jena.sparql.core.Var> fixedVarsClause(Iterable<? extends org.apache.jena.sparql.expr.Expr> clause) Return a set of fixed variables in the given clause. Best effort approach: If any expression in the clause contains !bound or coalesce then all mentioned variables are considered non-fixed. Any variable x appearing in coalesce(x) or !bound(x) is not considered fixed. Assumes the input is a clause of a DNF. -
toExpr
-
addConstantConstraint
-
addConstantConstraint
public static void addConstantConstraint(Map<org.apache.jena.sparql.core.Var, org.apache.jena.sparql.expr.NodeValue> map, org.apache.jena.sparql.core.Var var, org.apache.jena.sparql.expr.NodeValue nodeValue) -
extractConstantConstraints
public static Set<Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.expr.NodeValue>> extractConstantConstraints(Collection<? extends Collection<? extends org.apache.jena.sparql.expr.Expr>> dnf) -
extractCommonConstantConstraints
public static Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.expr.NodeValue> extractCommonConstantConstraints(Set<Set<org.apache.jena.sparql.expr.Expr>> dnf) For each clause determine the constant constraints, and return those, that are common to all clauses.- Parameters:
dnf-
-
toSetDnf
-
toSetDnf
-
toSetDnf
-
toListDnf
-
isSatisfiable
-
dnfToExpr
-
andifyLeftSided
public static org.apache.jena.sparql.expr.Expr andifyLeftSided(org.apache.jena.sparql.expr.ExprList exprs) Concatenates the sub exressions using Logical_And and(and(and(0, 1), 2, 3)- Parameters:
exprs-- Returns:
-
toClauses
public static List<org.apache.jena.sparql.expr.ExprList> toClauses(org.apache.jena.sparql.expr.Expr expr) -
toClauses
public static List<org.apache.jena.sparql.expr.ExprList> toClauses(org.apache.jena.sparql.expr.ExprList exprs) -
dnfToClauses
public static List<org.apache.jena.sparql.expr.ExprList> dnfToClauses(Iterable<org.apache.jena.sparql.expr.Expr> exprs) This method only words if the input expressions are in DNF, otherwise you will likely get junk back.- Parameters:
exprs-- Returns:
-
collectAnd
public static void collectAnd(org.apache.jena.sparql.expr.Expr expr, org.apache.jena.sparql.expr.ExprList list) -
collectOr
public static void collectOr(org.apache.jena.sparql.expr.Expr expr, List<org.apache.jena.sparql.expr.ExprList> list) -
eval
public static org.apache.jena.sparql.expr.ExprList eval(org.apache.jena.sparql.expr.ExprList exprs) -
eval
public static org.apache.jena.sparql.expr.Expr eval(org.apache.jena.sparql.expr.Expr expr) -
containsDirectFuncChild
public static boolean containsDirectFuncChild(org.apache.jena.sparql.expr.Expr expr, Class<?> clazz) -
handle
public static org.apache.jena.sparql.expr.Expr handle(org.apache.jena.sparql.expr.ExprFunction expr)
-