Relationships can't have a "$" in the name

I can't show one node funding another with a specific amount of money because I can't have a "$" symbol in the relationship name!? Also, I'm not allowed to start a relationship name with a number for any reason? I'm still a novice neo4j but this seems to be a show stopper for some (many?) graph database projects.

this is described at Naming rules and recommendations - Neo4j Cypher Manual

Hello @bruce

Can you share a bit more about what you are trying to archive?
You can model something on and share the result here.

You can think about these "limitations" as a philosophy, if you can understand how it works you will be able to archive almost anything you want. If not, there is APOC to do more advance stuff.

Relations are the core of Neo4j engine, so they have a little bit less flexibility.

The way you are trying to model your problem will not allow you to ask these simple questions:

Which node are funded by the node x?
How much found has been given by node x?

If you put the money amount in the name of your relation, you won't be able to normalise most of your requests related to your industry. One solution, but not the best, is to name your relations FUNDED with at least one property named value: as an integer.

The $ is probably irrelevant in a database, it's a user concern not the data concern unless you want to express explicitly as part of the data like currency but I would not express it as a part of the amount.

I don't quite get what you want to do, but....

another possibility, is give the relationship a money attribute either as a string or a float.

Maybe something like:

(p:Person {name:'Thomas R. Marshall'})-[:PURCHASE {amount: '$0.05'}]->(product {type:'cigar'})
1 Like

@clem you could certainly do that but then if you want to

match (p:Person)-[r:PURCHASE]->() return sum(r.amount);

then this starts to fail as we are trying to sum a string

Well, use, but it's not hard to convert strings to floats thanks to APOC functions


return apoc.number.parseFloat('$12.345,67', '$#,##0.00;(#,##0.00)', 'en') as value

returns the float 12.345

Thanks for all of your replies. I'm wondering if Neo4j is overpowered for what I'm doing. I.e. like a several hundred horsepower outboard motor on a small aluminum fishing dingy. The best way to explain is my Knowledge Map.
--It's all manual entry from text, images, and videos. I started off keying in cypher code but changed over to Now I have a number of arrows maps. I export cypher code blocks from each map and add it to the previous one in Neo4j Desktop Browser. This is what I get after a LOT of dragging nodes around (and some image post processing.)
--I'd appreciate suggestions if you think I'm using the wrong software. Or how I should be doing it differently. Thanks.

Here I'm using Bloom because Browser doesn't have the flexibility for display, but I still can't find an export to image (e.g. .png) thus I'm still capturing the screen and restricted to that resolution.
--Here are two screen captures. The first time I want to show the funds committed. The second time I try the advice I got here and the relationship is :FUNDING with properties amount 10,000,00 and currency DOLLARS.
--Oddly enough FUNDING shows up in the graph but I cannot find any control that will make the properties amount and currency visible in the graph.

Try this:

Add another property, currencyAmount: "$10,000,000".

merge (a:Sponsor {name: "Google"})
MERGE (b:ResearchProject {project: "Cold Fusion"})
MERGE (a)-[:FUNDING {amount: toFloat(10000000), currency: "dollar", currencyAmount: "$10,000,000"}]->(b)

For FUNDING relationships select 'currencyAmount':

Screen Shot 2021-05-17 at 12.01.12 AM

Power of Neo4J comes when you have to make queries. E.g. return the top 10 largest funded projects. This is why having the amount as a relationship is a bad idea. However, displaying the attribute of the FUNDING relationship is a great feature of Neo4J, as you can then see the amounts and keep the relationship. (Since the money values are in large dollar amounts, displaying the values with commas and $ signs makes things more readable, so having a printed representation of the value and a math representation is both useful.). @ameyasoft solution is a good one but you have to be careful not to let the print representation get out of sync with the float value.

If you just want a white board diagram, then yes Neo4J is overkill. OTOH, you don't know what sorts of queries you will want to make of your data.

For example, you may want to group by countries and get the total funding values per country.

Neo4J is great for many to many relationships. It's possible that multiple countries will do a joint project. That is easy to add in Neo4J but a pain in a relational DB.

It's easy to imagine, also that a Person might be involved in multiple projects or a Person might be associated with multiple organizations.

I see you don't have people associated with their schools. People may have hidden biases based on what schools they have in common.

I don't know this business, but perhaps there are different underlying and competing technologies. That could be a relationship too. Perhaps there are different patents which may have multiple co-inventors. People could be co-authors of papers. Or specialize in subtopics.

Neo4J gives you a lot of power to add new relationships, nodes, and attributes.

It also occurs to me another thing that is possible, is to find potential conflicts of interest, where somebody is an investor or gets paid by one organization and denigrates a competing organization.

RIght now, your graph looks more disconnected than I suspect the reality is.

Good luck!

Great stuff everybody. Thanks!