I saw here : How can I return all properties for a node using Cypher? that somebody already asked this question, but 1 year ago.
So i need to ask it now : is there a way, today, to return all properties of a node using cypher? i need to do it for a translation system where previous developpers have created it as 1 node per language, with contains all of the properties with their name in the desired language. I need to get it for a Java application.
Example:
node FR contains: "Salut_01" : "Bonjour"
node UK contains: "Salut_01" : "Hello"
etc...
If you return the node directly from cypher via the http endpoints it will return a map with all property-names and property-values.
MATCH (n) return n
In Java you'd just go over n.getPropertyKeys()
.
For your regexp question you should split up your question into two.
This is how i finally did:
private IndexedContainer getTradParameters(int id){
IndexedContainer container = new IndexedContainer();
container.addContainerProperty("name", String.class, null);
try {
Document doc = Jsoup.connect("http://10.0.0.1:7474/db/data/node/"+id+"/").get();
Elements properties = doc.select("th");
for(int index = 0; index < properties.size(); index++){
String parameter = properties.get(index).text();
Item item = container.addItem(index);
item.getItemProperty("name").setValue(parameter);
}
} catch (IOException e) {
e.printStackTrace();
}
return container;
}
Where the id parameter is returned by this:
match (t:Translation) return id(t)
I call getTradParameters() with every iterator of my request and then i have a container with the name of all of the parameters of my node.
The Last part is calling this function :
private String getTradRequest(String pays){
String request = "match (n:Translation{trad_country:\""+pays+"\"}) return id(n) as id";
QueryResult <Map<String,Object>>result = engine.query(request, Collections.EMPTY_MAP);
Iterator<Map<String, Object>> iterator=result.iterator();
Map<String,Object> row = iterator.next();
int id = Integer.valueOf(row.get("id").toString());
try {
Document doc = Jsoup.connect("http://10.0.0.1:7474/db/data/node/"+id+"/").get();
Elements properties = doc.select("th");
for(int index = 0; index < properties.size(); index++){
String parameter = properties.get(index).text();
request = request + ",n."+parameter;
}
} catch (IOException e) {
e.printStackTrace();
}
return request;
}
To create my big Cypher request to get all of the properties i need on my node, and then i just need to get the answers and store them in a container, to display it in a table using vaadin.