/** * Returns true if is a ground term (even if it is not explicitly typed as such). */ public static boolean isGroundTerm(Term term) { if (term instanceof Function) { return ((Function)term).getVariables().isEmpty(); } return term instanceof Constant; }
/** * Returns true if is a ground term (even if it is not explicitly typed as such). */ public static boolean isGroundTerm(Term term) { if (term instanceof ImmutableTerm) return ((ImmutableTerm) term).isGround(); if (term instanceof Function) { return ((Function)term).getVariables().isEmpty(); } return false; }
private ImmutableList<QualifiedAttributeID> getGroupBy(List<Function> body, AliasIndex index) { return body.stream() .filter(a -> a.getFunctionSymbol() == DatalogAlgebraOperatorPredicates.SPARQL_GROUP) .map(a -> a.getVariables()) .flatMap(l -> l.stream()) .map(v -> index.getColumns(v)) .flatMap(l -> l.stream()) .collect(ImmutableCollectors.toList()); }
private String getGroupBy(List<Function> body, QueryAliasIndex index) { StringBuilder result = new StringBuilder(); List<Variable> varsInGroupBy = Lists.newArrayList(); for (Function atom : body) { if (atom.getFunctionSymbol().equals(SPARQL_GROUP)) { varsInGroupBy.addAll(atom.getVariables()); } } List<String> groupReferences = Lists.newArrayList(); for(Variable var : varsInGroupBy) { index.columnReferences.get(var).stream() .map(QualifiedAttributeID::getSQLRendering) .forEach(groupReferences::add); } if(!groupReferences.isEmpty()) { result.append(" GROUP BY " ); Joiner.on(" , ").appendTo(result, groupReferences); } return result.toString(); }
Set<Variable> variables = uriTemplate.getVariables(); if (isNull) { switch (variables.size()) {
Set<Variable> variables = uriTemplate.getVariables(); if (isNull) { switch (variables.size()) {
List<String> varContainer = cqHead.getVariables().stream() .map(Variable::getName) .collect(Collectors.toList());