Node Query
// Find nodes by parameters
let result = await client.searchNodes({
filter: `{ age > 100 }`, // ultipa filter in parameter nodes(<>)
limit: 10,
return: "name, age" // return nodes with properties 'name' and 'age'
})
// Find nodes by uql
let result = await client.uql(`find().nodes({ age > 100 }) as result return result{*} limit 10`)
Edge Query
// Find edges by parameters
let result = await client.searchEdges({
filter: `{ type in [1, 3, 5] }`, // ultipa filter in parameter edges(<>)
limit: 10,
return: "*" // return edges with all properties
})
// Find edges by uql
let result = await client.uql(`find().edges({ type in [1, 3, 5] }) as result return result{*} limit 10`)
AB Path
// AB path query by parameters
let result = await client.searchAb({
src: "U001",
dest: "U002",
depth: 3,
limit: 5,
return: "*" // return paths with all properties of nodes and edges
})
// AB path query by uql
let result = await client.uql(`ab().src({_id == 'U001'}).dest({_id == 'U002'}).depth(:3) as paths return paths{*} limit 5`)
Khop
// khop query by parameters
let result = await client.searchKhop({
src: "U001",
edgeFilter: `{ @own }`,
depth: 3,
limit: 5,
return: "*" // return nodes with all properties
})
// khop query by uql
let result = await client.uql(`
khop().src({_id == 'U001'}).depth(3).edge_filter({ @own })
as result return result{*} limit 5
`)
Spread
// spread by parameters
let result = await client.spread({
src: "U001",
depth: 3,
limit: 100,
nodeFilter: `{@card}`,
edgeFilter: `{@transaction || @card}`,
direction: "right",
return: "*" // return paths with all properties of nodes and edges
})
// spread by uql
let result = await client.uql(`
spread().src({_id == 'U001'}).depth(3).node_filter({@card})
.edge_filter({@transaction || @card}).direction(right) as result
return result{*} limit 100
`)
Autonet
// autonet by parameters
let result = await client.searchAutoNet({
src: `{ _id == "U001"}`,
depth: 3,
nodeFilter: `{@card}`,
edgeFilter: `{@transaction || @card}`,
return: "*" // return paths with all properties of nodes and edges
})
// autonet by uql
let result = await client.uql(`
autonet().src({_id in ['U001','U002']}).dest({_id in ['U003','U004']}).depth(:5)
as path return path limit 1
`)
Template
// template query by uql
let result = await client.uql(`
n({_id == 'U001'}).re({@own}).n({@card}).re({@transaction}).n({@card}).le({@own}).n({_id == 'U002'})
as paths return paths
`)