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.

Unable to access values from mapping after xml import

Hello,
relative newbie user of neo4j here. I had code that ran 2 years on version 3.4 but doesn't anymore on version 4.2. So I managed to rewrite some of it but I'm stuck now on the rest.
I am trying to match data from an animal disease ontology xml file to update some nodes.

here is some working code. It finds all nodes with a given property then matches all mappings.
it returns a mapping with 2 properties. this is expected behavior.

MATCH (n :Disease) where n.ADO_ID starts with 'MH'
CALL apoc.load.xml("ADO_edit2.xml",'', {}, true)
YIELD value
UNWIND value._RDF as rdf
UNWIND rdf as path
match (path) where path.`rdf:about` = n.ADO_ID
unwind path._Class as p2
WITH p2 as path2,
n as dis
CALL {
with path2
match (path2) where path2._type = 'subClassOf'
unwind path2._subClassOf as de2
match (de2) where de2._Restriction[0].`rdf:resource` = "hasCause"
return de2 as de3 
}
return de3, keys(de3), de3._type, dis LIMIT 10

As i said, this bit works fine. It returns the following data (shown here as table):

de3 keys(de3) de3._type dis
{"_type":Restriction,"_Restriction":[{"_type":onProperty,"rdf:resource":hasCause},{"_type":someValuesFrom,"rdf:resource":AG401}]} [_type,_Restriction] Restriction {"ADO_ID":MH1,"name":Acanthocephalosis (Fish)}
{"_type":Restriction,"_Restriction":[{"_type":onProperty,"rdf:resource":hasCause},{"_type":someValuesFrom,"rdf:resource":AG399}]} [_type,_Restriction] Restriction {"ADO_ID":MH1,"name":Acanthocephalosis (Fish)}
{"_type":Restriction,"_Restriction":[{"_type":onProperty,"rdf:resource":hasCause},{"_type":someValuesFrom,"rdf:resource":AG400}]} [_type,_Restriction] Restriction {"ADO_ID":MH1,"name":Acanthocephalosis (Fish)}

however, if I try to return "de3._Restriction" ( or de3._Restriction), which is a list, or any value nested in it, I get an error:

I cannot access this mapping
I've had this problem with the same error for nearly all my import scripts that used to work previously. Some i could rewrite but this one is confusing me. How can i access this mapping?

Any help would be greatly appreciated!! Thanks and happy new year

4 REPLIES 4

Can you share the XML source data to reproduce, looks like a Cypher bug, so best would be to raise a GH issue here with a minimal statement and XML file to reproduce.

Hi and thanks for the reply.
The xml file is here: ADO_edit.xml - Google Drive

Hope this helps narrow it down

Did you create the GH issue?

One thing you can try is to use cypher runtime=slotted as prefix to your query and see if that helps (if yes please mention it in the GH issue)

Hi, yes it's reported in github now.
Hope they figure it out, I have a lot riding on being able to rebuild the graph I had previously.