Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning Neo4j 3.x - Second Edition

You're reading from  Learning Neo4j 3.x - Second Edition

Product type Book
Published in Oct 2017
Publisher Packt
ISBN-13 9781786466143
Pages 316 pages
Edition 2nd Edition
Languages
Concepts
Author (1):
Jerome Baton Jerome Baton
Profile icon Jerome Baton

Table of Contents (24) Chapters

Title Page
Credits
About the Authors
Acknowledgement
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. Graph Theory and Databases 2. Getting Started with Neo4j 3. Modeling Data for Neo4j 4. Getting Started with Cypher 5. Awesome Procedures on Cypher - APOC 6. Extending Cypher 7. Query Performance Tuning 8. Importing Data into Neo4j 9. Going Spatial 10. Security 11. Visualizations for Neo4j 12. Data Refactoring with Neo4j 13. Clustering 14. Use Case Example - Recommendations 15. Use Case Example - Impact Analysis and Simulation 16. Tips and Tricks

Importing from a JSON source


To import a JSON datasource, we need to use APOC (see Chapter 5, Awesome Procedures on Cypher – APOC). Therefore, make sure that you have installed it.

Note

We will use a JSON file that contains the list of the countries of the world. You can find it here in a human-readable form,  https://github.com/mledoze/countries/blob/master/countries.json, and in a computer-processable form at https://raw.githubusercontent.com/mledoze/countries/master/countries.json, which I saved in the import folder.

To use the local copy, set the following in your neo4j.conf (and restart the server):

apoc.import.file.enabled=true

However, at this time, it's the full path that must be given as a parameter, so adapt the following examples to your system.

Try this query to get a view of the data:

WITH "file:////home/jerome/Tools/neo/neo4j-community-3.2.0/import/countries.json" AS url
CALL apoc.load.json(url) YIELD value
RETURN value.cca2, value.cca3,value.name.common, value.name.official, value...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}