Global Feed Post Login
Replying to Avatar david

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

d3
Xis10tial1 6mo ago

Since you like graphs ...

https://njump.me/nevent1qqstr04gj6trq37ympgytt9e690dppnn7e05ddnvjnck3cxkccgmnkspr4mhxue69uhkummnw3ezucnfw33k76twv4ezuum0vd5kzmp0qgsdxseeg4tw5v9jr4jz484kuluqdt4x5wp72qe22pvw0v7eduaq4ngrqsqqqqqp5qtleu

Reply to this note

Please Login to reply.

Discussion

No replies yet.