Veri İçe ve Dışa Aktarma
Harici kaynaklardan Neo4j'ye veri yüklemek ve graf verilerini başka amaçlarla dışa aktarmak için çeşitli yöntemleri keşfedin.
Veri İçe ve Dışa Aktarma, CoddyKit'te ücretsiz bir Neo4j Graph Database Fundamentals dersidir. Bu, 4 dersinin 2. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Neo4j Graph Database Fundamentals öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Neo4j Graph Database Fundamentals kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Moving Data In & Out
In this lesson, we'll explore how to get data into your Neo4j graph database and how to extract it for other uses. This is crucial for integrating Neo4j with existing systems, migrating data, or preparing it for analysis.
Importing Data: An Overview
Bringing external data into Neo4j is a common task. There are several powerful methods:
LOAD CSV: For structured data from CSV files.- APOC Procedures: For more complex formats like JSON, XML, or data from external databases.
- Connectors & Drivers: Programmatic import via application code.
We'll focus on the first two methods.
LOAD CSV: The Basics
The LOAD CSV Cypher clause is your go-to for importing data from CSV files. It lets you specify the file path, handle headers, and access each row's data.
Here's a basic structure to read a CSV and return its rows:
LOAD CSV WITH HEADERS FROM 'file:///users.csv' AS row
RETURN row;Creating Nodes from CSV
Let's say you have a users.csv file with id,name,email columns. You can use LOAD CSV to create User nodes:
LOAD CSV WITH HEADERS FROM 'file:///users.csv' AS row
CREATE (:User {id: row.id, name: row.name, email: row.email});Creating Relationships from CSV
You can also create relationships. If you have a follows.csv with followerId,followedId, you can connect existing User nodes:
- We use
MATCHto find the existing nodes. CREATEthen forms the relationship between them.
LOAD CSV WITH HEADERS FROM 'file:///follows.csv' AS row
MATCH (u1:User {id: row.followerId})
MATCH (u2:User {id: row.followedId})
CREATE (u1)-[:FOLLOWS]->(u2);Beyond CSV: APOC for Import
For more complex import scenarios, such as JSON or XML files, or data from external databases, the APOC (Awesome Procedures On Cypher) library is invaluable. APOC extends Cypher with hundreds of new procedures and functions.
You'll need to install the APOC plugin for your Neo4j instance to use these features.
Importing JSON with APOC
If you have data in a JSON file, like products.json, you can use apoc.load.json to parse it. Each item in the JSON array can then be processed to create nodes and relationships.
CALL apoc.load.json('file:///products.json') YIELD value
CREATE (:Product {id: value.id, name: value.name, price: toFloat(value.price)});
Exporting Data: An Overview
Just as important as importing is exporting data from your graph. You might need to:
- Generate reports.
- Migrate data to another system.
- Perform advanced analytics outside Neo4j.
- Create backups.
We'll look at basic Cypher export and advanced APOC export.
Basic Export with Cypher
The simplest way to export data is using standard Cypher MATCH and RETURN statements. The results are displayed in the Neo4j Browser and can be copied or downloaded as CSV/JSON.
MATCH (u:User)-[:FOLLOWS]->(f:User)
RETURN u.name AS Follower, f.name AS Followed;Advanced Export with APOC
APOC offers powerful procedures to export your graph data directly to files in various formats (CSV, JSON, GraphML, etc.). These are ideal for full graph exports or specific subgraphs.
For example, to export all nodes and relationships to a CSV file:
CALL apoc.export.csv.all('full_graph_export.csv', {});Import/Export Challenge
You have a CSV file named books.csv with the columns isbn, title, author. You want to import this data into Neo4j, creating nodes with the label Book and properties for each column.
Recap: Data Movement Skills
You've learned essential skills for moving data in and out of Neo4j:
LOAD CSVis powerful for structured data.- APOC procedures extend capabilities for JSON, complex exports, and more.
- Standard Cypher
MATCHandRETURNallow simple data extraction.
Mastering these techniques is key for managing your graph data effectively!
Sıkça Sorulan Sorular
“Veri İçe ve Dışa Aktarma” dersi ücretsiz mi?
Evet — “Veri İçe ve Dışa Aktarma” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Neo4j Graph Database Fundamentals kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Neo4j Graph Database Fundamentals kursu toplamda 4 dersten oluşur.
“Veri İçe ve Dışa Aktarma” dersinde ne öğreneceğim?
Harici kaynaklardan Neo4j'ye veri yüklemek ve graf verilerini başka amaçlarla dışa aktarmak için çeşitli yöntemleri keşfedin. Neo4j Graph Database Fundamentals ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Neo4j Graph Database Fundamentals öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Neo4j Graph Database Fundamentals, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 2. dersidir.
“Veri İçe ve Dışa Aktarma” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Neo4j Graph Database Fundamentals dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Neo4j Graph Database Fundamentals dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Neo4j Tarayıcısı ve Yönetim Araçları
- Veri İçe ve Dışa Aktarma
- Yedekleme ve Geri Yükleme Stratejileri
- Neo4j'de İzleme ve Günlükleme