CREATE TAG user(
name string
)
CREATE TAG theme(
name string
)
CREATE TAG post(
text string
)
create edge author(); // post的作者
create edge themes(); // post所属的主题
一个区分的终点是从哪条边来的方法: match(v:post)-[e:author | :themes]-(v2) return type(e), v2.name
获取特定边上的结果: match(v:post)-[e:author | :themes]-(v2) with type(e) as type, v2.name as name where type=="e:author" return type, name
$owner = go from "01" over owner yield owner._dst as id, $$.owner.name;
$theme = go from "01" over themes yield themes._dst as id, $$.themes.name;
fetch prop on post "01" yield post.text as text, $owner as owner, $theme as theme
CREATE TAG post(id int, text string)
CREATE TAG author(id int, name string)
CREATE TAG themes(id int, name string)
create edge writes();
create edge relates();
// insert tags and edges...
MATCH (a:author)<-[]-(v:post)-[]->(t:themes)
RETURN v.text, a.name, collect(distinct t.name)
LOOKUP ON post YIELD post.text AS text
| YIELD $-.VertexID AS vids, $-.text AS text
| GO FROM $-.vids OVER writes,relates REVERSELY YIELD $-.vids AS vids, $-.text AS text, $$.author.name as n1,$$.themes.name as n2
| YIELD $-.text, $-.n1, collect($-.n2)
CREATE TAG post(id int, text string)
CREATE TAG author(id int, name string)
CREATE TAG themes(id int, name string)
create edge writes();
create edge relates();
// insert tags and edges…
MATCH (a:author)<--(v:post)-->(t:themes)
RETURN v.text, a.name, collect(distinct t.name)