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.

Importing from XML with multiple relationships

delboy
Node Link

Hi,

Neo4j 3.5.6 Desktop, Windows 10.

I'm trying to re-create the database described here: https://dzone.com/articles/neo4j-and-virtual-nodesrelationships.

The code in GitHub (https://github.com/scsosna99/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: https://gist.github.com/derekmcloughlin/df75a0b83919a485fb11d8b720968766

The code is here: https://gist.github.com/derekmcloughlin/65e66e97ac35b7d2f46c96620c683298, 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
match(r)-[:FILED]->(f)
match(lo)-[:LOBBYING_FOR]->(f)
create(r)-[:EMPLOYS]->(lo)

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

Any pointers would be appreciated.

Regards,

Derek.

1 REPLY 1

delboy
Node Link

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"/>
</Filing>

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)

Derek.