Hi guys, I'm new to neo4j and specially to cypher language
I have this challenge I need to retrieve all missing values from my graph database.
The input will be an String[] and the output should be String[] that are not yet stored.@NodeEntity
class Person {
@GraphId Long id
@Indexed(unique = true) String name
}
class PersonRepository extends GraphRepository<Person> {
//@Query("....") this is what I'm not sure how to do it
String[] getMissingNames(String[] names);
}
So lets assume that I have 3 Person nodes already storedPerson: John
Person: Gabriel
Person: Dave
Then I will get a String[] of names holding a persons names..
String[] names = {"Gabriel", "Carlos", "Ana"};
I need to create those that are not yet in my database, by doing thisString[] missedNames = personRepository.getMissingNames(names);
List<Person> missingPersons = new ArrayList<Person>
for (String name: missedNames ) {
missinPersons.add(new Person(name));
}
//Insert all missing persons at once
personRepository.save(missingPersons);
missedNames array should contain the values of Carlos and Ana
How can I achieve something like this?
Thanks on advance your comments.
--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.