I’m working on Brainstorm now so that the owner of the instance can set it up to calculate personalized WoT scores for friends. Later, for customers.

Graph databases like #neo4j really do make certain tasks a lot easier than if we were limited to sql or other non-graph dbs. Here’s the neo4j cypher query that I use to update the number of hops away any given pubkey is from a customer node on the follows graph. I just iterate this same query 8 or 9 times until numUpdates is zero and it’s done.

MATCH (c1:NostrUserWotMetricsCard {observer_pubkey:’${CUSTOMER_PUBKEY}'})-[:SPECIFIC_INSTANCE]-(:SetOfNostrUserWotMetricsCards)-[:WOT_METRICS_CARDS]-(u1:NostrUser)-[:FOLLOWS]->(u2:NostrUser)-[:WOT_METRICS_CARDS]->(:SetOfNostrUserWotMetricsCards)-[:SPECIFIC_INSTANCE]->(c2:NostrUserWotMetricsCard {observer_pubkey:'${CUSTOMER_PUBKEY}'})

WHERE c2.hops - c1.hops > 1 SET c2.hops = c1.hops + 1

RETURN count(c2) as numUpdates

Reply to this note

Please Login to reply.