Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
986 views
in Technique[技术] by (71.8m points)

graph databases - How do I see if a value exists in any property for gremlin?

I have a gremlin 3.4.9 set up, with a few different types of vertexes. (people, jobs, homes for example). I want to be able to traverse all of these samples and see if any of the properties contain a value. for example:

I have a:

people vertex with the properties: name, age, location, bio

job vertex with the properties: title, pay, location, description

home vertex with the properties: cost, location, description

and I want to see if any of these properties of these vertices contain the value "family". What would that query look like?

question from:https://stackoverflow.com/questions/65833803/how-do-i-see-if-a-value-exists-in-any-property-for-gremlin

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can search the properties values like this:

g.V().properties().hasValue("family");

This seems to work across different Vertices (which I believe is what you are looking for)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...