I came across a scenario i.e, Each and every node is to represent with an image . so i have to store image into neo4j. please healp me out with your views on it.
Asked
Active
Viewed 7,319 times
7
-
5ideally you would store the image on disk and create a node with a property referring to the path of the image – Christophe Willemsen Oct 21 '14 at 07:55
2 Answers
11
You have several options:
- As @Christophe Willemsen suggested you, save the image on disk or on a web site and reference it using a URL.
- Save it in byte[] array as a property.
- Save the image in base64 using a Data URI (as String).
Of course option 2 and 3 are not recommendable if the images are very large. Though you could save a thumbnail in the database and the full image on file system.
You should save some metadata too in properties, like type, size, location etc.. to improve searches in the database.
4
According to the Neo4j community:
- Don't add large blobs of data, e.g. base64, to the graph as property values. This is one of the few anti-use-cases for graph databases.
- Store the binary information somewhere, e.g. AWS S3, and have a node representing that photo or video. That node contains the S3 URL as reference and potentially some meta-data as well (width, height, quality, codec).
- Use relationships to amend information like tagging, comments, ownership and permissions.
Kudos to Stefan Armbruster (Neo4j Staff) for the info.

Thiago Bôa
- 41
- 2