Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a project that I'm working on where I extract data from PDFs and map/visualize the relationships between the extracted pieces.

Here's an example of my problem:

file: 11425646.pdf
  author: bob
  company: abc co
  date: 1/1/2011
  mentioned_users: [alice,sue,mike,sally]
  images: [1958.jpg,535.jpg,35735.jpg]

file: 15421484.pdf
  author: betty
  company: ionga
  date: 2/15/2011
  mentioned_users: [john,alex,george]
  images: [819.jpg,9841.jpg,78.jpg]

file: 11975748.pdf
  author: micah
  company: zoobi
  date: 9/26/2011
  mentioned_users: [alice,chris,joe]
  images: [526.jpg,5835.jpg,355.jpg]

How can I model this in a graph database like Neo4j?

I would like to be able to be given one piece of data (like a person's name) and find all related (images, co-mentions, authors, etc.) at up to 10 depth. Here's what I'm thinking for the structure, but I'm not sure if it's a good approach: (this isn't any kind of actual syntax)

[file: 11425646.pdf date:1/1/2011] -written_by-> bob
[file: 11425646.pdf date:1/1/2011] -from_company-> abc co
[file: 11425646.pdf date:1/1/2011] -mentions-> alice
[file: 11425646.pdf date:1/1/2011] -mentions-> sue
[file: 11425646.pdf date:1/1/2011] -mentions-> mike
[file: 11425646.pdf date:1/1/2011] -mentions-> sally
[file: 11425646.pdf date:1/1/2011] -has_image-> 1958.jpg
[file: 11425646.pdf date:1/1/2011] -has_image-> 535.jpg
[file: 11425646.pdf date:1/1/2011] -has_image-> 35735.jpg

Is this the right way to structure this data in a graph database?

share|improve this question
    
for what it's worth, I have all of this data in a relational database too, our set of documents is so large we don't actually visualize the whole thing, we use analytics built from aggregating the data in a relational database first, then we know which names to search for relationships on –  justausr Jun 9 '13 at 6:31
    
could you model the graph you are suggesting with console.neo4j.org, using docs.neo4j.org/chunked/snapshot/cypher-query-lang.html so it's easier to see? –  Peter Neubauer Jun 13 '13 at 18:26
    
The structure looks about right. At depth 10 you are probably exhausting the diameter of your graph, meaning that you touch all nodes depending on the connectedness of your data (e.g. if images are referred from different PDFs so you can traverse on through them). –  Peter Neubauer Jun 18 '13 at 13:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.