cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Cannot perform queries with "WHERE" clause to data imported from JSON file

Hello all,

I am new to Cypher and Neo4j and I would like some help in my first steps.
I have imported a Json file (with apoc plugin) with the upper level to be the field "executions" and in the nested part with some subfields with which I have created relationships and nodes.
I run the following query and it returns nothing. (As syntax is correct).

<WITH "file:///myfilejson"
AS myjson
CALL apoc.load.json(myjson)
YIELD value
UNWIND value.executions as e
MATCH (execution: Execution {id:e.id})
WHERE e.id = '15203'
RETURN e.status />

Where I have done a mistake? In general i am confused how to use the "WHERE" clause in the data I have imported.

However, I have already succesfully created nodes and relationships with the following:
WITH "file:///myfile.json"
AS myjson
CALL apoc.load.json(myjson)
YIELD value
UNWIND value.executions as e
FOREACH (exec IN e | MERGE (execution: Execution {id:e.id} ) MERGE(status:Exec_Status {sts:e.status}) MERGE (execution)-[:MARKED_AS]->(status)
<MERGE (t:Tester {name:e.testerName}) MERGE((t)-[:PERFORMED]->(execution)) MERGE (p:Project {name: e.project.name})
MERGE((p)-[:BELONGS_TO]->(execution)) MERGE((t)-[:PERFORMED]->(execution)) MERGE (type:Execution_Type {name: e.executionType})
MERGE((execution)-[:EXEC_TYPE]->(type)) MERGE (tcid:TestCaseId {name: e.testCase.id}) MERGE((execution)-[:HAS_TC_ID]->(tcid))) />

  • neo4j server version: neo4j-community-4.0.11 in win10
    -I use apoc plugin to import the json
    sample.txt (2.8 KB)
2 REPLIES 2

what is the type of the .id property on that node? Could you check?
If it is an integer that would explain the query results. (it looks like it is an integer value, in the json example)

ameyasoft
Graph Maven
Used your sample file and imported the data.

Result:

Ran this query:
match (e:Execution)-[]-(a:Exec_Status)
where e.id = 15144
return e.id as ID, a.sts as status

Result: