Viewing Property Types Stored in the Graph

Confirming types in the graph

Neo4j Browser returns datetime properties as strings and it is sometimes hard to determine what the type stored in the graph is.

For example, here we return the born property of five Person nodes.

Born property

In Neo4j Browser, the born property appears like a string, but it is not a string. We can actually extract the year from the property because it is a datetime:

Born property year

As you move closer to the data model, you may want to confirm that the properties in the graph represent the types in the data model.

You can use this Cypher code to show the stored types for the node properties in the graph:

Cypher
Unresolved directive in lesson.adoc - include::{repository-raw}/main/shared/apoc-meta-nodetypeproperties.cypher[]
Meta types of node properties

And you can do the same type of investigation of types for relationship properties:

Cypher
Unresolved directive in lesson.adoc - include::{repository-raw}/main/shared/apoc-meta-reltypeproperties.cypher[]
Meta types of relationship properties

Check your understanding

Viewing types in the graph

What procedures can you call to view the types for properties stored in the graph?

  • ✓ apoc.meta.nodeTypeProperties()

  • ❏ db.getNodeTypes()

  • ✓ apoc.meta.relTypeProperties()

  • ❏ db.getRelTypes()

Hint

You can use these two procedures to return information about the node and relationship properties in the graph.

Solution

When you convert a string to a Date value:

  • apoc.meta.nodeTypeProperties()

  • apoc.meta.relTypeProperties()

Summary

In this lesson, you learned about some of transformations you need to do to load CSV data into your graph where the data types match the graph data model. In the next challenge, you practice transforming data the data that you previously imported from CSV files.