I used OrientDb 2.0-rc1

Followong query leads to OQuerryParsingException with the named parameter 
:item in traverse subquery. When i replace ":item" with "#14:0" the query 
works and the named parameter :principals is recognived

public class AccessQuerryTest extends OrientTestBase {

    String CHECC_ACCESS_QUERY = 
            
            "select eval('$depth * 100 + traversedEdge(-1).priority') as 
prio, traversedEdge(-1).access as access from "
            + "(traverse out('inhAcc'), outE('E_AC') from *:item* ) where 
traversedEdge(-1).in in *:principals*";

    @Test
    public void testAccessQuery() {

        Map<String, Object> params = new HashMap<>();
        params.put("item", "#14:0");
        params.put("principals", Arrays.asList(new ORecordId("#18:0")));

        Map<Integer, Integer> accessMap = new HashMap<>();

        List<Vertex> executeQuerry = executeQuerry(CHECC_ACCESS_QUERY, 
params);
        for (Vertex vertex : executeQuerry) {
            Integer prio = vertex.getProperty("prio");
            Integer access = vertex.getProperty("access");

            accessMap.put(prio, access);
        }
    }

    /**
     * Find vertices by query.
     * 
     * @param domain
     * @param typeName
     * @return
     */
    public List<Vertex> executeQuerry(String query, Map<String, Object> 
params) {

        Iterable<Vertex> vertices = db.command(new OCommandSQL(query)).
execute(params);

        List<Vertex> resultList = new ArrayList<>();
        vertices.forEach(new Consumer<Vertex>() {

            @Override
            public void accept(Vertex t) {
                resultList.add(t);
            }
        });

        return resultList;
    }
}


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to