WITH "/Users/nlp/social_graph/graph-nodes.csv" as uri
LOAD CSV WITH HEADERS FROM uri as row
MERGE (:User {id: row.id})
I have a CSV file to contains some nodes, and I want to load it into neo4j through Neo4j Desktop, but got the following error message:
Invalid URL '/Users/nlp/social_graph/graph-nodes.csv': no protocol: /Users/nlp/social_graph/social-nodes.csv
What's the error? Note that before I run the command in the browser, the database is empty. How to load the database?
EDIT: Did some search and added 'file:///' to the file path, this time I got another message:
Couldn't load the external resource at: file:/Users/congminmin/Library/Application%20Support/Neo4j%20Desktop/Application/neo4jDatabases/database-fdb13bea-33f7-409b-a6bd-387a25a679e6/installation-3.5.12/import/Users/congminmin/social_graph/social-nodes.csv
The easiest would be to copy your cv file into the import directory under your neo4j installation directory. Then use file:///social-nodes.csv In your LOAD CSV command.
Find more details here: https://neo4j.com/developer/guide-import-csv/
I know it's late, but if you are using neo4j on docker, the import folder path is as follows:
/var/lib/neo4j/import
You can create a volume that bounds to the import directory. After mounting, copy your local files to your mounted directory, then use file:///file-name in your LOAD command.
Related
I am new to neo4j. Please could you help me how I can import an xml file into Neo4j.
I installed the neo4j community version and added Neosemantics plugin(.jar file) in the appropriate folder. I tried both adding the below lines to neo4j.conf file:
dbms.unmanaged_extension_classes=semantics.extension=/rdf
dbms.unmanaged_extension_classes=n10s.endpoint=/rdf
But still getting an error 'Neo.ClientError.Procedure.ProcedureNotFound' for the following commands I tried in Neo4j browser as a query:
CALL semantics.liteOntoImport('file:///C:/Users/np/neo4j-community-5.2.0/import/ABC.xml','RDF/XML')
CALL semantics.importRDF("https://ABC.xml","RDF/XML")
I'm trying to read a csv file located in my hdfs filesystem through apoc library in Neo4j with the following line of code"
CALL apoc.load.csv('hdfs://ipAddrress:port/myFileLocation.csv')
I also disabled Neo4j configuration for apoc and enabled importing files through apoc. So i included the following lines in my configuration file:
apoc.import.file.use_neo4j_config=false
apoc.import.file.enabled=true
but i keep getting the following error:
Failed to invoke procedure `apoc.load.csv`: Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.fs.FSDataOutputStream
The dependencies are built into neo4j apoc extension but i don't know why the hadoop-related class can't be found. Any help?
After searching the internet a bit, I found this from Tom Geudens.
At this time that is not possible : CSV files can be stored on the
database server and are then accessible using a file:/// URL.
Alternatively, LOAD CSV also supports accessing CSV files via HTTPS,
HTTP, and FTP.
You may be able to expose your hdfs filesystem over http (and then use
a http:// url) but otherwise ... no.
I'm trying to load a CSV file into Neo4j Enterprise edition and I think I'm considering all the rules but I don't understand what is the error related to
this is the error :
this is my csv file . I have entered my data in excel and then saved it as a CSV file :
Copy your CSV file to Neo4j Import Directory. Take a look in Neo4j file locations docs. For windows desktop installations this directory is %APPDATA%\Neo4j Community Edition\import.
Change your import path to 'file:///abc.csv'
Try again.
I'm trying to load the CSV file in to Neo4j. But it was throwing error like this
Couldn't load the external resource at: file:/home/trainings/Desktop/neo4j-community-3.0.6/import/home/trainings/Desktop/neo4j_module_datasets/terrorist_data_subset.csv
I tried changing the neo4j.conf file. I have changed
dbms.directories.import=import
dbms.security.allow_csv_import_from_file_urls=true
even though im facing the error.
It's a little bit old post but I would like to share answer.
On Ubuntu linux neo4j version 3.2.2 open the conf from /etc/neo4j/neo4j.conf.
Find the line dbms.directories.import. Modify this path to change the default import location or comment out to load using the absolute path from '/'.
Then add the file path in query as below.
LOAD CSV FROM 'file:///artists.csv' AS line CREATE (:Artist { name: line[1], year: toInt(line[2])})
Comment out this config line: dbms.directories.import=import.
Just by placing the .CSV in to Import folder we can able to load the data into Neo4j
If you comment out the dbms.directories.import=import (located within /etc/neo4j/neo4j.conf), this allows system-wide access from neo4j dangerous, but maybe fine if it is only run on a personal machine.
To enable changes you must then kill all neo4j processes and restart the server pkill -u neo4j ; sudo neo4j start. When loading you should get something similar to:
Active database: graph.db
Directories in use:
home: /var/lib/neo4j
config: /etc/neo4j
logs: /var/log/neo4j
plugins: /var/lib/neo4j/plugins
import: NOT SET
data: /var/lib/neo4j/data
certificates: /var/lib/neo4j/certificates
run: /var/run/neo4j
Note the NOT SET in the import row.
Im trying to import csv files from disk with cypher commands as shown in the tutorial, but Im getting "Couldn't load the external resourse at: externalResourceFailure.
Is there any "roadmap" for importing csv in windows from files?
Thank you in advance!
take alook at SyntaxException with Neo4j LOAD command
in the question, step 3, please check if you path to the file is correct on your operating system:
the syntax for accessing a local file on windows is simply "file:c:/nosql/test/unclaimed.csv" and not file:// as might be inferred from examples on ...
You have to put the files into the import directory in neo4j.
it will work if path like this "file:///C:/myfile.csv"
The Windows and Linux file systems require different file URI schemes for streaming over HTTP. Neo4j's LOAD CSV Cypher clause makes an HTTP web request to the URI of a file and not the file system path.
For more information on file URI schemes on Windows please take a look at: http://en.wikipedia.org/wiki/File_URI_scheme#Windows_2
You can also create a folder import into your neo4j installation folder and run a cipher like this
LOAD CSV WITH HEADERS FROM "file:///yourcsvfile.csv" AS row
On mac: create a folder inside the Neo4j directory. Neo4j will install in Documents (by default)
mkdir /Users//Documents/Neo4j/default.graphdb/import
Copy your file in this location
Use it like this
USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM "file:///user_list.csv" as row create (:Users {userId: row.USER_ID });