Finding labels for a given path



I’m New to Cayley. I’m having trouble retrieving labels from a given path, and am unable to APIs that allows me to do quick retrievals
i.e., g.V('node1").Label().All()

Any directions would be greatly appreciated!



Hi @Flavian5,

Sorry for a long wait.

Do you mean the label in a quad (the forth quad value)? If so, I’m afraid this function is not exposed via Gizmo API yet, but it’s available if you use Cayley as a library from Go.


Hello @Flavian5,

Actually, this was recently added, but the documentation seems not to have been updated. You can look at the test for the behavior here:

Given your example, it would be:



Thank you so much!

Since I am unable to use more recent versions of Cayley for my project right now, my work around is to generate new quads based on the subject-object edges as the subject and label as object.


Hello, put previous discussion one step forward, with Gizmo API, is there any way to get Labels from a specific path?

For example, the graph is defined as below
<node_1> <predicate_1> <node_2> <label_1>
<node_3> <predicate_2> <node_2> <label_2>

if I use g.V("<node_2>").Labels().All(), both “label_1” and “label_2” will be returned. But what I need is read the label on “<node_1> <predicate_1> <node_2>” path, which is “label_1”

I tried to use g.V("<node_1>").Labels().intersect(g.V("<node_2>").Labels()).All(), but what if more than one relationship is defined as below
<node_1> <predicate_1> <node_2> <label_1>
<node_1> <predicate_12> <node_2> <label_12>
<node_3> <predicate_2> <node_2> <label_2>
The “intersect” way will return “label_1” and “label_12”, but I want “label_1” only.

Looking forward to your help, thanks.