Skip to main content

Common queries

Cypher queries for exploring the directory. Replace the parameters with your own values.

Members​

By login:

MATCH (u:User {login: $login})
RETURN u.id as id, u.login as login, u.lastName as lastName, u.email as email, u.structures as structures

By identifier:

MATCH (u:User {id: $userId})
RETURN u

By last name:

MATCH (u:User {lastName: $lastName})
RETURN u

By profile, one of Student, Relative, Teacher or Personnel:

MATCH (u:User)-[:IN]->(g:Group {filter: $profile})
RETURN u

With profile groups, organizations, classes, functions and children:

MATCH (u:User {id: $userId})
WHERE u.login IS NOT NULL
OPTIONAL MATCH (u)-[:IN]->(gp:ProfileGroup)
OPTIONAL MATCH (gp)-[:DEPENDS]->(s:Structure)
OPTIONAL MATCH (gp)-[:DEPENDS]->(c:Class)
OPTIONAL MATCH (u)-[rf:HAS_FUNCTION]->(f:Function)
OPTIONAL MATCH (u)<-[:RELATED]-(child:User)
RETURN DISTINCT u, gp, s, c, f, child

Groups​

By identifier:

MATCH (g:Group {id: $groupId})
RETURN g

A profile group by name:

MATCH (p:ProfileGroup {name: $groupName}) RETURN p;

Number of groups:

MATCH (g:Group)
RETURN count(g) as count

A profile group with everything linked to it:

MATCH (p:ProfileGroup {name: $groupName})-[r]-(other)
RETURN p, r, other;

Functions​

Members who hold a function, one of AdminLocal, SuperAdmin or ClassAdmin:

MATCH (u:User)-[:HAS_FUNCTION]->(f:Function)
WHERE f.name = $function
RETURN u.id AS userId, u.login AS login, f.name AS functionName