安装与启动请参考:arangodb安装 - gaoshoufenmu - 博客园
图遍历:ArangoDB 中的Graph_Missbelover的博客-CSDN博客_arangodb graph
导入csv:
arangoimp --file "C:\Users\xxxx\Desktop\2020_en.csv" --collection line_en --create-collection true --type csv
条件查询:
FOR c IN Characters
FILTER c.name=="Robert"
RETURN c.name
图遍历:
for i in 1 ..3 OUTBOUND "Characters/10155" GRAPH 'test'
RETURN i.name
最短路径:
for i IN OUTBOUND SHORTEST_PATH
'Characters/10169' TO 'Characters/10173' GRAPH 'test'
RETURN {"name":i.name,"surname":i.surname,"_id":i._id}
K条最短路径算法:
for i in OUTBOUND K_SHORTEST_PATHS 'Characters/10169' TO 'Characters/10173' GRAPH 'test'
RETURN
//{"name":i.name,"surname":i.surname,"_id":i._id}
i
创建view(arangosh):
c0 = db._create("ExampleCollection0");
c1 = db._create("ExampleCollection1");
c0.save({ i: 0, name: "full", text: "是一个 多模 型数 据库" });
c0.save({ i: 1, name: "half", text: "是一个 多模" });
c0.save({ i: 2, name: "other half", text: "型数 据库" });
c0.save({ i: 3, name: "quarter", text: "是一" });
c1.save({ a: "foo", b: "bar", i: 4 });
c1.save({ a: "foo", b: "baz", i: 5 });
c1.save({ a: "bar", b: "foo", i: 6 });
c1.save({ a: "baz", b: "foo", i: 7 });
v0 = db._createView("ExampleView", "arangosearch", {});
v0 = db._view("ExampleView");
v0.properties({
links: {
/* collection Link 0 with additional custom configuration: */
'ExampleCollection0':
{
/* examine fields of all linked collections,
using default configuration: */
includeAllFields: true,
fields:
{
/* a field to apply custom configuration
that will index English text: */
name:
{
analyzers: ["text_en"]
},
/* another field to apply custom configuration
that will index Chinese text: */
text:
{
analyzers: ["text_zh"]
}
}
},
/* collection Link 1 with custom configuration: */
'ExampleCollection1':
{
/* examine all fields using default configuration: */
includeAllFields: true,
fields:
{
a:
{
/* a field to apply custom configuration
that will index English text: */
analyzers: ["text_en"]
}
}
}
}
}
);