java - Writting SQL command to traverse Vertex on Edges conditions -
imagine following schema
let's each edge of type "manage" attribute "permissions" set "rw" or "r-" or "--" , each vertex of type account.
here, account 3 not able write in account 5, since account 1 able write in account 3, want account 1 able write in account 5.
what want java function able check if connected user (account 1) able write in account given parameter. have check if first edge on way go to-be-modified-account has write permission. (hope that's clear)
i think work have recursive function, i'd find way sql command.
i thinking use "$depth" keyword like
select (traverse out('manage') #1 while $depth <= 1) @class='account'
i need had "where permissions='rw'" somewhere, not find how edge instance this.
and once condition have been implemented first outgoing edge, need continue traversing edges, without condition anymore.
may not possible do, please let me know
and tell me if not clear enough
thank !
create class account extends v create class manage extends e create property manage.permissions string create vertex account set name = 'dummy' #12:0 create vertex account set name = 'account1' #12:1 create vertex account set name = 'account2' #12:2 create vertex account set name = 'account3' #12:3 create vertex account set name = 'account4' #12:4 create vertex account set name = 'account5' #12:5 create edge manage #12:1 #12:2 set permissions = "r-" create edge manage #12:2 #12:4 set permissions = "rw" create edge manage #12:1 #12:3 set permissions = "rw" create edge manage #12:3 #12:5 set permissions = "r-"
i believe situation described above. can:
traverse out('manage') ( select expand(oute('manage')[permissions='rw'].in) #12:1 )
this returns accounts #12:1 has rw permission.
Comments
Post a Comment