Search in sources :

Example 1 with BuildElementVisitor

use of org.apache.jena.arq.querybuilder.rewriters.BuildElementVisitor in project jena by apache.

the class WhereQuadHolder method build.

/**
 * @return Build the whereClause and return the element.
 */
public Element build() {
    /*
         * cleanup union-of-one and other similar issues.
         */
    BuildElementVisitor visitor = new BuildElementVisitor();
    whereClause.visit(visitor);
    return whereClause;
}
Also used : BuildElementVisitor(org.apache.jena.arq.querybuilder.rewriters.BuildElementVisitor)

Example 2 with BuildElementVisitor

use of org.apache.jena.arq.querybuilder.rewriters.BuildElementVisitor in project jena by apache.

the class WhereHandler method build.

@Override
public void build() {
    /*
         * cleanup union-of-one and other similar issues.
         */
    BuildElementVisitor visitor = new BuildElementVisitor();
    getElement().visit(visitor);
    if (!valuesHandler.isEmpty()) {
        if (visitor.getResult() instanceof ElementGroup) {
            ((ElementGroup) visitor.getResult()).addElement(valuesHandler.asElement());
            ;
        } else {
            ElementGroup eg = new ElementGroup();
            eg.addElement(visitor.getResult());
            eg.addElement(valuesHandler.asElement());
            visitor.setResult(eg);
        }
    }
    query.setQueryPattern(visitor.getResult());
}
Also used : BuildElementVisitor(org.apache.jena.arq.querybuilder.rewriters.BuildElementVisitor) ElementGroup(org.apache.jena.sparql.syntax.ElementGroup)

Aggregations

BuildElementVisitor (org.apache.jena.arq.querybuilder.rewriters.BuildElementVisitor)2 ElementGroup (org.apache.jena.sparql.syntax.ElementGroup)1