Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-30-2022 06:52 PM - last edited on 07-11-2022 09:20 AM by TrevorS
Hello guys,
I have an issue and could need some help, because its a bit frustrating.
I wanted to use the apoc.load.xml to import some data and create also Nodes and Properties with them.
I've tried this one and it worked well:
The Graph-Part should look like this (executed 3 times) :
The grey and Green nodes will be created and the other exist allready.
My problem is, that it doesnt work with several childrens (level).
I've tried this and got nothing (no changes, no records):
The Ressource-Node (pink) already contains the value "oversight", without "-info".
The hierarchy of value.children looks like this (needed parts)
:
Would be nice to get some advice what to do next. Did I missed something or missunderstood?
Solved! Go to Solution.
07-02-2022 08:58 PM
Sorry, it is very difficult to solution this without the xml. I tried my best to reverse engineer it from your second query and the screenshot of the root from the xml load. I could not test it without the xml. Let me know if there are issues and we can try to resolve them.
call apoc.load.xml("file:///file.xml") yield value
with value._children as root
with [x in root where x._type = "oversight_info"][0]._children as oversight_info,
[x in root where x._type = "id_info"][0]._children as id_info
with [x in oversight_info where x._type = 'has_dmc'][0] as has_dmc
[x in id_info where x._type = 'ncd_id'][0] as ncd_id
match(r:Resource{ns1__title: "oversight"})
merge(o:Oversight{has_dmc: has_dmc._text})
merge(t:Trial{nctid:ncd_id._text})
merge(o)-[:SCO]->(t)
merge(o)-[:INCLUDE]->(:Resource{ns1__title:'has dmc'})
merge(t)-[:IN_CAT]->(r)
07-01-2022 03:16 AM - edited 07-01-2022 03:27 AM
I am confused on what you want. Each query does different things. Can you explain what result you want from the xml? Are you able to share the xml file?
07-01-2022 04:06 AM - edited 07-01-2022 04:09 AM
I want the same result like the first part with the url-value on the file:
- New Node "Oversight"(Grey) with the Prop. "has_dmc" and their value from the xml
- New Node "Trial" (Green) with the Pro. "nct_id" and their value from the xml
- Rel.: :Oversight -SCO-> :Trial -IN_CAT-> :Resource(Pink)
- The Resource-Node already exist and has the Prop. ns1__title: "oversight" #
I've tried this one (~30:28) https://www.youtube.com/watch?v=WdClRB_-Egs , but with creating Nodes´, not RETURN
I am not able to share an xml file here, but this is the part you need:
<clinical_study>
<!-- This xml conforms to an XML Schema at:
https://clinicaltrials.gov/ct2/html/images/info/public.xsd -->
<required_header>
<download_date>ClinicalTrials.gov processed this data on June 24, 2022</download_date>
<link_text>Link to the current ClinicalTrials.gov record.</link_text>
<url>https://clinicaltrials.gov/show/NCT00170157</url>
</required_header>
<id_info>
<org_study_id>MC0253</org_study_id>
<secondary_id>NCI-2009-01214</secondary_id>
<secondary_id>MC0253</secondary_id>
<secondary_id>P30CA015083</secondary_id>
<nct_id>NCT00170157</nct_id>
</id_info>
.........
<oversight_info>
<has_dmc>No</has_dmc>
</oversight_info>
.......
</clinical_study>
07-02-2022 08:58 PM
Sorry, it is very difficult to solution this without the xml. I tried my best to reverse engineer it from your second query and the screenshot of the root from the xml load. I could not test it without the xml. Let me know if there are issues and we can try to resolve them.
call apoc.load.xml("file:///file.xml") yield value
with value._children as root
with [x in root where x._type = "oversight_info"][0]._children as oversight_info,
[x in root where x._type = "id_info"][0]._children as id_info
with [x in oversight_info where x._type = 'has_dmc'][0] as has_dmc
[x in id_info where x._type = 'ncd_id'][0] as ncd_id
match(r:Resource{ns1__title: "oversight"})
merge(o:Oversight{has_dmc: has_dmc._text})
merge(t:Trial{nctid:ncd_id._text})
merge(o)-[:SCO]->(t)
merge(o)-[:INCLUDE]->(:Resource{ns1__title:'has dmc'})
merge(t)-[:IN_CAT]->(r)
07-04-2022 06:39 AM
Thank you very much. I did not knew, that I can make seperate "with" with the use of the new variable. I thought I have to unwind that stuff.
All the sessions of the conference are now available online