1

Is there a way to get a node by specific attributes using the Java API? Specifically:

  • By Name
  • By Label
  • By properties - (various properties)

The only functions I found were:

findNode(label)
findNode(label, key, value)

Which only supports one property. Or do I have to use Cypher to get this?

3
  • It is not clear what you mean by "name" in your question. Nodes do not have "names". You can specify a "name" property if you want, but it would have no special significance to neo4j. Using Cypher, you can specify an "identifier" for a node, but identifiers are only meaningful within a Cypher query, and are never persisted in the DB. Commented Oct 28, 2016 at 17:04
  • Ah sorry I confused the label. I was talking about multiple labels and multiple properties. And I don't like using cypher that much there. As far as I understood I don't have the transaction guarantees and they're slower. Commented Oct 29, 2016 at 12:13
  • Cypher queries run in transactions, and are not necessarily slower. Commented Oct 30, 2016 at 23:51

1 Answer 1

2

If your question is about how to find nodes that have specific multiple property values, the Java API has no method that does that task. In general, it is easier to use Cypher for that.

Sign up to request clarification or add additional context in comments.

2 Comments

But isn't cypher slower?
Cypher can be faster, but it depends. The Cypher implementation is improving ll the time, and can the cost planner can alter the runtime processing depending on the characteristics of your actual data characteristics at the time -- something a hardcoded Java imlementation cannot do,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.