apoc icon indicating copy to clipboard operation
apoc copied to clipboard

The apoc.export.graphml.query export additional unwanted nodes

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

Issue by vga91 Monday May 16, 2022 at 10:05 GMT Originally opened as https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/2890


If we want to execute something like this use case, but via apoc.export.graphml.query instead of apoc.export.graphml.data, the relationships file's export will add additional unwanted nodes.

Expected Behavior (Mandatory)

Should import only relationships

Actual Behavior (Mandatory)

Import start and end nodes as well

How to Reproduce the Problem

Create a simple rel:

CREATE (:Start {id: 1})-[:REL {foo: 'bar'}]->(:End {id: '1'})

Execute this query:

call apoc.export.graphml.query("MATCH (start:Start)-[rel:REL]->(end:End) RETURN rel", null, {stream: true})
YIELD  data

Note that the data result contains <node...> tags::

"<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<key id="labels" for="node" attr.name="labels"/>
<key id="foo" for="edge" attr.name="foo"/>
<key id="label" for="edge" attr.name="label"/>
<graph id="G" edgedefault="directed">
<node id="n14" labels=":Start"><data key="labels">:Start</data><data key="id">1</data></node>
<node id="n15" labels=":End"><data key="labels">:End</data><data key="id">1</data></node>
<edge id="e13" source="n14" target="n15" label="REL"><data key="label">REL</data><data key="foo">bar</data></edge>
</graph>
</graphml>
"

Versions

  • OS: OSX
  • Neo4j: 4.4.0.5
  • Neo4j-Apoc: 4.4.5