Skip to content

Instantly share code, notes, and snippets.

View Linkurious Enterprise: Custom shortest path query template
MATCH (a), (b), p = allShortestPaths((a)-[*..{{"Maximum path length":number:{"default": 4, "min": 1, "max": 10}}}]-(b))
WHERE ALL (r IN relationships(p)
WHERE type(r)= 'IS_SHAREHOLDER' AND r.shares > 0.20) AND id(a) = {{"Source":node:"Person"}} AND id(b) = {{"Target":node:"Company"}}
RETURN p LIMIT {{"Maxiumum number of paths":number:{"default":5, "min": 1, "max": 50}}}
View Linkurious Enterprise: query template to flag and comment on nodes
MATCH (n)
WHERE id(n) = {{"Suspicious Entity":node:["Person"]}}
SET n.suspicious = true
SET n.note = {{"Comment":string:{"placeholder":"Add a note..."}}}
RETURN n;
View Linkurious Enterprise: multiple inputs query templates
MATCH (b:BANK_ACCOUNT)-[e:HAS_TRANSFERED]->(a)
WHERE id(a) = {{"Bank":node:"BANK_ACCOUNT"}} and e.amount > {{"Amount":number:{"min":0}}} and e.date >= {{"Start date":date:"iso"}} and e.date < {{"End date":date:"iso"}}
return a, e, b
View VAT_Fraud_Query
MATCH p=(a:Company)-[rs:SELLS_TO*]->(c:Company)
WHERE a.country <> c.country
WITH p, a, c, rs, nodes(p) AS ns
WITH p, a, c, rs, filter(n IN ns WHERE n.epoch - 1383123473 < (90*60*60*24)) AS bs
WITH p, a, c, rs, head(bs) AS b
WHERE NOT b IS NULL
WITH p, a, b, c, head(rs) AS r1, last(rs) AS rn
WITH p, a, b, c, r1, rn, rn.epoch - r1.epoch AS d
WHERE d < (15*60*60*24)
RETURN a, b, c, d, r1, rn
View Credit_card_fraud_common_merchants
// 1) match all disputed transactions
match (p:person)-[b:HAS_BOUGHT_AT {status: "Disputed"}]->(m:merchant)
with
collect(p) as disputer, // list of persons with disputed transactions
collect(b) as disputed, // list disputed transactions
collect(m) as merchants // list merchants with disputed transactions
// 2) match all undisputed transactions
match (p:person)-[b:HAS_BOUGHT_AT {status: "Undisputed"}]->(m:merchant)
where p in disputer // keep only transactions where the buyer is a disputer
with // group undisputed transactions by merchant
View Guest Mode URL Parameters
# Load a node by node ID
/guest?populate=nodeId&item_id=123&key=a1b1c1
# Load an edge and its source and target nodes by edge ID
/guest?populate=edgeId&item_id=123&key=a1b1c1
# Load a node and its neighbors by node ID
/guest?populate=expandNodeId&item_id=123&key=a1b1c1
# Load nodes (by search query)
@elisedeux
elisedeux / gist:23954c8932ccfe94be7126a240688a82
Created Aug 2, 2018
Global_terrorism_database_Cypher_import
View gist:23954c8932ccfe94be7126a240688a82
// Create node events
load csv with headers from "file:///bdd.csv" as row
merge(e:Event {id: row.eventid})
set e.nature=row.attacktype1_txt
set e.year=row.iyear
set e.month=row.imonth
set e.date=row.iday
Set e.latitude=row.latitude
Set e.longitude=row.longitude
@elisedeux
elisedeux / Query template used to expand a person's bank account node and its ten highest associated transactions.
Last active May 8, 2018
Query template used to expand a person's bank account node and its ten highest associated transactions.
View Query template used to expand a person's bank account node and its ten highest associated transactions.
MATCH (c:PERSON)-[e1:HAS_BANK_ACCOUNT]->(cc:BANK_ACCOUNT)-[e2:HAS_RECEIVED]->(t:TRANSACTION)
WHERE ID(c) = {{"PERSON":node:"PERSON"}}
RETURN c, e1, cc, e2, t
ORDER BY t.amount DESC
LIMIT 10
View Opacity_Classes_Ogma.js
// Create the class with a low opacity value
ogma.createClass('faded', {
nodeAttributes: { opacity: 0.2 },
edgeAttributes: { opacity: 0.2 }
});
// Select the nodes and edges that must be faded
const nodesToFade = ogma.getNodes().filter(node => node.getData('type') === 'INVESTOR');
const edgesToFade = nodesToFade.getAdjacentEdges();
You can’t perform that action at this time.