CALL apoc.load.xml("file:///xxxx/xx.xml")
YIELD value
UNWIND value._children AS GraphicElements
WITH GraphicElements,GraphicElements._children as EmbeddedSymbols
with GraphicElements, EmbeddedSymbols,
[x in EmbeddedSymbols where x._type = 'EmbeddedSymbol'][0] as embeddedSymbol
with embeddedSymbol.Name as name,embeddedSymbol
return embeddedSymbol,name
EmbeddedSymbol is an XML tag and name is property of this tag , this query returned 5 null records and 1 non-null record , actually I need to create "EmbeddedSymbol" Node and Set "Name" as its unique property .
so i wrote the following query to check if the value is not null and pass name value to it but i faced a lot of errors :
CALL apoc.load.xml("file:///xxxx/xx.xml")
YIELD value
UNWIND value._children AS GraphicElements
WITH GraphicElements,GraphicElements._children as EmbeddedSymbols
with GraphicElements, EmbeddedSymbols,
[x in EmbeddedSymbols where x._type = 'EmbeddedSymbol'][0] as embeddedSymbol
with embeddedSymbol.Name as name,embeddedSymbol
call apoc.do.when(
embeddedSymbol IS NOT NULL,
'MERGE (e:EmbeddedSymbol{Name:name})',
{name:name}
)
The current Error is :
Type mismatch: expected String but was Map (line 11, column 2 (offset: 461))
" {name:name}"