Daniel Lawry
Daniel Lawry

Reputation: 85

Refining a query by Edge metadata

I currently have two Vertex classes, VersionSet and Version, with one non-lightweight Edge class, VersionSetToVersion. The VersionSetToVersion edge class also has a property called status which can have the value 'latest'.

If I have some @rid of a VersionSet vertex (i.e. #14:1), how would I construct an orient-db style SQL query to retrieve only the Version vertex that has a VersionSetToVersion EDGE with a status of 'latest'?

Here's a query that will return all Versions related to the VersionSet with @rid #14:1 regardless of the status property

SELECT out('VersionSetToVersion') FROM #14:1

This returns two VersionSet objects: #15:1, and #15:2, but only the edge to #15:2 has the status of 'latest'.

How can I refine this query by the status property on the EDGE so only #15:2 is returned in the results?

Upvotes: 3

Views: 103

Answers (2)

Lvca
Lvca

Reputation: 9060

Try this:

SELECT outE('VersionSetToVersion')[status = 'latest'].inV() FROM #14:1

Upvotes: 1

rmuller
rmuller

Reputation: 12859

select out_VersionSetToVersion[status = 'latest'] from 14:1

Upvotes: 0

Related Questions