Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-06-2018 06:46 AM
Does anyone have a little time to help me in writing my import query!?
(I have a database of academic, writers and books I want to show relations between them)
10-06-2018 09:00 AM
how do you have the data stored currently? Do you have a schema in mind?
10-08-2018 04:17 PM
Come on community just a little help!
10-08-2018 06:21 PM
Hi there,
there are a few different ways to import from SQL to Neo4j, and some good articles on those options.
This article on importing data from relational db is probably the best place to start, with links to each of those approaches.
This article on Migrating from MySQL to Neo4j is also good, and further covers some of the concepts you'll need to learn with respect to data modeling for a graph db and how to translate some relational db concepts to graph accordingly.
This import data tutorial walks you through importing the Northwind db into Neo4j, and also covers differences between relational and graph data models.
Hope that helps!
10-09-2018 01:40 AM
Hi Andrew, Thanks but I didn't ask for documentation. actually I've seen them before.
10-09-2018 02:06 AM
I see.
I think if you want help with an import query, you'll need to provide something as a basis, such as what you've tried so far (and what is or isn't meeting your needs), your data model, your queries, and any other relevant info.
10-09-2018 02:12 AM
10-09-2018 02:31 AM
Okay, so what about the examples isn't working for you?
The general idea is either that you use the CSV data to match on the nodes by ids (the id of one thing, and the foreign key of the other thing), then MERGE the relationship between them.
If you already imported all of the properties on the nodes, then that foreign key exists as a property on a node somewhere, and you can use that to look up the other node by id, then MERGE the relationship.
The last example on the here-2
thread shows a simplified version of this approach, but let's make some assumptions based upon the headers from your here-1
link.
From your Book.csv it looks like there's a property AuthorIds
, which I'm assuming you imported as an integer list, and each id was a foreign key to a :Person with that integer Id
property.
If so, then provided you have an index on :Person(Id)
(for quick lookup of :Person nodes by id), you can use this query:
MATCH (b:Book)
MATCH (p:Person)
WHERE p.Id in b.AuthorIds
MERGE (b)-[:WRITTEN_BY]->(p)
Let me know if any of those assumptions is off.
But in general, this is the approach you would use if you're working with an id list as opposed to just an id property (doing this by a single id property is easier of course, and an example was provided on the thread linked by here-2
).
All the sessions of the conference are now available online