This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="./lib/ogma.min.js"></script> | |
<script src="./lib/jquery-3.1.1.min.js"></script> | |
<style> | |
#graph-container { | |
width: 300px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use the REST API to get the shortest path between two customers and render in Ogma | |
function shortestPath(customer1, customer2) { | |
// Configure and send the Ajax query asynchronously. | |
$.ajax({ | |
type: "GET", | |
// Define the authentication information. | |
headers: { | |
"Content-Type": "application/json", | |
"Authorization": "Basic " + btoa('root@root.com:6160b54b872459ce1c06c1a8ccdd9019') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use the REST API to search for a term | |
function searchCustomer(term) { | |
// Configure and send the Ajax query asynchronously. | |
$.ajax({ | |
type: "GET", | |
// REST method url | |
url: "http://localhost:3000/api/1cf9e65b/search/nodes/full", | |
// Define the authentication information. | |
headers: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MATCH (c1:Customer)-[r*1..4]-(c2:Customer) | |
WHERE ID(c1) = {{"customer":node:"Customer"}} | |
return c1, r, c2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer