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