Importing from XML with multiple relationships


Neo4j 3.5.6 Desktop, Windows 10.

I'm trying to re-create the database described here:

The code in GitHub (GitHub - scsosna99/lobbying-filings: Neo4J database loaded with info from US federal lobbying filings) uses a custom Java importer to import XML, but I want to use the standard XML import (apoc.load.xml) to do the same.

Here's an example of one of the XML files: 2015_1_1_1.xml · GitHub

The code is here: Importing lobbyist XML data using APOC · GitHub, and works except for the bit where I want to create the :ENGAGES and :EMPLOYS relationships.

How do I create the relationship between Registrant and Lobbyist?

The part that's failing is between lines 32 and 35

with filing, f, item, clients, registrants, lobbyists, governmentEntities, issues

It's creating a cartesian product instead of the relationships I want for each individual filing.

Any pointers would be appreciated.



While I solved my original issue of getting the data into Neo4j using a Python script, I'm still curious as to how you can get a relationship between Registrant and Client for the following XML:

<Filing ID="14AFF42F-8974-478F-A22E-83915A603154" Year="2014" >
    <Registrant RegistrantID="313715" RegistrantName="Capitol Counsel LLC" />
    <Client ClientName="Tompkins Strategies"/>

I can easily create a relationship between Filing and Client and Registrant on the import, but can't figure how to get (Client)- [:ENGAGES]->(Registrant)