cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Historical database & maps

Hi, there.
I am a noob working on an historical database. I managed to write a first draft of my code that I can browse well and that describes each entry according to this usual pattern:

CREATE (Item123:Book {title:"Title of the book", printed:19xx})
CREATE
(JohnDoe)-[:PRINTED]->(Book123),
(NewYork)<-[:PRINTED_IN]-(Book123),

Now, I would like to locate these data in both time and space. Hence, my questions:

  1. I wanted to create a relationship type like [:DATE_OF_PRINT] but as I don't really know how to use this format. I tried to write (Book123)-[:DATE_OF_PRINT]->(date:yyyy) but it didn't work. Apparently, I doing something wrong
  2. As to space, I would like to localize this database. I have installed Neomaps but apparently I fail to enter the coordinates for latitude/longitude. Besides, I would like to use an historical map. Is there any possibility to “mark" a map with some coordinates and associate them with the database. I do not really need a OSM, as locations are below 30, and therefore I thought I could mark each city and associate it with a specific entry (say: NewYork with an unique number, so that I can “overlap" an historical map on the database ecc…)
    Thank you for any support you may give me.
    best,
5 REPLIES 5

Hi @rabbiacher

Item123 in the first line has been changed to book123.

(JohnDoe)-[:PRINTED]->(Book123),

I didn't know if it was the author or the printing company, so I used company.

To use NeoMap, you just need to have the latitude and longitude.
If you have a name, it will be shown in the popup.

Here's the code.

CREATE (book123:Book {title: 'Title of the book', printed: 1980})
CREATE (johndoe:Company {name: 'John Doe'})
CREATE (newyork:City {name: 'New York', latitude: 40.730610, longitude: -73.935242})
CREATE
  (johndoe)-[:PRINTED]->(book123),
  (newyork)<-[:PRINTED_IN]-(book123),
  (book123)-[:DATE_OF_PRINT]->(:PrintedYear {date: 1980})


Dear Koji,
thank you again for your help. I hope I can indulge your patience for a further explanation. Everything works fine and smooth than you to your suggestion. Yet I noted that multiple entries that share the same :PrintedYear variable are not shown under the same node but rather individually.
This is an expansion on your code:

CREATE (book123:Book {title: 'Title of the fist book', printed: 1980})
CREATE (book124:Book {title: 'Title of the second book', printed: 1980})
CREATE (johndoe:Company {name: 'John Doe'})
CREATE (thedude:Company {name: 'The Dude'})
CREATE (newyork:City {name: 'New York', latitude: 40.730610, longitude: -73.935242})
CREATE (losangels:City {name: 'Los Angeles', latitude: 34.052235, longitude: -118.243683})
CREATE
(johndoe)-[:PRINTED]->(book123),
(newyork)<-[:PRINTED_IN]-(book123),
(book123)-[:DATE_OF_PRINT]->(:PrintedYear {date: 1980})

CREATE
(thedude)-[:PRINTED]->(book124),
(losangels)<-[:PRINTED_IN]-(book124),
(book124)-[:DATE_OF_PRINT]->(:PrintedYear {date: 1980})

Now, as you can see, PrintedDate always shows individually and not as a node from which both books could depart. They show like this:

And yet I would like to call the PrintedYear category (“1980") and rather have the two graphs displayed like this (I just dragged manually one graph unto the other):


Is there any solution?
Thank you again for your patience.

Hi @rabbiacher

Create the year in a single node.

CREATE (book123:Book {title: 'Title of the fist book', printed: 1980})
CREATE (book124:Book {title: 'Title of the second book', printed: 1980})
CREATE (johndoe:Company {name: 'John Doe'})
CREATE (thedude:Company {name: 'The Dude'})
CREATE (newyork:City {name: 'New York', latitude: 40.730610, longitude: -73.935242})
CREATE (losangels:City {name: 'Los Angeles', latitude: 34.052235, longitude: -118.243683})
CREATE (py1980:PrintedYear {date: 1980})
CREATE
  (johndoe)-[:PRINTED]->(book123),
  (newyork)<-[:PRINTED_IN]-(book123),
  (book123)-[:DATE_OF_PRINT]->(py1980)
CREATE
  (thedude)-[:PRINTED]->(book124),
  (losangels)<-[:PRINTED_IN]-(book124),
  (book124)-[:DATE_OF_PRINT]->(py1980)

You can see this graph.

Thank you for your kindness!

It works fine. Thank you, sir!