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.

Checking a field data type

tideon
Graph Buddy

Hello Everyone,

I have been searching the manual for something that would allow me to check the data type of a field.
So in Python you would simply use type(), but that function in cypher is used for something else, if I read it properly.

Greetings,
Jeffrey

3 REPLIES 3

clem
Graph Steward

Thanks again Clem,

I was searching for a few days of how to do it in cypher. Figured I should first make sure it isn't in there, before I come here with a question.

It is so annoying that so much of the stuff that should be in cypher is in APOC. Which has a totally different style, and also the documentation is so bad / simple. It is forcing you to learn two separate things at the same time, whilst cypher is the basis that you should learn first.

This was exactly what I needed.

match (t:Toy)-[p:SOLD_BY]-()

return apoc.meta.type(p.SalesPrice)

It worked perfectly, I could see that the price was set to string, instead of being a float. That was messing up my "ORDER BY", but I wasn't sure what the field type was. Some how toFloat we were discussing last time, didn't add the values as floats, but as strings, have to look again what I did wrong.

Really thanks for this.

I hear you. I will say this. My guess is it's a big burden to tweak the Cypher language to add what seems to be simple functions.

(That might be due to a design choice where somebody didn't think enough about extensibility. Or maybe it's just hard to add functions to a declarative language. Maybe implementing Neo4J in Java makes this harder. I don't know for sure... I may look dumb for speculating on this....)

With APOC, it's much easier to add new functionality, especially if it already exists in Java libraries, so that's why you find so many functions pushed into APOC.

Creating good technical documentation is hard. I've been proposing edits and making pull requests for my edits as I better understand Cypher. I would say overall, Neo4J has done a pretty good job but they are moving very fast, so documentation has a hard time to keep up. But of various software systems I've had to deal with in the last few years, I think Neo4J is way above average.

And of course, if you're too close to the product, it's harder to put yourself in a newbie's shoes and explain things clearly. Some of Neo4J's documentation suffers from that, but overall the tutorial materials are very good.

Where did you look that the explanation was missing? You can suggest a change (or if it's under version control, I could make an edit and do a pull request. I'm not part of Neo4J)