Open DonCziken opened 6 years ago
Hi Krzysztof,
the following code works when I try it in all modes (DBType.REMOTE, DBType.IN_MEMORY, DBType.EMBEDDED):
@Test
public void test_RetrieveLabels() {
IClause[] clauses;
JcQuery query;
String cypher;
JcNode n = new JcNode("n");
JcString labels = new JcString("labels");
// initially clear database
dbAccess.clearDatabase();
// create nodes
clauses = new IClause[]{
CREATE.node().label("Label_1").label("Label_11"),
CREATE.node().label("Label_2"),
CREATE.node().label("Label_3")
};
query = new JcQuery();
query.setClauses(clauses);
dbAccess.execute(query);
// retrieve labels
clauses = new IClause[]{
MATCH.node(n),
RETURN.value(n.labels()).AS(labels)
};
query = new JcQuery();
query.setClauses(clauses);
JcQueryResult result = dbAccess.execute(query);
List<String> labsResult = result.resultOf(labels);
return;
}
cheers, Wolfgang
Hi Wolfgang,
tomorrow will have a more detiled look at moment when I step on this, maybe there are some other constraints to such.
cheers, Krzysztof
@Wolfgang-Schuetzelhofer
seems the issue might be even more complicated, as I had encountered same or similar problem when using PlannerStrategy.RULE as well. However good thing is that fix from #47 did help in that case as well.
cheers, Krzysztof
Hi Krzysztof,
I will have a closer look at the issue on thursday and then communicate back to you.
Cheers, Wolfgang
Hi Krzysztof,
I have merged your pull request. It is somewhat strange, that Neo4j returns different result structures when using different planner strategies. Your fix is an important addition to cover iterables in result structures. Thanks for that. I will release a new Version of JCypher next week.
Cheers, Wolfgang
Hi Wolfgang,
happy to hear that, however note that it seems that planner is not determinig cause but it is something else, as the issue had occured in my private code as well and changing to RULE strategy was not helping (as mentioned above).
So my guess that there is some kind of logic which behaves 'quasi' randomly when converting results into objects and sometimes it converts to Array and sometimes it converts into Iterable.
cheers, KG
Hi Wolfgang,
it seems that when fetching node labels like in following example, EmbeddedDbAccess failes to retrieve it from records (at the point while converting to Json):
I had prepared a fix for that, like following (in
AbstractEmbeddedDBAccess.java
), but not 100% if that is only place.Note: will provided more details later on, as I just need to have a reference to issue at the moment.
cheers, Krzysztof