From 2a9d686e8c391c017d0906f20165ee37b8da3c47 Mon Sep 17 00:00:00 2001 From: ZhongFuze Date: Thu, 7 Mar 2024 01:50:07 +0800 Subject: [PATCH] [!] Do not delete keybase relation --- .../migrations/LoadingJob_SocialGraph.gsql | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/config/tdb/migrations/LoadingJob_SocialGraph.gsql b/src/config/tdb/migrations/LoadingJob_SocialGraph.gsql index 76b75791..5d02bc1d 100644 --- a/src/config/tdb/migrations/LoadingJob_SocialGraph.gsql +++ b/src/config/tdb/migrations/LoadingJob_SocialGraph.gsql @@ -398,7 +398,9 @@ CREATE OR REPLACE QUERY delete_graph_inner_connection(VERTEX p, INT // only delete connection v2c = SELECT v FROM vertex2delete-(:e)-Contracts:v ACCUM DELETE(e); - v2v = SELECT v FROM vertex2delete-(:e)-vertex2delete:v ACCUM DELETE(e); + v2v = SELECT v FROM vertex2delete-(:e)-vertex2delete:v + WHERE e.source != "keybase" + ACCUM DELETE(e); } CREATE OR REPLACE QUERY find_identity_graph_by_vertex(VERTEX p) FOR GRAPH SocialGraph { @@ -724,14 +726,33 @@ CREATE OR REPLACE QUERY owners_by_ids(SET ids) FOR GRAPH SocialGraph SYN END; } +CREATE OR REPLACE QUERY query_keybase_connections(STRING p) FOR GRAPH SocialGraph SYNTAX V2 { + SetAccum @@vlist; + SetAccum @@existing_vlist; + @@vlist += p; + @@existing_vlist = to_vertex_set(@@vlist, "Identities"); // check existence of a vertex without slowing server + seed (ANY) = {@@existing_vlist}; + ListAccum @@keybase_platform = ["twitter", "keybase", "github", "reddit", "mstdn.jp", "lobste.rs", "hackernews"]; + SetAccum @@vertices; + OrAccum @visited = FALSE; + + WHILE(seed.size()>0) LIMIT 2 DO + SetAccum @@pool; + proof = SELECT v FROM seed-((Proof_Forward>|||| ids) FOR GRAPH SocialGraph SYNTAX V2 { MapAccum, DATETIME> @@expired_time_map; VertexSet (Identities) = SELECT s FROM Identities:s WHERE s.id IN ids ACCUM @@expired_time_map += (s -> to_datetime("1970-01-01 00:00:00")); - ListAccum @@domainSystems = ["dotbit", "lens", "unstoppabledomains", "space_id", "crossbell", "ENS"]; address = SELECT addr FROM VertexSet:domain-(( h.expired_at); PRINT @@expired_time_map as expired_time_map; }