apoc icon indicating copy to clipboard operation
apoc copied to clipboard

Export graphml, ignores types even if set to useTypes: true in config

Open neo-technology-build-agent opened this issue 2 years ago • 3 comments

Issue by stefan-sev Monday Aug 21, 2017 at 12:36 GMT Originally opened as https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/556


Given scenario:

'Create (:Test{limit: 1500000000000}), (:Test{limit: 2})' Returns 2 nodes with the same label and the same properties, but once it is saved as int and the other time it is saved as long.

Now if I will create a dump in graphml with Types, there will be no key for limit and so for no types at all.

Here are to Code fragments causing this:

First it will set the type of limit to Long and on the second cycle it compares Long with int and sets the type to void.

https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/337b2e12401c0df95e44db0922946d9f5c643115/src/main/java/apoc/export/util/MetaInformation.java#L36-L47

Type void will be ignored.

https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/337b2e12401c0df95e44db0922946d9f5c643115/src/main/java/apoc/export/util/MetaInformation.java#L52

Possible solutions:

  1. Aggregate types of key to the biggest type. In this example Long

Problem: What if there are two different Nodes, one node sets limit to String, the other node sets limit to Long. What type should be chosen?

  1. Additional attribute type on data level instead of key block

Every data element defines the type separately, but this could be redundant information.