RedisGraph , Cyper query to add tagging and Filter by roles

Viewed 15

I have created a graph in redis graph:

    GRAPH.QUERY g "CREATE (e:Loc{name:'Entry'}), (r:Loc{name:'Washroom1'}), (c:Loc{name:'Corner'}), (x:Loc{name:'Exit'}), (g:Loc{name:'Washroom2'}), (l:Loc{name:'LiftLobby'}), (        e)-[:Way{dist:152}]->(r), (r)-[:Way{dist:176}]->(c), (r)-[:Way{dist:153}]->(x), (c)-[:Way{dist:41}]->(g), (c)-[:Way{dist:176}]->(r), (g)-[:Way{dist:53}]->(l), (        g)-[:Way{dist:41}]->(c), (l)-[:Way{dist:53}]->(g)"

Now i want to write 2 queries not sure if it is possible with this Cypher query language as i am pretty new to this .

  1. If i can tag the points , for Example i want to tag all washrooms ('Washroom1' , 'Washroom2') as Washroom . So that if i try to search for the shortest path somthing like this i should get the nearest washroom .

      GRAPH.QUERY g "MATCH (enew:Loc{name:'Entry'}), (rnew:Loc{name:'Washroom'}) CALL algo.SPpaths( {sourceNode: enew, targetNode: rnew, relTypes: ['Way'], weightProp: 'dist'} )          YIELD path, pathWeight RETURN pathWeight, [n in nodes(path) | n.name] as pathNodes ORDER BY pathWeight"
    
  2. Role based path selection .

If there is a path defined from A to D , one can go through A --> B ---> D or A ---> C ---> D , but only Admin is allowed to use the first path and any visitor should be given the second path as the shortest one as he is not allowed because to his Role .

Can we write one line queries for these , even if we modify the entries it is fine .

0 Answers
Related