use of org.apache.rya.rdftriplestore.inference.DoNotExpandSP in project incubator-rya by apache.
the class JoinSegment method getJoinArgs.
/**
* @param tupleExpr
* - the query object that will be traversed by this method
* @param joinArgs
* - all nodes connected by Joins and Filters
* @return - List containing all nodes connected by Joins, LeftJoins, and
* Filters. This List contains the
* @param ValueExpr
* in place of the Filter
*/
private List<QueryModelNode> getJoinArgs(TupleExpr tupleExpr, List<QueryModelNode> joinArgs) {
if (tupleExpr instanceof Join) {
if (!(((Join) tupleExpr).getLeftArg() instanceof FixedStatementPattern) && !(((Join) tupleExpr).getRightArg() instanceof DoNotExpandSP)) {
Join join = (Join) tupleExpr;
getJoinArgs(join.getRightArg(), joinArgs);
getJoinArgs(join.getLeftArg(), joinArgs);
}
} else if (tupleExpr instanceof Filter) {
Filter filter = (Filter) tupleExpr;
joinArgs.add(filter.getCondition());
conditionMap.put(filter.getCondition(), filter);
getJoinArgs(filter.getArg(), joinArgs);
} else {
joinArgs.add(tupleExpr);
}
return joinArgs;
}
use of org.apache.rya.rdftriplestore.inference.DoNotExpandSP in project incubator-rya by apache.
the class FlattenedOptional method getJoinArgs.
/**
* This method is used to retrieve a set view of all descendants of the
* rightArg of the LeftJoin (the optional part)
*
* @param tupleExpr
* - tupleExpr whose args are being retrieved
* @param joinArgs
* - set view of all non-join args that are descendants of
* tupleExpr
* @return joinArgs
*/
private Set<TupleExpr> getJoinArgs(TupleExpr tupleExpr, Set<TupleExpr> joinArgs) {
if (tupleExpr instanceof Join) {
if (!(((Join) tupleExpr).getLeftArg() instanceof FixedStatementPattern) && !(((Join) tupleExpr).getRightArg() instanceof DoNotExpandSP)) {
Join join = (Join) tupleExpr;
getJoinArgs(join.getLeftArg(), joinArgs);
getJoinArgs(join.getRightArg(), joinArgs);
}
} else if (tupleExpr instanceof LeftJoin) {
// TODO probably not
// necessary if not
// including leftarg
LeftJoin lj = (LeftJoin) tupleExpr;
joinArgs.add(new FlattenedOptional(lj));
getJoinArgs(lj.getLeftArg(), joinArgs);
} else if (tupleExpr instanceof Filter) {
getJoinArgs(((Filter) tupleExpr).getArg(), joinArgs);
} else {
joinArgs.add(tupleExpr);
}
return joinArgs;
}
use of org.apache.rya.rdftriplestore.inference.DoNotExpandSP in project incubator-rya by apache.
the class OptionalJoinSegment method getJoinArgs.
/**
* @param tupleExpr
* - the query object that will be traversed by this method
* @param joinArgs
* - all nodes connected by Joins, LeftJoins, and Filters
* @return - List containing all nodes connected by Joins, LeftJoins, and
* Filters. This List contains the {@link ValueExpr} in place of the
* Filter and a {@link FlattenedOptional} in place of the LeftJoin
* for ease of comparison with PCJ nodes.
*/
private List<QueryModelNode> getJoinArgs(TupleExpr tupleExpr, List<QueryModelNode> joinArgs) {
if (tupleExpr instanceof Join) {
if (!(((Join) tupleExpr).getLeftArg() instanceof FixedStatementPattern) && !(((Join) tupleExpr).getRightArg() instanceof DoNotExpandSP)) {
Join join = (Join) tupleExpr;
getJoinArgs(join.getRightArg(), joinArgs);
getJoinArgs(join.getLeftArg(), joinArgs);
}
} else if (tupleExpr instanceof LeftJoin) {
LeftJoin lj = (LeftJoin) tupleExpr;
joinArgs.add(new FlattenedOptional(lj));
getJoinArgs(lj.getLeftArg(), joinArgs);
} else if (tupleExpr instanceof Filter) {
Filter filter = (Filter) tupleExpr;
joinArgs.add(filter.getCondition());
conditionMap.put(filter.getCondition(), filter);
getJoinArgs(filter.getArg(), joinArgs);
} else {
joinArgs.add(tupleExpr);
}
return joinArgs;
}
Aggregations