FollowRecursive is not a function


#1

I would like use “FollowRecursive” operation to follows the chain recursively.

I use the http gremlin api, such as “http://$host/api/v1/query/gremlin”, but the server response 400, and the err message is “{“error” : “TypeError: ‘FollowRecursive’ is not a function”}”.

The cayley version I used is 0.6.1v.

And If I would like to adopt DFS to traverse from a root node to its leaves , and record all the paths, how could I do with Cayley?


#2

Please post the code that you trying


#3

It’s like the following:

var type = g.Morphism().Out(“http://www.w3.org/1999/02/22-rdf-syntax-ns#type”)

g.V(“http://jhmk.com/ontology/disease#A”).FollowRecursive(type).All()


#4

The problem has been previously discussed here. You can specify depth like so:

var depth=10;    
var type = g.Morphism().Out("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")
g.V("http://jhmk.com/ontology/disease#A").FollowRecursive(type,depth).All()

Please make sure you have the latest cayley code running (binary or go package). I hope it helps.


#5

Sorry, I did not read the question carefully enough. The error you are receiving is probably due to g.V() returning nil.

And If I would like to adopt DFS to traverse from a root node to its leaves , and record all the paths, how could I do with Cayley?
You may use this as a reference.

A suggestion though:
It’s better to use
var type = g.Morphism().Out("<rdf:type>")
instead of var type = g.Morphism().Out("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")

Similarly
http://jhmk.com/ontology/disease#A in g.V("http://jhmk.com/ontology/disease#A").FollowRecursive(type).All() can be expressed and modeled in a better way.

From what I can understand, you are trying to list all types that exist for a disease named “http://jhmk.com/ontology/disease#A” diseases in your graph.


#6

Thanks. perhaps cayley running on my server is not the latest. And do I have to compile the code on github, and is there any new version released?


#7

New version with all the changes will be released in 2 weeks, so if it’s okay for you to wait for it, this might be a good option.

As an alternative, we can provide a dev binary and/or Docker container.