Search code examples
databaseorientdbgraph-databases

oriendDB how to access linked data


I have a class projects extend V a class clients extend V and an edge hasInvites extend E.

projects has attributes name etc.

clients, has attribute clientName etc.

hasInvites has attributes dueDate.

The hasInvites edge the in and out have links to the projects and clients classes.

I can query hasInvites like

select * from hasInvites

which give me the correct data

out: (the project that's linked #35:34 and the client that's linked #36:11)
dueDate:  2017-01-01

How can I access the linked data from the projects and clients?

I have tried the expand() function for that does not work. i.e.:

select *, expand(in(projects)) from hasInvites

What i want to get is data like this:

dueDate: 2017-01-01
projectName: Project A (taken from the projects class)
clientName:  client A (taken from the clients class)

In MySQL, I would do a view with a join and access the projectName and the clientName.

How do i access those in orientDB?


Solution

  • In this example :

    • the 'in' is the Vertex 'project' with the params 'projectName'
    • the 'out' is the Vertex 'client' with the params 'clientName'
    • the 'link' is the Edge 'hasInvites' with the params 'dueDate'

    You can do :

    SELECT dueDate, in.projectName, out.clientName From hasInvites
    

    Hope it helps.