Package org.apache.jackrabbit.spi.commons.query

Examples of org.apache.jackrabbit.spi.commons.query.PathQueryNode


                                null, RelationQueryNode.OPERATION_NOT_NULL);
                        node.childrenAccept(this, tmp);
                        if (tmpRelPath == null) {
                            tmpRelPath = new PathBuilder();
                        }
                        PathQueryNode relPath = tmp.getRelativePath();
                        LocationStepQueryNode[] steps = relPath.getPathSteps();
                       
                        tmpRelPath.addLast(steps[steps.length-1].getNameTest());
                    }
                }
                break;
View Full Code Here


                        descendant = loc.getIncludeDescendants();
                        queryNode = loc.getParent();
                        ((NAryQueryNode) queryNode).removeOperand(loc);
                    }
                    if (queryNode.getType() == QueryNode.TYPE_PATH) {
                        PathQueryNode pathNode = (PathQueryNode) queryNode;
                       
                        pathNode.addPathStep(createDerefQueryNode(node, descendant, pathNode));
                    } else if (queryNode.getType() == QueryNode.TYPE_RELATION) {
                        RelationQueryNode relNode = (RelationQueryNode) queryNode;
                        DerefQueryNode deref = createDerefQueryNode(node, descendant, relNode.getRelativePath());
                        relNode.getRelativePath().addPathStep(deref);
                    } else {
View Full Code Here

                    // if we have a predicate attached, the condition acts as
                    // the sub query.

                    // only use descendant axis if path is not //*
                    // otherwise the query for the predicate can be used itself
                    PathQueryNode pathNode = (PathQueryNode) node.getParent();
                    if (pathNode.getPathSteps()[0] != node) {
                        Query subQuery = new DescendantSelfAxisQuery(context, andQuery, false);
                        andQuery = new BooleanQuery();
                        andQuery.add(subQuery, Occur.MUST);
                    }
                } else {
                    // todo this will traverse the whole index, optimize!
                    // only use descendant axis if path is not //*
                    PathQueryNode pathNode = (PathQueryNode) node.getParent();
                    if (pathNode.getPathSteps()[0] != node) {
                        if (node.getIndex() == LocationStepQueryNode.NONE) {
                            context = new DescendantSelfAxisQuery(context, false);
                            andQuery.add(context, Occur.MUST);
                        } else {
                            context = new DescendantSelfAxisQuery(context, true);
View Full Code Here

        return context;
    }

    public Object visit(RelationQueryNode node, Object data) throws RepositoryException {
        PathQueryNode relPath = node.getRelativePath();
        if (relPath == null
                && node.getOperation() != QueryConstants.OPERATION_SIMILAR
                && node.getOperation() != QueryConstants.OPERATION_SPELLCHECK) {
            exceptions.add(new InvalidQueryException("@* not supported in predicate"));
            return data;
        }
        LocationStepQueryNode[] steps = relPath.getPathSteps();
        Name propertyName;
        if (node.getOperation() == QueryConstants.OPERATION_SIMILAR) {
            // this is a bit ugly:
            // use the name of a dummy property because relPath actually
            // references a property. whereas the relPath of the similar
View Full Code Here

                    // if we have a predicate attached, the condition acts as
                    // the sub query.

                    // only use descendant axis if path is not //*
                    // otherwise the query for the predicate can be used itself
                    PathQueryNode pathNode = (PathQueryNode) node.getParent();
                    if (pathNode.getPathSteps()[0] != node) {
                        Query subQuery = new DescendantSelfAxisQuery(context, andQuery, false);
                        andQuery = new BooleanQuery();
                        andQuery.add(subQuery, Occur.MUST);
                    }
                } else {
                    // todo this will traverse the whole index, optimize!
                    // only use descendant axis if path is not //*
                    PathQueryNode pathNode = (PathQueryNode) node.getParent();
                    if (pathNode.getPathSteps()[0] != node) {
                        if (node.getIndex() == LocationStepQueryNode.NONE) {
                            context = new DescendantSelfAxisQuery(context, false);
                            andQuery.add(context, Occur.MUST);
                        } else {
                            context = new DescendantSelfAxisQuery(context, true);
View Full Code Here

        return context;
    }

    public Object visit(RelationQueryNode node, Object data) throws RepositoryException {
        PathQueryNode relPath = node.getRelativePath();
        if (relPath == null
                && node.getOperation() != QueryConstants.OPERATION_SIMILAR
                && node.getOperation() != QueryConstants.OPERATION_SPELLCHECK) {
            exceptions.add(new InvalidQueryException("@* not supported in predicate"));
            return data;
        }
        LocationStepQueryNode[] steps = relPath.getPathSteps();
        Name propertyName = steps[steps.length - 1].getNameTest();
       
        Query query;
        String[] stringValues = new String[1];
        switch (node.getValueType()) {
View Full Code Here

        StringBuffer sb = (StringBuffer) data;
        try {

            StringBuffer propPath = new StringBuffer();
            // only encode if not position function
            PathQueryNode relPath = node.getRelativePath();
            if (relPath == null) {
                propPath.append(".");
            } else if (relPath.getNumOperands() > 0 && relPath.getPathSteps()[0].getNameTest().equals(XPathQueryBuilder.FN_POSITION_FULL)) {
                propPath.append(resolver.getJCRName(XPathQueryBuilder.FN_POSITION_FULL));
            } else {
                visit(relPath, data);
            }
View Full Code Here

                    // if we have a predicate attached, the condition acts as
                    // the sub query.

                    // only use descendant axis if path is not //*
                    // otherwise the query for the predicate can be used itself
                    PathQueryNode pathNode = (PathQueryNode) node.getParent();
                    if (pathNode.getPathSteps()[0] != node) {
                        Query subQuery = new DescendantSelfAxisQuery(context, andQuery, false);
                        andQuery = new BooleanQuery();
                        andQuery.add(subQuery, Occur.MUST);
                    }
                } else {
                    // todo this will traverse the whole index, optimize!
                    // only use descendant axis if path is not //*
                    PathQueryNode pathNode = (PathQueryNode) node.getParent();
                    if (pathNode.getPathSteps()[0] != node) {
                        if (node.getIndex() == LocationStepQueryNode.NONE) {
                            context = new DescendantSelfAxisQuery(context, false);
                            andQuery.add(context, Occur.MUST);
                        } else {
                            context = new DescendantSelfAxisQuery(context, true);
View Full Code Here

                    // if we have a predicate attached, the condition acts as
                    // the sub query.

                    // only use descendant axis if path is not //*
                    // otherwise the query for the predicate can be used itself
                    PathQueryNode pathNode = (PathQueryNode) node.getParent();
                    if (pathNode.getPathSteps()[0] != node) {
                        Query subQuery = new DescendantSelfAxisQuery(context, andQuery, false);
                        andQuery = new BooleanQuery();
                        andQuery.add(subQuery, Occur.MUST);
                    }
                } else {
                    // todo this will traverse the whole index, optimize!
                    // only use descendant axis if path is not //*
                    PathQueryNode pathNode = (PathQueryNode) node.getParent();
                    if (pathNode.getPathSteps()[0] != node) {
                        if (node.getIndex() == LocationStepQueryNode.NONE) {
                            context = new DescendantSelfAxisQuery(context, false);
                            andQuery.add(context, Occur.MUST);
                        } else {
                            context = new DescendantSelfAxisQuery(context, true);
View Full Code Here

                    // if we have a predicate attached, the condition acts as
                    // the sub query.

                    // only use descendant axis if path is not //*
                    // otherwise the query for the predicate can be used itself
                    PathQueryNode pathNode = (PathQueryNode) node.getParent();
                    if (pathNode.getPathSteps()[0] != node) {
                        Query subQuery = new DescendantSelfAxisQuery(context, andQuery, false);
                        andQuery = new BooleanQuery();
                        andQuery.add(subQuery, Occur.MUST);
                    }
                } else {
                    // todo this will traverse the whole index, optimize!
                    // only use descendant axis if path is not //*
                    PathQueryNode pathNode = (PathQueryNode) node.getParent();
                    if (pathNode.getPathSteps()[0] != node) {
                        if (node.getIndex() == LocationStepQueryNode.NONE) {
                            context = new DescendantSelfAxisQuery(context, false);
                            andQuery.add(context, Occur.MUST);
                        } else {
                            context = new DescendantSelfAxisQuery(context, true);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.commons.query.PathQueryNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.