Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dgr6878
neo4j-apoc-procedures
提交
5bac55c4
N
neo4j-apoc-procedures
项目概览
dgr6878
/
neo4j-apoc-procedures
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
neo4j-apoc-procedures
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5bac55c4
编写于
1月 20, 2021
作者:
M
Mark Needham
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
apoc.periodic usage docs
上级
4a8d3ca9
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
227 addition
and
0 deletion
+227
-0
docs/asciidoc/modules/ROOT/pages/overview/apoc.export/apoc.export.cypher.graph.adoc
.../pages/overview/apoc.export/apoc.export.cypher.graph.adoc
+4
-0
docs/asciidoc/modules/ROOT/pages/overview/apoc.periodic/apoc.periodic.cancel.adoc
...OT/pages/overview/apoc.periodic/apoc.periodic.cancel.adoc
+4
-0
docs/asciidoc/modules/ROOT/pages/overview/apoc.periodic/apoc.periodic.commit.adoc
...OT/pages/overview/apoc.periodic/apoc.periodic.commit.adoc
+4
-0
docs/asciidoc/modules/ROOT/pages/overview/apoc.periodic/apoc.periodic.repeat.adoc
...OT/pages/overview/apoc.periodic/apoc.periodic.repeat.adoc
+4
-0
docs/asciidoc/modules/ROOT/pages/overview/apoc.periodic/apoc.periodic.submit.adoc
...OT/pages/overview/apoc.periodic/apoc.periodic.submit.adoc
+4
-0
docs/asciidoc/modules/ROOT/partials/usage/apoc.export.cypher.graph.adoc
...modules/ROOT/partials/usage/apoc.export.cypher.graph.adoc
+99
-0
docs/asciidoc/modules/ROOT/partials/usage/apoc.periodic.cancel.adoc
...doc/modules/ROOT/partials/usage/apoc.periodic.cancel.adoc
+13
-0
docs/asciidoc/modules/ROOT/partials/usage/apoc.periodic.commit.adoc
...doc/modules/ROOT/partials/usage/apoc.periodic.commit.adoc
+47
-0
docs/asciidoc/modules/ROOT/partials/usage/apoc.periodic.repeat.adoc
...doc/modules/ROOT/partials/usage/apoc.periodic.repeat.adoc
+34
-0
docs/asciidoc/modules/ROOT/partials/usage/apoc.periodic.submit.adoc
...doc/modules/ROOT/partials/usage/apoc.periodic.submit.adoc
+14
-0
未找到文件。
docs/asciidoc/modules/ROOT/pages/overview/apoc.export/apoc.export.cypher.graph.adoc
浏览文件 @
5bac55c4
...
...
@@ -47,5 +47,9 @@ apoc.export.cypher.graph(graph :: MAP?, file = :: STRING?, config = {} :: MAP?)
|cleanupStatements|STRING?
|===
[[usage-apoc.export.cypher.graph]]
== Usage Examples
include::partial$usage/apoc.export.cypher.graph.adoc[]
xref::export/cypher.adoc[More documentation of apoc.export.cypher.graph,role=more information]
docs/asciidoc/modules/ROOT/pages/overview/apoc.periodic/apoc.periodic.cancel.adoc
浏览文件 @
5bac55c4
...
...
@@ -35,3 +35,7 @@ apoc.periodic.cancel(name :: STRING?) :: (name :: STRING?, delay :: INTEGER?, ra
|cancelled|BOOLEAN?
|===
[[usage-apoc.periodic.cancel]]
== Usage Examples
include::partial$usage/apoc.periodic.cancel.adoc[]
docs/asciidoc/modules/ROOT/pages/overview/apoc.periodic/apoc.periodic.commit.adoc
浏览文件 @
5bac55c4
...
...
@@ -40,5 +40,9 @@ apoc.periodic.commit(statement :: STRING?, params = {} :: MAP?) :: (updates :: I
|wasTerminated|BOOLEAN?
|===
[[usage-apoc.periodic.commit]]
== Usage Examples
include::partial$usage/apoc.periodic.commit.adoc[]
xref::graph-updates/periodic-execution.adoc#periodic-commit[More documentation of apoc.periodic.commit,role=more information]
docs/asciidoc/modules/ROOT/pages/overview/apoc.periodic/apoc.periodic.repeat.adoc
浏览文件 @
5bac55c4
...
...
@@ -38,3 +38,7 @@ apoc.periodic.repeat(name :: STRING?, statement :: STRING?, rate :: INTEGER?, co
|cancelled|BOOLEAN?
|===
[[usage-apoc.periodic.repeat]]
== Usage Examples
include::partial$usage/apoc.periodic.repeat.adoc[]
docs/asciidoc/modules/ROOT/pages/overview/apoc.periodic/apoc.periodic.submit.adoc
浏览文件 @
5bac55c4
...
...
@@ -36,5 +36,9 @@ apoc.periodic.submit(name :: STRING?, statement :: STRING?) :: (name :: STRING?,
|cancelled|BOOLEAN?
|===
[[usage-apoc.periodic.submit]]
== Usage Examples
include::partial$usage/apoc.periodic.submit.adoc[]
xref::background-operations/periodic-background.adoc[More documentation of apoc.periodic.submit,role=more information]
docs/asciidoc/modules/ROOT/partials/usage/apoc.export.cypher.graph.adoc
0 → 100644
浏览文件 @
5bac55c4
The examples in this section are based on the following sample graph:
include::partial$createExportGraph.adoc[]
The Neo4j Browser visualization below shows the imported graph:
image::play-movies.png[title="Movies Graph Visualization"]
The `apoc.export.cypher.graph` procedure exports a xref::virtual/index.adoc[virtual graph] to a CSV file or as a stream.
The examples in this section are based on a virtual graph that contains all `PRODUCED` relationships and the nodes either side of that relationship.
We can then export that virtual graph as Cypher statements to `movies-producers.cypher`:
[source,cypher]
----
MATCH path = (:Person)-[produced:PRODUCED]->(:Movie)
WITH collect(path) AS paths
CALL apoc.graph.fromPaths(paths, "producers", {})
YIELD graph AS g
CALL apoc.export.cypher.graph(g, "movies-producers.cypher", {})
YIELD file, nodes, relationships, properties
RETURN file, nodes, relationships, properties;
----
.Results
[opts="header"]
|===
| file | nodes | relationships | properties
| "movies-producers.cypher" | 2 | 1 | 5
|===
.movies-producers.cypher
[source,cypher]
----
:begin
CREATE CONSTRAINT ON (node:`UNIQUE IMPORT LABEL`) ASSERT (node.`UNIQUE IMPORT ID`) IS UNIQUE;
:commit
:begin
UNWIND [{_id:31450, properties:{tagline:"Welcome to the Real World", title:"The Matrix", released:1999}}] AS row
CREATE (n:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row._id}) SET n += row.properties SET n:Movie;
UNWIND [{_id:31457, properties:{born:1952, name:"Joel Silver"}}] AS row
CREATE (n:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row._id}) SET n += row.properties SET n:Person;
:commit
:begin
UNWIND [{start: {_id:31457}, end: {_id:31450}, properties:{}}] AS row
MATCH (start:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row.start._id})
MATCH (end:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row.end._id})
CREATE (start)-[r:PRODUCED]->(end) SET r += row.properties;
:commit
:begin
MATCH (n:`UNIQUE IMPORT LABEL`) WITH n LIMIT 20000 REMOVE n:`UNIQUE IMPORT LABEL` REMOVE n.`UNIQUE IMPORT ID`;
:commit
:begin
DROP CONSTRAINT ON (node:`UNIQUE IMPORT LABEL`) ASSERT (node.`UNIQUE IMPORT ID`) IS UNIQUE;
:commit
----
The following query returns a streams of the virtual graph from static value storage to the `cypherStatements` column:
[source,cypher]
----
MATCH path = (:Person)-[produced:PRODUCED]->(:Movie)
WITH collect(path) AS paths
CALL apoc.graph.fromPaths(paths, "producers", {})
YIELD graph AS g
CALL apoc.export.cypher.graph(g, null, {stream: true})
YIELD file, nodes, relationships, properties, cypherStatements
RETURN file, nodes, relationships, properties, cypherStatements;
----
.Results
[opts="header"]
|===
| file | nodes | relationships | properties | cypherStatements
| NULL | 2 | 1 | 5 |
":begin
CREATE CONSTRAINT ON (node:`UNIQUE IMPORT LABEL`) ASSERT (node.`UNIQUE IMPORT ID`) IS UNIQUE;
:commit
:begin
UNWIND [{_id:31450, properties:{tagline:\"Welcome to the Real World\", title:\"The Matrix\", released:1999}}] AS row
CREATE (n:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row._id}) SET n += row.properties SET n:Movie;
UNWIND [{_id:31457, properties:{born:1952, name:\"Joel Silver\"}}] AS row
CREATE (n:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row._id}) SET n += row.properties SET n:Person;
:commit
:begin
UNWIND [{start: {_id:31457}, end: {_id:31450}, properties:{}}] AS row
MATCH (start:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row.start._id})
MATCH (end:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row.end._id})
CREATE (start)-[r:PRODUCED]->(end) SET r += row.properties;
:commit
:begin
MATCH (n:`UNIQUE IMPORT LABEL`) WITH n LIMIT 20000 REMOVE n:`UNIQUE IMPORT LABEL` REMOVE n.`UNIQUE IMPORT ID`;
:commit
:begin
DROP CONSTRAINT ON (node:`UNIQUE IMPORT LABEL`) ASSERT (node.`UNIQUE IMPORT ID`) IS UNIQUE;
:commit
"
|===
docs/asciidoc/modules/ROOT/partials/usage/apoc.periodic.cancel.adoc
0 → 100644
浏览文件 @
5bac55c4
If we want to cancel the job submitted by the example in xref::overview/apoc.periodic/apoc.periodic.repeat.adoc[], we can run the following query:
[source,cypher]
----
CALL apoc.periodic.cancel("create-people");
----
.Results
[opts="header"]
|===
| name | delay | rate | done | cancelled
| "create-people" | 0 | 0 | TRUE | TRUE
|===
\ No newline at end of file
docs/asciidoc/modules/ROOT/partials/usage/apoc.periodic.commit.adoc
0 → 100644
浏览文件 @
5bac55c4
The examples in this section are based on the following sample graph:
[source,cypher]
----
WITH ["London", "Manchester", "Cardiff", "Birmingham", "Coventry", "Edinburgh"] AS cities
UNWIND range(1, 10000) AS id
MERGE (p:Person {id: id})
WITH cities, p, toInteger(rand() * size(cities)) AS index
SET p.city = cities[index];
----
If we want to convert the `city` property to a node, we can do this in batches of 1,000, by running the following query:
[source,cypher]
----
CALL apoc.periodic.commit(
"MATCH (person:Person)
WHERE exists(person.city)
WITH person limit $limit
MERGE (city:City {name:person.city})
MERGE (person)-[:LIVES_IN]->(city)
REMOVE person.city
RETURN count(*)",
{limit:1000});
----
.Results
[opts="header"]
|===
| updates | executions | runtime | batches | failedBatches | batchErrors | failedCommits | commitErrors | wasTerminated
| 10000 | 10 | 0 | 11 | 0 | {} | 0 | {} | FALSE
|===
We can check that the refactoring has been done by running the following query:
[source,cypher]
----
MATCH (p:Person)
RETURN exists(p.city), count(*);
----
.Results
[opts="header"]
|===
| exists(p.city) | count(*)
| FALSE | 10000
|===
\ No newline at end of file
docs/asciidoc/modules/ROOT/partials/usage/apoc.periodic.repeat.adoc
0 → 100644
浏览文件 @
5bac55c4
We can create 10 `Person` nodes every second by running the following query:
[source,cypher]
----
CALL apoc.periodic.repeat(
"create-people",
"UNWIND range(1,10) AS id CREATE (:Person {uuid: apoc.create.uuid()})",
1
);
----
.Results
[opts="header"]
|===
| name | delay | rate | done | cancelled
| "create-people" | 0 | 1 | FALSE | FALSE
|===
We can check how many nodes have been created by running the following query:
[source,cypher]
----
MATCH (:Person)
RETURN count(*) AS count;
----
.Results
[opts="header"]
|===
| count
| 110
|===
If we want to cancel this job, we can use the xref::overview/apoc.periodic/apoc.periodic.cancel.adoc[] procedure.
\ No newline at end of file
docs/asciidoc/modules/ROOT/partials/usage/apoc.periodic.submit.adoc
0 → 100644
浏览文件 @
5bac55c4
[source,cypher]
----
CALL apoc.periodic.submit(
"create-person",
"CREATE (:Person {name: 'Michael Hunger'})"
);
----
.Results
[opts="header"]
|===
| name | delay | rate | done | cancelled
| "create-person" | 0 | 0 | FALSE | FALSE
|===
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录