Skip to content

Instantly share code, notes, and snippets.

@georgebrock
Last active August 31, 2021 04:40
Show Gist options
  • Select an option

  • Save georgebrock/df69c34fbbff53407963 to your computer and use it in GitHub Desktop.

Select an option

Save georgebrock/df69c34fbbff53407963 to your computer and use it in GitHub Desktop.

Revisions

  1. georgebrock revised this gist Dec 28, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -132,7 +132,7 @@ MERGE (uat)-[:IDENTIFIES]->(pubkey);
    RETURN TIMESTAMP();

    // Create PubKey SIGNS PubKey relationships
    // status: failed (null)
    // status: success (182678 relationships created)
    USING PERIODIC COMMIT 500
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    @@ -150,7 +150,7 @@ MERGE (signer)-[:SIGNS {
    RETURN TIMESTAMP();

    // Create SubKey SIGNS PubKey relationships
    // status: failed (null)
    // status: failed after 136ms (null)
    USING PERIODIC COMMIT 500
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
  2. georgebrock revised this gist Dec 28, 2014. 1 changed file with 52 additions and 48 deletions.
    100 changes: 52 additions & 48 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -1,53 +1,55 @@
    // Create indices
    // status: success
    CREATE CONSTRAINT ON (uid:UID) ASSERT uid.uuid IS UNIQUE;
    CREATE INDEX ON :UID(uuid);
    CREATE INDEX ON :UID(pubkey_uuid);
    CREATE CONSTRAINT ON (pk:PubKey) ASSERT pk.uuid IS UNIQUE;
    CREATE INDEX ON :PubKey(uuid);
    CREATE INDEX ON :PubKey(r_keyid);
    CREATE CONSTRAINT ON (sk:SubKey) ASSERT sk.uuid IS UNIQUE;
    CREATE INDEX ON :SubKey(uuid);
    CREATE INDEX ON :SubKey(r_keyid);
    CREATE CONSTRAINT ON (uat:UAT) ASSERT uat.uuid IS UNIQUE;
    CREATE INDEX ON :UAT(uuid);

    RETURN TIMESTAMP();

    // Load UIDs
    // status: success (4433416 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uid.csv" AS row
    MERGE (uid:UID { uuid: row.uuid })
    ON CREATE SET
    uid.creation = row.creation,
    uid.expiration = row.expiration,
    uid.state = row.state,
    uid.packet = row.packet,
    uid.revsig_uuid = row.revsig_uuid,
    uid.keywords = row.keywords,
    uid.keywords_fulltext = row.keywords_fulltext,
    uid.pubkey_uuid = row.pubkey_uuid;
    CREATE (uid:UID {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    revsig_uuid: row.revsig_uuid,
    keywords: row.keywords,
    keywords_fulltext: row.keywords_fulltext,
    pubkey_uuid: row.pubkey_uuid
    });

    RETURN TIMESTAMP();

    // Load PubKeys
    // status: success (3788102 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    MERGE (pubkey:PubKey { uuid: row.uuid })
    ON CREATE SET
    pubkey.r_keyid = row.r_keyid,
    pubkey.creation = row.creation,
    pubkey.expiration = row.expiration,
    pubkey.state = row.state,
    pubkey.packet = row.packet,
    pubkey.ctime = row.ctime,
    pubkey.mtime = row.mtime,
    pubkey.md5 = row.md5,
    pubkey.sha256 = row.sha256,
    pubkey.revsig_uuid = row.revsig_uuid,
    pubkey.primary_uid = row.primary_uid,
    pubkey.primary_uat = row.primary_uat,
    pubkey.algorithm = row.algorithm,
    pubkey.bit_len = row.bit_len,
    pubkey.unsupp = row.unsupp;
    CREATE (pubkey:PubKey {
    r_keyid: row.r_keyid,
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    ctime: row.ctime,
    mtime: row.mtime,
    md5: row.md5,
    sha256: row.sha256,
    revsig_uuid: row.revsig_uuid,
    primary_uid: row.primary_uid,
    primary_uat: row.primary_uat,
    algorithm: row.algorithm,
    bit_len: row.bit_len,
    unsupp: row.unsupp
    });

    RETURN TIMESTAMP();

    @@ -77,16 +79,17 @@ RETURN TIMESTAMP();
    // status: success (3524655 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_subkey.csv" AS row
    MERGE (subkey:SubKey { uuid: row.uuid })
    ON CREATE SET
    subkey.r_keyid = row.r_keyid,
    subkey.creation = row.creation,
    subkey.expiration = row.expiration,
    subkey.state = row.state,
    subkey.packet = row.packet,
    subkey.revsig_uuid = row.revsig_uuid,
    subkey.algorithm = row.algorithm,
    subkey.bit_len = row.bit_len;
    CREATE (subkey:SubKey {
    r_keyid: row.r_keyid,
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    revsig_uuid: row.revsig_uuid,
    algorithm: row.algorithm,
    bit_len: row.bit_len
    });

    RETURN TIMESTAMP();

    @@ -106,13 +109,14 @@ RETURN TIMESTAMP();
    // status: success (61235 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uat.csv" AS row
    MERGE (uat:UAT { uuid: row.uuid })
    ON CREATE SET
    uat.creation = row.creation,
    uat.expiration = row.expiration,
    uat.state = row.state,
    uat.packet = row.packet,
    uat.revsig_uuid = row.revsig_uuid;
    CREATE (uat:UAT {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    revsig_uuid: row.revsig_uuid
    });

    RETURN TIMESTAMP();

  3. georgebrock revised this gist Dec 28, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions import
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    #!/bin/sh

    (date; neo4j-shell < import.cypher 2>&1; date) | tee output
  4. georgebrock revised this gist Dec 28, 2014. 1 changed file with 44 additions and 48 deletions.
    92 changes: 44 additions & 48 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -14,42 +14,40 @@ RETURN TIMESTAMP();
    // status: success (4433416 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uid.csv" AS row
    CREATE (uid:UID {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    revsig_uuid: row.revsig_uuid,
    keywords: row.keywords,
    keywords_fulltext: row.keywords_fulltext,
    pubkey_uuid: row.pubkey_uuid
    });
    MERGE (uid:UID { uuid: row.uuid })
    ON CREATE SET
    uid.creation = row.creation,
    uid.expiration = row.expiration,
    uid.state = row.state,
    uid.packet = row.packet,
    uid.revsig_uuid = row.revsig_uuid,
    uid.keywords = row.keywords,
    uid.keywords_fulltext = row.keywords_fulltext,
    uid.pubkey_uuid = row.pubkey_uuid;

    RETURN TIMESTAMP();

    // Load PubKeys
    // status: success (3788102 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    CREATE (pubkey:PubKey {
    r_keyid: row.r_keyid,
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    ctime: row.ctime,
    mtime: row.mtime,
    md5: row.md5,
    sha256: row.sha256,
    revsig_uuid: row.revsig_uuid,
    primary_uid: row.primary_uid,
    primary_uat: row.primary_uat,
    algorithm: row.algorithm,
    bit_len: row.bit_len,
    unsupp: row.unsupp
    });
    MERGE (pubkey:PubKey { uuid: row.uuid })
    ON CREATE SET
    pubkey.r_keyid = row.r_keyid,
    pubkey.creation = row.creation,
    pubkey.expiration = row.expiration,
    pubkey.state = row.state,
    pubkey.packet = row.packet,
    pubkey.ctime = row.ctime,
    pubkey.mtime = row.mtime,
    pubkey.md5 = row.md5,
    pubkey.sha256 = row.sha256,
    pubkey.revsig_uuid = row.revsig_uuid,
    pubkey.primary_uid = row.primary_uid,
    pubkey.primary_uat = row.primary_uat,
    pubkey.algorithm = row.algorithm,
    pubkey.bit_len = row.bit_len,
    pubkey.unsupp = row.unsupp;

    RETURN TIMESTAMP();

    @@ -79,17 +77,16 @@ RETURN TIMESTAMP();
    // status: success (3524655 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_subkey.csv" AS row
    CREATE (subkey:SubKey {
    r_keyid: row.r_keyid,
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    revsig_uuid: row.revsig_uuid,
    algorithm: row.algorithm,
    bit_len: row.bit_len
    });
    MERGE (subkey:SubKey { uuid: row.uuid })
    ON CREATE SET
    subkey.r_keyid = row.r_keyid,
    subkey.creation = row.creation,
    subkey.expiration = row.expiration,
    subkey.state = row.state,
    subkey.packet = row.packet,
    subkey.revsig_uuid = row.revsig_uuid,
    subkey.algorithm = row.algorithm,
    subkey.bit_len = row.bit_len;

    RETURN TIMESTAMP();

    @@ -109,14 +106,13 @@ RETURN TIMESTAMP();
    // status: success (61235 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uat.csv" AS row
    CREATE (uat:UAT {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    revsig_uuid: row.revsig_uuid
    });
    MERGE (uat:UAT { uuid: row.uuid })
    ON CREATE SET
    uat.creation = row.creation,
    uat.expiration = row.expiration,
    uat.state = row.state,
    uat.packet = row.packet,
    uat.revsig_uuid = row.revsig_uuid;

    RETURN TIMESTAMP();

  5. georgebrock revised this gist Dec 28, 2014. 1 changed file with 34 additions and 0 deletions.
    34 changes: 34 additions & 0 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,8 @@ CREATE CONSTRAINT ON (sk:SubKey) ASSERT sk.uuid IS UNIQUE;
    CREATE INDEX ON :SubKey(r_keyid);
    CREATE CONSTRAINT ON (uat:UAT) ASSERT uat.uuid IS UNIQUE;

    RETURN TIMESTAMP();

    // Load UIDs
    // status: success (4433416 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    @@ -24,6 +26,8 @@ CREATE (uid:UID {
    pubkey_uuid: row.pubkey_uuid
    });

    RETURN TIMESTAMP();

    // Load PubKeys
    // status: success (3788102 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    @@ -47,6 +51,8 @@ CREATE (pubkey:PubKey {
    unsupp: row.unsupp
    });

    RETURN TIMESTAMP();

    // Create UID IDENTIFIES PubKey relationships
    // status: success (4435853 relationships created)
    USING PERIODIC COMMIT 500
    @@ -56,6 +62,8 @@ MATCH (pubkey:PubKey {uuid: row.uuid})
    MATCH (uid:UID {pubkey_uuid: row.uuid})
    MERGE (uid)-[:IDENTIFIES]->(pubkey);

    RETURN TIMESTAMP();

    // Create PubKey PRIMARILY_IDENTIFIED_BY UID relationships
    // status: success (3788697 relationships created)
    USING PERIODIC COMMIT 500
    @@ -65,6 +73,8 @@ MATCH (pubkey:PubKey {uuid: row.uuid})
    MATCH (primary_uid:UID {uuid: row.primary_uid})
    MERGE (pubkey)-[:PRIMARILY_IDENTIFIED_BY]->(primary_uid);

    RETURN TIMESTAMP();

    // Load SubKeys
    // status: success (3524655 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    @@ -81,6 +91,8 @@ CREATE (subkey:SubKey {
    bit_len: row.bit_len
    });

    RETURN TIMESTAMP();

    // Create SubKey BELONGS_TO PubKey relationships
    // status: success (3525090 relationships created; 435 more than CSV but there
    // are some duplicate PubKeys in the database)
    @@ -91,6 +103,8 @@ MATCH (subkey:SubKey {uuid: row.uuid})
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (subkey)-[:BELONGS_TO]->(pubkey);

    RETURN TIMESTAMP();

    // Load UATs
    // status: success (61235 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    @@ -104,6 +118,8 @@ CREATE (uat:UAT {
    revsig_uuid: row.revsig_uuid
    });

    RETURN TIMESTAMP();

    // Created UAT IDENTIFIES relationships
    // status: success (61240 relationships created; more than the CSV)
    USING PERIODIC COMMIT 1000
    @@ -113,6 +129,8 @@ MATCH (uat:UAT {uuid: row.uuid})
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (uat)-[:IDENTIFIES]->(pubkey);

    RETURN TIMESTAMP();

    // Create PubKey SIGNS PubKey relationships
    // status: failed (null)
    USING PERIODIC COMMIT 500
    @@ -129,6 +147,8 @@ MERGE (signer)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    RETURN TIMESTAMP();

    // Create SubKey SIGNS PubKey relationships
    // status: failed (null)
    USING PERIODIC COMMIT 500
    @@ -145,6 +165,8 @@ MERGE (signer_subkey)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    RETURN TIMESTAMP();

    // Create SubKey SIGNS SubKey relationships
    // status: success (311 relationships created; with PubKeys, 197 short of the CSV)
    USING PERIODIC COMMIT 500
    @@ -161,6 +183,8 @@ MERGE (signer)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    RETURN TIMESTAMP();

    // Create PubKey SIGNS SubKey relationships
    // status: success (3661324 relationships created; with SubKeys, 197 short of the CSV)
    USING PERIODIC COMMIT 500
    @@ -177,6 +201,8 @@ MERGE (signer)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    RETURN TIMESTAMP();

    // Create SubKey SIGNS UID relationships
    // status: success (1126 relationships created)
    USING PERIODIC COMMIT 500
    @@ -193,6 +219,8 @@ MERGE (signer)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    RETURN TIMESTAMP();

    // Create PubKey SIGNS UID relationships
    // status: failed (errored)
    // java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
    @@ -232,6 +260,8 @@ MERGE (signer)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    RETURN TIMESTAMP();

    // Create SubKey SIGNS UAT relationships
    // status: pending
    USING PERIODIC COMMIT 1000
    @@ -248,6 +278,8 @@ MERGE (signer)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    RETURN TIMESTAMP();

    // Create PubKey SIGNS UAT relationships
    // status: pending
    USING PERIODIC COMMIT 1000
    @@ -263,3 +295,5 @@ MERGE (signer)-[:SIGNS {
    packet: row.packet,
    sig_type: row.sig_type
    }]->(signed);

    RETURN TIMESTAMP();
  6. georgebrock revised this gist Dec 28, 2014. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    // Create indices
    // status: success
    CREATE INDEX ON :UID(uuid);
    CREATE CONSTRAINT ON (uid:UID) ASSERT uid.uuid IS UNIQUE;
    CREATE INDEX ON :UID(pubkey_uuid);
    CREATE INDEX ON :PubKey(uuid);
    CREATE CONSTRAINT ON (pk:PubKey) ASSERT pk.uuid IS UNIQUE;
    CREATE INDEX ON :PubKey(r_keyid);
    CREATE INDEX ON :SubKey(uuid);
    CREATE CONSTRAINT ON (sk:SubKey) ASSERT sk.uuid IS UNIQUE;
    CREATE INDEX ON :SubKey(r_keyid);
    CREATE INDEX ON :UAT(uuid);
    CREATE CONSTRAINT ON (uat:UAT) ASSERT uat.uuid IS UNIQUE;

    // Load UIDs
    // status: success (4433416 nodes created; matches CSV)
  7. georgebrock revised this gist Dec 22, 2014. 1 changed file with 32 additions and 13 deletions.
    45 changes: 32 additions & 13 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -115,13 +115,12 @@ MERGE (uat)-[:IDENTIFIES]->(pubkey);

    // Create PubKey SIGNS PubKey relationships
    // status: failed (null)
    USING PERIODIC COMMIT 1000
    USING PERIODIC COMMIT 500
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    OPTIONAL MATCH (signer_pubkey:PubKey {r_keyid: row.signer})
    WHERE signer_pubkey IS NOT NULL
    MERGE (signer_pubkey)-[:SIGNS {
    MATCH (signer:PubKey {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    @@ -132,12 +131,11 @@ MERGE (signer_pubkey)-[:SIGNS {

    // Create SubKey SIGNS PubKey relationships
    // status: failed (null)
    USING PERIODIC COMMIT 1000
    USING PERIODIC COMMIT 500
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    OPTIONAL MATCH (signer_subkey:SubKey {r_keyid: row.signer})
    WHERE signer_subkey IS NOT NULL
    MERGE (signer_subkey)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    @@ -149,12 +147,11 @@ MERGE (signer_subkey)-[:SIGNS {

    // Create SubKey SIGNS SubKey relationships
    // status: success (311 relationships created; with PubKeys, 197 short of the CSV)
    USING PERIODIC COMMIT 1000
    USING PERIODIC COMMIT 500
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    MATCH (signer:SubKey {r_keyid: row.signer})
    WHERE signer IS NOT NULL
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    @@ -166,12 +163,11 @@ MERGE (signer)-[:SIGNS {

    // Create PubKey SIGNS SubKey relationships
    // status: success (3661324 relationships created; with SubKeys, 197 short of the CSV)
    USING PERIODIC COMMIT 1000
    USING PERIODIC COMMIT 500
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    MATCH (signer:PubKey {r_keyid: row.signer})
    WHERE signer IS NOT NULL
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    @@ -183,7 +179,7 @@ MERGE (signer)-[:SIGNS {

    // Create SubKey SIGNS UID relationships
    // status: success (1126 relationships created)
    USING PERIODIC COMMIT 1000
    USING PERIODIC COMMIT 500
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
    @@ -198,8 +194,31 @@ MERGE (signer)-[:SIGNS {
    }]->(signed);

    // Create PubKey SIGNS UID relationships
    // status: failed (stopped)
    USING PERIODIC COMMIT 1000
    // status: failed (errored)
    // java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
    // java.net.SocketException: Operation timed out
    // at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:228)
    // at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
    // at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
    // at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
    // at com.sun.proxy.$Proxy1.interpretLine(Unknown Source)
    // at org.neo4j.shell.impl.AbstractClient.evaluate(AbstractClient.java:110)
    // at org.neo4j.shell.impl.AbstractClient.evaluate(AbstractClient.java:94)
    // at org.neo4j.shell.impl.AbstractClient.grabPrompt(AbstractClient.java:74)
    // at org.neo4j.shell.StartClient.grabPromptOrJustExecuteCommand(StartClient.java:357)
    // at org.neo4j.shell.StartClient.startRemote(StartClient.java:303)
    // at org.neo4j.shell.StartClient.start(StartClient.java:175)
    // at org.neo4j.shell.StartClient.main(StartClient.java:120)
    // Caused by: java.net.SocketException: Operation timed out
    // at java.net.SocketInputStream.socketRead0(Native Method)
    // at java.net.SocketInputStream.read(SocketInputStream.java:152)
    // at java.net.SocketInputStream.read(SocketInputStream.java:122)
    // at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    // at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
    // at java.io.DataInputStream.readByte(DataInputStream.java:265)
    // at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:214)
    // ... 11 more
    USING PERIODIC COMMIT 500
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
  8. georgebrock revised this gist Dec 18, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion import.cypher
    Original file line number Diff line number Diff line change
    @@ -57,7 +57,7 @@ MATCH (uid:UID {pubkey_uuid: row.uuid})
    MERGE (uid)-[:IDENTIFIES]->(pubkey);

    // Create PubKey PRIMARILY_IDENTIFIED_BY UID relationships
    // status: pending
    // status: success (3788697 relationships created)
    USING PERIODIC COMMIT 500
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    WITH *
  9. georgebrock revised this gist Dec 16, 2014. 1 changed file with 12 additions and 18 deletions.
    30 changes: 12 additions & 18 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -47,28 +47,22 @@ CREATE (pubkey:PubKey {
    unsupp: row.unsupp
    });

    // Create UID IDENTIFIES PubKey and PubKey PRIMARILY_IDENTIFIED_BY UID
    // relationships
    // status: failed (java.lang.OutOfMemoryError: Java heap space)
    // possible alternative:
    // // Create UID IDENTIFIES PubKey relationships
    // MATCH (k:PubKey)
    // MATCH (u:UID)
    // WHERE k.uuid = u.pubkey_uuid
    // MERGE (u)-[:IDENTIFIES]->(k);
    //
    // // Create PubKey PRIMARILY_IDENTIFIED_BY UID relationships
    // MATCH (k:PubKey)
    // MATCH (u:UID)
    // WHERE k.primary_uid = u.uuid
    // MERGE (k)-[:PRIMARILY_IDENTIFIED_BY]->(u);
    USING PERIODIC COMMIT 1000
    // Create UID IDENTIFIES PubKey relationships
    // status: success (4435853 relationships created)
    USING PERIODIC COMMIT 500
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    WITH *
    MATCH (pubkey:PubKey {uuid: row.uuid})
    MATCH (primary_uid:UID {uuid: row.primary_uid})
    MATCH (uid:UID {pubkey_uuid: row.uuid})
    MERGE (uid)-[:IDENTIFIES]->(pubkey)
    MERGE (uid)-[:IDENTIFIES]->(pubkey);

    // Create PubKey PRIMARILY_IDENTIFIED_BY UID relationships
    // status: pending
    USING PERIODIC COMMIT 500
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    WITH *
    MATCH (pubkey:PubKey {uuid: row.uuid})
    MATCH (primary_uid:UID {uuid: row.primary_uid})
    MERGE (pubkey)-[:PRIMARILY_IDENTIFIED_BY]->(primary_uid);

    // Load SubKeys
  10. georgebrock revised this gist Dec 15, 2014. 1 changed file with 49 additions and 10 deletions.
    59 changes: 49 additions & 10 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    // Create indices
    // status: success
    CREATE INDEX ON :UID(uuid);
    CREATE INDEX ON :UID(pubkey_uuid);
    CREATE INDEX ON :PubKey(uuid);
    @@ -6,6 +8,8 @@ CREATE INDEX ON :SubKey(uuid);
    CREATE INDEX ON :SubKey(r_keyid);
    CREATE INDEX ON :UAT(uuid);

    // Load UIDs
    // status: success (4433416 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uid.csv" AS row
    CREATE (uid:UID {
    @@ -20,6 +24,8 @@ CREATE (uid:UID {
    pubkey_uuid: row.pubkey_uuid
    });

    // Load PubKeys
    // status: success (3788102 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    CREATE (pubkey:PubKey {
    @@ -39,8 +45,23 @@ CREATE (pubkey:PubKey {
    algorithm: row.algorithm,
    bit_len: row.bit_len,
    unsupp: row.unsupp
    });
    });

    // Create UID IDENTIFIES PubKey and PubKey PRIMARILY_IDENTIFIED_BY UID
    // relationships
    // status: failed (java.lang.OutOfMemoryError: Java heap space)
    // possible alternative:
    // // Create UID IDENTIFIES PubKey relationships
    // MATCH (k:PubKey)
    // MATCH (u:UID)
    // WHERE k.uuid = u.pubkey_uuid
    // MERGE (u)-[:IDENTIFIES]->(k);
    //
    // // Create PubKey PRIMARILY_IDENTIFIED_BY UID relationships
    // MATCH (k:PubKey)
    // MATCH (u:UID)
    // WHERE k.primary_uid = u.uuid
    // MERGE (k)-[:PRIMARILY_IDENTIFIED_BY]->(u);
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    WITH *
    @@ -50,6 +71,8 @@ MATCH (uid:UID {pubkey_uuid: row.uuid})
    MERGE (uid)-[:IDENTIFIES]->(pubkey)
    MERGE (pubkey)-[:PRIMARILY_IDENTIFIED_BY]->(primary_uid);

    // Load SubKeys
    // status: success (3524655 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_subkey.csv" AS row
    CREATE (subkey:SubKey {
    @@ -62,15 +85,20 @@ CREATE (subkey:SubKey {
    revsig_uuid: row.revsig_uuid,
    algorithm: row.algorithm,
    bit_len: row.bit_len
    });
    });

    // Create SubKey BELONGS_TO PubKey relationships
    // status: success (3525090 relationships created; 435 more than CSV but there
    // are some duplicate PubKeys in the database)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_subkey.csv" AS row
    WITH *
    MATCH (subkey:SubKey {uuid: row.uuid})
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (subkey)-[:BELONGS_TO]->(pubkey);

    // Load UATs
    // status: success (61235 nodes created; matches CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uat.csv" AS row
    CREATE (uat:UAT {
    @@ -80,16 +108,19 @@ CREATE (uat:UAT {
    state: row.state,
    packet: row.packet,
    revsig_uuid: row.revsig_uuid
    });
    });

    // Created UAT IDENTIFIES relationships
    // status: success (61240 relationships created; more than the CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uat.csv" AS row
    WITH *
    MATCH (uat:UAT {uuid: row.uuid})
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (uat)-[:IDENTIFIES]->(pubkey);

    // WHERE subkey_uuid IS NULL AND uid_uuid IS NULL AND uat_uuid IS NULL AND sig_uuid IS NULL
    // Create PubKey SIGNS PubKey relationships
    // status: failed (null)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    @@ -105,6 +136,8 @@ MERGE (signer_pubkey)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    // Create SubKey SIGNS PubKey relationships
    // status: failed (null)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    @@ -120,7 +153,8 @@ MERGE (signer_subkey)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    // WHERE subkey_uuid IS NOT NULL
    // Create SubKey SIGNS SubKey relationships
    // status: success (311 relationships created; with PubKeys, 197 short of the CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    @@ -136,7 +170,8 @@ MERGE (signer)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    // WHERE subkey_uuid IS NOT NULL
    // Create PubKey SIGNS SubKey relationships
    // status: success (3661324 relationships created; with SubKeys, 197 short of the CSV)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    @@ -152,7 +187,8 @@ MERGE (signer)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    // WHERE uid_uuid IS NOT NULL
    // Create SubKey SIGNS UID relationships
    // status: success (1126 relationships created)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    @@ -167,7 +203,8 @@ MERGE (signer)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    // WHERE uid_uuid IS NOT NULL
    // Create PubKey SIGNS UID relationships
    // status: failed (stopped)
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    @@ -182,7 +219,8 @@ MERGE (signer)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    // WHERE uat_uuid IS NOT NULL
    // Create SubKey SIGNS UAT relationships
    // status: pending
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uat.csv" AS row
    WITH *
    @@ -197,7 +235,8 @@ MERGE (signer)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    // WHERE uat_uuid IS NOT NULL
    // Create PubKey SIGNS UAT relationships
    // status: pending
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uat.csv" AS row
    WITH *
  11. georgebrock revised this gist Dec 15, 2014. 1 changed file with 15 additions and 15 deletions.
    30 changes: 15 additions & 15 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ CREATE INDEX ON :SubKey(uuid);
    CREATE INDEX ON :SubKey(r_keyid);
    CREATE INDEX ON :UAT(uuid);

    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uid.csv" AS row
    CREATE (uid:UID {
    uuid: row.uuid,
    @@ -20,7 +20,7 @@ CREATE (uid:UID {
    pubkey_uuid: row.pubkey_uuid
    });

    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    CREATE (pubkey:PubKey {
    r_keyid: row.r_keyid,
    @@ -41,7 +41,7 @@ CREATE (pubkey:PubKey {
    unsupp: row.unsupp
    });

    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    WITH *
    MATCH (pubkey:PubKey {uuid: row.uuid})
    @@ -50,7 +50,7 @@ MATCH (uid:UID {pubkey_uuid: row.uuid})
    MERGE (uid)-[:IDENTIFIES]->(pubkey)
    MERGE (pubkey)-[:PRIMARILY_IDENTIFIED_BY]->(primary_uid);

    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_subkey.csv" AS row
    CREATE (subkey:SubKey {
    r_keyid: row.r_keyid,
    @@ -64,14 +64,14 @@ CREATE (subkey:SubKey {
    bit_len: row.bit_len
    });

    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_subkey.csv" AS row
    WITH *
    MATCH (subkey:SubKey {uuid: row.uuid})
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (subkey)-[:BELONGS_TO]->(pubkey);

    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uat.csv" AS row
    CREATE (uat:UAT {
    uuid: row.uuid,
    @@ -82,15 +82,15 @@ CREATE (uat:UAT {
    revsig_uuid: row.revsig_uuid
    });

    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uat.csv" AS row
    WITH *
    MATCH (uat:UAT {uuid: row.uuid})
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (uat)-[:IDENTIFIES]->(pubkey);

    // WHERE subkey_uuid IS NULL AND uid_uuid IS NULL AND uat_uuid IS NULL AND sig_uuid IS NULL
    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    @@ -105,7 +105,7 @@ MERGE (signer_pubkey)-[:SIGNS {
    sig_type: row.sig_type
    }]->(signed);

    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    @@ -121,7 +121,7 @@ MERGE (signer_subkey)-[:SIGNS {
    }]->(signed);

    // WHERE subkey_uuid IS NOT NULL
    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    @@ -137,7 +137,7 @@ MERGE (signer)-[:SIGNS {
    }]->(signed);

    // WHERE subkey_uuid IS NOT NULL
    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    @@ -153,7 +153,7 @@ MERGE (signer)-[:SIGNS {
    }]->(signed);

    // WHERE uid_uuid IS NOT NULL
    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
    @@ -168,7 +168,7 @@ MERGE (signer)-[:SIGNS {
    }]->(signed);

    // WHERE uid_uuid IS NOT NULL
    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
    @@ -183,7 +183,7 @@ MERGE (signer)-[:SIGNS {
    }]->(signed);

    // WHERE uat_uuid IS NOT NULL
    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uat.csv" AS row
    WITH *
    MATCH (signed:UAT {uuid: row.uat_uuid})
    @@ -198,7 +198,7 @@ MERGE (signer)-[:SIGNS {
    }]->(signed);

    // WHERE uat_uuid IS NOT NULL
    USING PERIODIC COMMIT
    USING PERIODIC COMMIT 1000
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uat.csv" AS row
    WITH *
    MATCH (signed:UAT {uuid: row.uat_uuid})
  12. georgebrock revised this gist Dec 15, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    CREATE INDEX ON :UID(uuid);
    CREATE INDEX ON :UID(pubkey_uuid);
    CREATE INDEX ON :PubKey(uuid);
    CREATE INDEX ON :PubKey(r_keyid);
    CREATE INDEX ON :SubKey(uuid);
  13. georgebrock revised this gist Dec 15, 2014. 1 changed file with 18 additions and 8 deletions.
    26 changes: 18 additions & 8 deletions export.sql
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,35 @@
    COPY (SELECT substring(uuid for 16) as r_keyid, * FROM openpgp_pubkey)
    TO '/tmp/openpgp_pubkey.csv' WITH CSV header;
    TO '/tmp/openpgp_pubkey.csv'
    WITH (FORMAT CSV, HEADER TRUE, FORCE_QUOTE *, ESCAPE '\');
    COPY (SELECT * FROM openpgp_sig
    WHERE subkey_uuid IS NULL
    AND uid_uuid IS NULL
    AND uat_uuid IS NULL
    AND sig_uuid IS NULL)
    TO '/tmp/openpgp_sig_pubkey.csv' WITH CSV header;
    TO '/tmp/openpgp_sig_pubkey.csv'
    WITH (FORMAT CSV, HEADER TRUE, FORCE_QUOTE *, ESCAPE '\');
    COPY (SELECT * FROM openpgp_sig
    WHERE subkey_uuid IS NOT NULL)
    TO '/tmp/openpgp_sig_subkey.csv' WITH CSV header;
    TO '/tmp/openpgp_sig_subkey.csv'
    WITH (FORMAT CSV, HEADER TRUE, FORCE_QUOTE *, ESCAPE '\');
    COPY (SELECT * FROM openpgp_sig
    WHERE uid_uuid IS NOT NULL)
    TO '/tmp/openpgp_sig_uid.csv' WITH CSV header;
    TO '/tmp/openpgp_sig_uid.csv'
    WITH (FORMAT CSV, HEADER TRUE, FORCE_QUOTE *, ESCAPE '\');
    COPY (SELECT * FROM openpgp_sig
    WHERE uat_uuid IS NOT NULL)
    TO '/tmp/openpgp_sig_uat.csv' WITH CSV header;
    TO '/tmp/openpgp_sig_uat.csv'
    WITH (FORMAT CSV, HEADER TRUE, FORCE_QUOTE *, ESCAPE '\');
    COPY (SELECT substring(uuid for 16) as r_keyid, * FROM openpgp_subkey)
    TO '/tmp/openpgp_subkey.csv' WITH CSV header;
    TO '/tmp/openpgp_subkey.csv'
    WITH (FORMAT CSV, HEADER TRUE, FORCE_QUOTE *, ESCAPE '\');
    COPY (SELECT * FROM openpgp_uat) TO '/tmp/openpgp_uat.csv' WITH CSV header;
    COPY (SELECT * FROM openpgp_uat)
    TO '/tmp/openpgp_uat.csv'
    WITH (FORMAT CSV, HEADER TRUE, FORCE_QUOTE *, ESCAPE '\');
    COPY (SELECT * FROM openpgp_uid) TO '/tmp/openpgp_uid.csv' WITH CSV header;
    COPY (SELECT * FROM openpgp_uid)
    TO '/tmp/openpgp_uid.csv'
    WITH (FORMAT CSV, HEADER TRUE, FORCE_QUOTE *, ESCAPE '\');
  14. Eric Collins revised this gist Dec 12, 2014. 1 changed file with 25 additions and 0 deletions.
    25 changes: 25 additions & 0 deletions export.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    COPY (SELECT substring(uuid for 16) as r_keyid, * FROM openpgp_pubkey)
    TO '/tmp/openpgp_pubkey.csv' WITH CSV header;

    COPY (SELECT * FROM openpgp_sig
    WHERE subkey_uuid IS NULL
    AND uid_uuid IS NULL
    AND uat_uuid IS NULL
    AND sig_uuid IS NULL)
    TO '/tmp/openpgp_sig_pubkey.csv' WITH CSV header;
    COPY (SELECT * FROM openpgp_sig
    WHERE subkey_uuid IS NOT NULL)
    TO '/tmp/openpgp_sig_subkey.csv' WITH CSV header;
    COPY (SELECT * FROM openpgp_sig
    WHERE uid_uuid IS NOT NULL)
    TO '/tmp/openpgp_sig_uid.csv' WITH CSV header;
    COPY (SELECT * FROM openpgp_sig
    WHERE uat_uuid IS NOT NULL)
    TO '/tmp/openpgp_sig_uat.csv' WITH CSV header;

    COPY (SELECT substring(uuid for 16) as r_keyid, * FROM openpgp_subkey)
    TO '/tmp/openpgp_subkey.csv' WITH CSV header;

    COPY (SELECT * FROM openpgp_uat) TO '/tmp/openpgp_uat.csv' WITH CSV header;

    COPY (SELECT * FROM openpgp_uid) TO '/tmp/openpgp_uid.csv' WITH CSV header;
  15. georgebrock revised this gist Dec 12, 2014. 1 changed file with 50 additions and 3 deletions.
    53 changes: 50 additions & 3 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -124,7 +124,39 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    MATCH (signer) WHERE (signer:PubKey AND signer.r_keyid = row.signer) OR (signer:SubKey AND signer.r_keyid = row.signer)
    MATCH (signer:SubKey {r_keyid: row.signer})
    WHERE signer IS NOT NULL
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    sig_type: row.sig_type
    }]->(signed);

    // WHERE subkey_uuid IS NOT NULL
    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    MATCH (signer:PubKey {r_keyid: row.signer})
    WHERE signer IS NOT NULL
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    sig_type: row.sig_type
    }]->(signed);

    // WHERE uid_uuid IS NOT NULL
    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
    MATCH (signer:SubKey {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    @@ -139,7 +171,22 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
    MATCH (signer) WHERE (signer:PubKey AND signer.r_keyid = row.signer) OR (signer:SubKey AND signer.r_keyid = row.signer)
    MATCH (signer:PubKey {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    sig_type: row.sig_type
    }]->(signed);

    // WHERE uat_uuid IS NOT NULL
    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uat.csv" AS row
    WITH *
    MATCH (signed:UAT {uuid: row.uat_uuid})
    MATCH (signer:SubKey {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    @@ -154,7 +201,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uat.csv" AS row
    WITH *
    MATCH (signed:UAT {uuid: row.uat_uuid})
    MATCH (signer) WHERE (signer:PubKey AND signer.r_keyid = row.signer) OR (signer:SubKey AND signer.r_keyid = row.signer)
    MATCH (signer:PubKey {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
  16. georgebrock revised this gist Dec 12, 2014. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -94,7 +94,6 @@ LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    OPTIONAL MATCH (signer_pubkey:PubKey {r_keyid: row.signer})
    OPTIONAL MATCH (signer_subkey:SubKey {r_keyid: row.signer})
    WHERE signer_pubkey IS NOT NULL
    MERGE (signer_pubkey)-[:SIGNS {
    uuid: row.uuid,
    @@ -103,7 +102,13 @@ MERGE (signer_pubkey)-[:SIGNS {
    state: row.state,
    packet: row.packet,
    sig_type: row.sig_type
    }]->(signed)
    }]->(signed);

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    OPTIONAL MATCH (signer_subkey:SubKey {r_keyid: row.signer})
    WHERE signer_subkey IS NOT NULL
    MERGE (signer_subkey)-[:SIGNS {
    uuid: row.uuid,
  17. georgebrock revised this gist Dec 12, 2014. 1 changed file with 16 additions and 5 deletions.
    21 changes: 16 additions & 5 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -93,8 +93,19 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    MATCH (signer {r_keyid: row.signer}) WHERE signer:PubKey OR signer:SubKey
    MERGE (signer)-[:SIGNS {
    OPTIONAL MATCH (signer_pubkey:PubKey {r_keyid: row.signer})
    OPTIONAL MATCH (signer_subkey:SubKey {r_keyid: row.signer})
    WHERE signer_pubkey IS NOT NULL
    MERGE (signer_pubkey)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    sig_type: row.sig_type
    }]->(signed)
    WHERE signer_subkey IS NOT NULL
    MERGE (signer_subkey)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    @@ -108,7 +119,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    MATCH (signer {r_keyid: row.signer}) WHERE signer:PubKey OR signer:SubKey
    MATCH (signer) WHERE (signer:PubKey AND signer.r_keyid = row.signer) OR (signer:SubKey AND signer.r_keyid = row.signer)
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    @@ -123,7 +134,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
    MATCH (signer {r_keyid: row.signer}) WHERE signer:PubKey OR signer:SubKey
    MATCH (signer) WHERE (signer:PubKey AND signer.r_keyid = row.signer) OR (signer:SubKey AND signer.r_keyid = row.signer)
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    @@ -138,7 +149,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uat.csv" AS row
    WITH *
    MATCH (signed:UAT {uuid: row.uat_uuid})
    MATCH (signer {r_keyid: row.signer}) WHERE signer:PubKey OR signer:SubKey
    MATCH (signer) WHERE (signer:PubKey AND signer.r_keyid = row.signer) OR (signer:SubKey AND signer.r_keyid = row.signer)
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
  18. georgebrock revised this gist Dec 12, 2014. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -93,7 +93,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    MATCH (signer {r_keyid: row.signer})
    MATCH (signer {r_keyid: row.signer}) WHERE signer:PubKey OR signer:SubKey
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    @@ -108,7 +108,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    MATCH (signer {r_keyid: row.signer})
    MATCH (signer {r_keyid: row.signer}) WHERE signer:PubKey OR signer:SubKey
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    @@ -123,7 +123,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
    MATCH (signer {r_keyid: row.signer})
    MATCH (signer {r_keyid: row.signer}) WHERE signer:PubKey OR signer:SubKey
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
    @@ -138,7 +138,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uat.csv" AS row
    WITH *
    MATCH (signed:UAT {uuid: row.uat_uuid})
    MATCH (signer {r_keyid: row.signer})
    MATCH (signer {r_keyid: row.signer}) WHERE signer:PubKey OR signer:SubKey
    MERGE (signer)-[:SIGNS {
    uuid: row.uuid,
    creation: row.creation,
  19. georgebrock revised this gist Dec 12, 2014. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -95,7 +95,7 @@ WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    MATCH (signer {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    @@ -110,7 +110,7 @@ WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    MATCH (signer {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    @@ -125,7 +125,7 @@ WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
    MATCH (signer {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    @@ -140,7 +140,7 @@ WITH *
    MATCH (signed:UAT {uuid: row.uat_uuid})
    MATCH (signer {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
  20. georgebrock revised this gist Dec 12, 2014. 1 changed file with 14 additions and 6 deletions.
    20 changes: 14 additions & 6 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -61,8 +61,12 @@ CREATE (subkey:SubKey {
    revsig_uuid: row.revsig_uuid,
    algorithm: row.algorithm,
    bit_len: row.bit_len
    })
    });

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_subkey.csv" AS row
    WITH *
    MATCH (subkey:SubKey {uuid: row.uuid})
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (subkey)-[:BELONGS_TO]->(pubkey);

    @@ -75,8 +79,12 @@ CREATE (uat:UAT {
    state: row.state,
    packet: row.packet,
    revsig_uuid: row.revsig_uuid
    })
    });

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uat.csv" AS row
    WITH *
    MATCH (uat:UAT {uuid: row.uuid})
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (uat)-[:IDENTIFIES]->(pubkey);

    @@ -85,7 +93,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    MATCH (signer:PubKey {r_keyid: row.signer})
    MATCH (signer {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    creation: row.creation,
    @@ -100,7 +108,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    MATCH (signer:PubKey {r_keyid: row.signer})
    MATCH (signer {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    creation: row.creation,
    @@ -115,7 +123,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
    MATCH (signer:PubKey {r_keyid: row.signer})
    MATCH (signer {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    creation: row.creation,
    @@ -130,7 +138,7 @@ USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uat.csv" AS row
    WITH *
    MATCH (signed:UAT {uuid: row.uat_uuid})
    MATCH (signer:PubKey {r_keyid: row.signer})
    MATCH (signer {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    creation: row.creation,
  21. georgebrock revised this gist Dec 12, 2014. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion import.cypher
    Original file line number Diff line number Diff line change
    @@ -38,8 +38,12 @@ CREATE (pubkey:PubKey {
    algorithm: row.algorithm,
    bit_len: row.bit_len,
    unsupp: row.unsupp
    })
    });

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    WITH *
    MATCH (pubkey:PubKey {uuid: row.uuid})
    MATCH (primary_uid:UID {uuid: row.primary_uid})
    MATCH (uid:UID {pubkey_uuid: row.uuid})
    MERGE (uid)-[:IDENTIFIES]->(pubkey)
  22. georgebrock revised this gist Dec 12, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion import.cypher
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ CREATE (uid:UID {

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    CREATE (:PubKey {
    CREATE (pubkey:PubKey {
    r_keyid: row.r_keyid,
    uuid: row.uuid,
    creation: row.creation,
  23. georgebrock revised this gist Dec 12, 2014. 1 changed file with 7 additions and 10 deletions.
    17 changes: 7 additions & 10 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,10 @@
    CREATE INDEX ON :UID(uuid);
    CREATE INDEX ON :PubKey(uuid);
    CREATE INDEX ON :PubKey(r_keyid);
    CREATE INDEX ON :SubKey(uuid);
    CREATE INDEX ON :SubKey(r_keyid);
    CREATE INDEX ON :UAT(uuid);

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uid.csv" AS row
    CREATE (uid:UID {
    @@ -12,8 +19,6 @@ CREATE (uid:UID {
    pubkey_uuid: row.pubkey_uuid
    });

    CREATE INDEX ON :UID(uuid);

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    CREATE (:PubKey {
    @@ -40,9 +45,6 @@ MATCH (uid:UID {pubkey_uuid: row.uuid})
    MERGE (uid)-[:IDENTIFIES]->(pubkey)
    MERGE (pubkey)-[:PRIMARILY_IDENTIFIED_BY]->(primary_uid);

    CREATE INDEX ON :PubKey(uuid);
    CREATE INDEX ON :PubKey(r_keyid);

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_subkey.csv" AS row
    CREATE (subkey:SubKey {
    @@ -60,9 +62,6 @@ WITH *
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (subkey)-[:BELONGS_TO]->(pubkey);

    CREATE INDEX ON :SubKey(uuid);
    CREATE INDEX ON :SubKey(r_keyid);

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uat.csv" AS row
    CREATE (uat:UAT {
    @@ -77,8 +76,6 @@ WITH *
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (uat)-[:IDENTIFIES]->(pubkey);

    CREATE INDEX ON :UAT(uuid);

    // WHERE subkey_uuid IS NULL AND uid_uuid IS NULL AND uat_uuid IS NULL AND sig_uuid IS NULL
    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
  24. georgebrock revised this gist Dec 12, 2014. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uid.csv" AS row
    CREATE (uid:UID {
    uuid: row.uuid,
    @@ -42,6 +43,7 @@ MERGE (pubkey)-[:PRIMARILY_IDENTIFIED_BY]->(primary_uid);
    CREATE INDEX ON :PubKey(uuid);
    CREATE INDEX ON :PubKey(r_keyid);

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_subkey.csv" AS row
    CREATE (subkey:SubKey {
    r_keyid: row.r_keyid,
    @@ -61,6 +63,7 @@ MERGE (subkey)-[:BELONGS_TO]->(pubkey);
    CREATE INDEX ON :SubKey(uuid);
    CREATE INDEX ON :SubKey(r_keyid);

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uat.csv" AS row
    CREATE (uat:UAT {
    uuid: row.uuid,
    @@ -77,6 +80,7 @@ MERGE (uat)-[:IDENTIFIES]->(pubkey);
    CREATE INDEX ON :UAT(uuid);

    // WHERE subkey_uuid IS NULL AND uid_uuid IS NULL AND uat_uuid IS NULL AND sig_uuid IS NULL
    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    @@ -91,6 +95,7 @@ MERGE (signer)-[:SIGNS {
    }]->(signed);

    // WHERE subkey_uuid IS NOT NULL
    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    @@ -105,6 +110,7 @@ MERGE (signer)-[:SIGNS {
    }]->(signed);

    // WHERE uid_uuid IS NOT NULL
    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
    @@ -119,6 +125,7 @@ MERGE (signer)-[:SIGNS {
    }]->(signed);

    // WHERE uat_uuid IS NOT NULL
    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uat.csv" AS row
    WITH *
    MATCH (signed:UAT {uuid: row.uat_uuid})
  25. georgebrock revised this gist Dec 12, 2014. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,8 @@ CREATE (uid:UID {
    pubkey_uuid: row.pubkey_uuid
    });

    CREATE INDEX ON :UID(uuid);

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    CREATE (:PubKey {
    @@ -37,6 +39,9 @@ MATCH (uid:UID {pubkey_uuid: row.uuid})
    MERGE (uid)-[:IDENTIFIES]->(pubkey)
    MERGE (pubkey)-[:PRIMARILY_IDENTIFIED_BY]->(primary_uid);

    CREATE INDEX ON :PubKey(uuid);
    CREATE INDEX ON :PubKey(r_keyid);

    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_subkey.csv" AS row
    CREATE (subkey:SubKey {
    r_keyid: row.r_keyid,
    @@ -53,6 +58,9 @@ WITH *
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (subkey)-[:BELONGS_TO]->(pubkey);

    CREATE INDEX ON :SubKey(uuid);
    CREATE INDEX ON :SubKey(r_keyid);

    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uat.csv" AS row
    CREATE (uat:UAT {
    uuid: row.uuid,
    @@ -66,6 +74,8 @@ WITH *
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (uat)-[:IDENTIFIES]->(pubkey);

    CREATE INDEX ON :UAT(uuid);

    // WHERE subkey_uuid IS NULL AND uid_uuid IS NULL AND uat_uuid IS NULL AND sig_uuid IS NULL
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
  26. georgebrock created this gist Dec 12, 2014.
    123 changes: 123 additions & 0 deletions import.cypher
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,123 @@
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uid.csv" AS row
    CREATE (uid:UID {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    revsig_uuid: row.revsig_uuid,
    keywords: row.keywords,
    keywords_fulltext: row.keywords_fulltext,
    pubkey_uuid: row.pubkey_uuid
    });

    USING PERIODIC COMMIT
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_pubkey.csv" AS row
    CREATE (:PubKey {
    r_keyid: row.r_keyid,
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    ctime: row.ctime,
    mtime: row.mtime,
    md5: row.md5,
    sha256: row.sha256,
    revsig_uuid: row.revsig_uuid,
    primary_uid: row.primary_uid,
    primary_uat: row.primary_uat,
    algorithm: row.algorithm,
    bit_len: row.bit_len,
    unsupp: row.unsupp
    })
    WITH *
    MATCH (primary_uid:UID {uuid: row.primary_uid})
    MATCH (uid:UID {pubkey_uuid: row.uuid})
    MERGE (uid)-[:IDENTIFIES]->(pubkey)
    MERGE (pubkey)-[:PRIMARILY_IDENTIFIED_BY]->(primary_uid);

    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_subkey.csv" AS row
    CREATE (subkey:SubKey {
    r_keyid: row.r_keyid,
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    revsig_uuid: row.revsig_uuid,
    algorithm: row.algorithm,
    bit_len: row.bit_len
    })
    WITH *
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (subkey)-[:BELONGS_TO]->(pubkey);

    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_uat.csv" AS row
    CREATE (uat:UAT {
    uuid: row.uuid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    revsig_uuid: row.revsig_uuid
    })
    WITH *
    MATCH (pubkey:PubKey {uuid: row.pubkey_uuid})
    MERGE (uat)-[:IDENTIFIES]->(pubkey);

    // WHERE subkey_uuid IS NULL AND uid_uuid IS NULL AND uat_uuid IS NULL AND sig_uuid IS NULL
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_pubkey.csv" AS row
    WITH *
    MATCH (signed:PubKey {uuid: row.pubkey_uuid})
    MATCH (signer:PubKey {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    sig_type: row.sig_type
    }]->(signed);

    // WHERE subkey_uuid IS NOT NULL
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_subkey.csv" AS row
    WITH *
    MATCH (signed:SubKey {uuid: row.subkey_uuid})
    MATCH (signer:PubKey {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    sig_type: row.sig_type
    }]->(signed);

    // WHERE uid_uuid IS NOT NULL
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uid.csv" AS row
    WITH *
    MATCH (signed:UID {uuid: row.uid_uuid})
    MATCH (signer:PubKey {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    sig_type: row.sig_type
    }]->(signed);

    // WHERE uat_uuid IS NOT NULL
    LOAD CSV WITH HEADERS FROM "file:/tmp/openpgp_sig_uat.csv" AS row
    WITH *
    MATCH (signed:UAT {uuid: row.uat_uuid})
    MATCH (signer:PubKey {r_keyid: row.signer})
    MERGE (signer)-[:SIGNS {
    uuid: row.uid,
    creation: row.creation,
    expiration: row.expiration,
    state: row.state,
    packet: row.packet,
    sig_type: row.sig_type
    }]->(signed);