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.

no relationship in database

Good morning experts, 
i can't see the relationship between my data, there is no error and it's mentioned no changes no records 
this is my code 
 
CREATE CONSTRAINT ON (c:LIBELLEPDT) ASSERT c.id is UNIQUE;
CREATE CONSTRAINT ON (c:AssetClass) ASSERT c.name is UNIQUE;
CREATE CONSTRAINT ON (r:LibSocieteGestion) ASSERT r.name is UNIQUE;neo4jphoto1.png
 
LOAD CSV WITH HEADERS FROM 
"file:///oddobhfamm.csv" as line with line where line.id is not null
CREATE (produit:LIBELLEPDT {id: (line.LIBELLEPDT) })

 

MERGE (assetClass:AssetClass {name: (line.AssetClass) })
MERGE (libSocieteGestion:LibSocieteGestion {name: (line.LibSocieteGestion) })

 

CREATE (produit)-[:AGAINST]->(assetClass)
CREATE (libSocieteGestion)-[r:TO]->(produit);
 
 
thank u so much
1 ACCEPTED SOLUTION

Hi @Hajer

Couple of things.

1. Change line 5 into a Merge statement. You may like adding a *toInteger*

2. Have you read about the WITH clause already? It somehow limit your scope. So In line 6, add produit to the pipe. WITH product, line where....

3. Get graphy!! Those are not columns, those are nodes. 

Oh, y’all wanted a twist, ey?

View solution in original post

20 REPLIES 20

I was able to execute your import query with a same data file I made and it created nodes and such. What does you data file look like? 

Thanks for your response ! it's a CSV file with 2127F lines

can you see it with me we can have a call by google meet if you can?

I joined a photo of my data neo4j2.png

ameyasoft
Graph Maven

Please post couple of rows from your .csv file

Hello, 

Thanks for your response 

yes neo4j3.png

 Think I know what the problem is. You have a condition for ‘line.id’ not nul, but you don’t have a column with an ‘’id’ field. Remove the following:

with line where line.id is not null

i deleted it

this is the result neo4j4.png

Looks like you have some null vales on the Asset Class column. You may need to discard them with line where line.AssetClass is not null

Oh, y’all wanted a twist, ey?

i checked my file there is no null values, but I did it this is the result: neo4j5.pngwith line where line.AssetClass is not null

Hi!

Try placing the with statement before the merge. 

Oh, y’all wanted a twist, ey?

Done!! thank you

and now how can i see the graphs with nodes?

yayyy.png 

 

Thanks for your help!

this is what i got, i don't see the relationship between nodes and in the 

MATCH (n:LIBELLEPDT) RETURN n LIMIT 25 query I wanted to see the product label not the id .. what should I do ?

 

twoo.pngone.png

glilienfield
Ninja
Ninja

Hey, to ensure you have the right file and the data looks good, run the following query. What does the output look like?

 

LOAD CSV WITH HEADERS FROM "file:///oddobhfamm.csv" as line 
return line
limit 10

 

i runned it 

this is the result exmp.png

Hi

Your info is not properly loaded do to the delimiter used.

You should use the FIELD TERMINATOR annotation. Take a look on (e.g) https://neo4j.com/developer/kb/how-do-i-define-a-load-csv-fieldterminator-in-hexidecimal-notation/

Oh, y’all wanted a twist, ey?

@bennu_neo is correct.  Here is the updated file with his suggestion.

 

LOAD CSV WITH HEADERS FROM 
"file:///oddobhfamm.csv" as line 
FIELDTERMINATOR ';'
    
CREATE (produit:LIBELLEPDT {id: line.LIBELLEPDT })
 
MERGE (assetClass:AssetClass {name: line.AssetClass })
MERGE (libSocieteGestion:LibSocieteGestion {name: line.LibSocieteGestion })
 
CREATE (produit)-[:AGAINST]->(assetClass)
CREATE (libSocieteGestion)-[r:TO]->(produit);

Let's know if there is any further issue. 

yes i tried it, i had this as an error error.png

You have uniqueness constraint. Change the first create to a merge, so it will not try to create the node if it exists. 

@Hajer 

And please, take a (long) look on 

https://neo4j.com/graphacademy/online-training/

 

Oh, y’all wanted a twist, ey?

it worked
Thank you very much sir! there are two things left:

  • relationships between columns are not visible
  • the LIBELLEPDT column is displayed in numbers or it is a character string

this is a record videorecordd.gif

Hi @Hajer

Couple of things.

1. Change line 5 into a Merge statement. You may like adding a *toInteger*

2. Have you read about the WITH clause already? It somehow limit your scope. So In line 6, add produit to the pipe. WITH product, line where....

3. Get graphy!! Those are not columns, those are nodes. 

Oh, y’all wanted a twist, ey?