Cypher query : type of id to create relationship between nodes

Hello, I have a question about ids to create relationship between two nodes.I have this request:

"MATCH (a:ARTICLE),(w:SOURCE) WHERE a.id=$artid AND w.id=$author_id MERGE (a)-[:HAS_SOURCE]->(w)"

Is it possible to give something else than integers as ids ? For example url ? Strings ?
Or are integers mandatory for ids ?

Yes you can use either strings or numbers for id's. Obviously, numbers have the advantage of being more compact and faster to compare than strings.

I will note URL's have a canonicalization problem....

HTTP://NEO4.J.COM won't exactly match https://neo4j.com but maybe they should (case and http vs https.)

BUT sometimes case does matter (I really ran into this example in my career).

https://en.wikipedia.org/wiki/Acid (about chemistry) is DIFFERENT from
https://en.wikipedia.org/wiki/ACID (about Computer science)

So, I would try to avoid using URLs as keys. It would be a headache.

1 Like

Hi @LJRB , the type of id created are also directly related to performance. In my blog -> http://www.dominickumar.com/blog/neo4j-relationship-modelling-performance/ I have a demo on the performance.

2 Likes

thank you @clem and @dominicvivek06 for the answer