Skip to content

Commit d81f7e4

Browse files
committed
fix: standardize casing for AGE references in navigation and documentation
1 parent 2e08a1a commit d81f7e4

File tree

4 files changed

+14
-233
lines changed

4 files changed

+14
-233
lines changed

CN/modules/ROOT/nav.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
*** xref:master/ecosystem_components/pg_ai_query.adoc[pg_ai_query]
5656
*** xref:master/ecosystem_components/pg_partman.adoc[pg_partman]
5757
*** xref:master/ecosystem_components/pgbouncer.adoc[pgbouncer]
58-
*** xref:master/ecosystem_components/age.adoc[AGE]
58+
*** xref:master/ecosystem_components/age.adoc[age]
5959
*** xref:master/ecosystem_components/pg_curl.adoc[pg_curl]
6060
*** xref:master/ecosystem_components/pg_textsearch.adoc[pg_textsearch]
6161
*** xref:master/ecosystem_components/pg_hint_plan.adoc[pg_hint_plan]

CN/modules/ROOT/pages/master/ecosystem_components/age.adoc

Lines changed: 5 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -133,142 +133,41 @@ SELECT * FROM pg_extension WHERE extname = 'age';
133133

134134
== 使用
135135

136-
=== 创建图数据库
137-
138136
[literal]
139137
----
140-
-- 加载 AGE 语言
141-
LOAD 'age';
142-
143-
-- 加载 Cypher 函数
144-
SET search_path = ag_catalog, "$user", public;
138+
要创建图,使用位于 ag_catalog 命名空间中的 create_graph 函数。
145139
146-
-- 创建图(graph)
147140
SELECT create_graph('graph_name');
148-
----
149-
150-
=== 创建顶点
151141
152-
创建带标签和属性的单个顶点:
142+
要创建带有标签和属性的单个顶点,使用 CREATE 子句。
153143
154-
[literal]
155-
----
156144
SELECT *
157145
FROM cypher('graph_name', $$
158146
CREATE (:label {property:"Node A"})
159147
$$) as (v agtype);
160-
----
161148
162-
[literal]
163-
----
164149
SELECT *
165150
FROM cypher('graph_name', $$
166151
CREATE (:label {property:"Node B"})
167152
$$) as (v agtype);
168-
----
169153
170-
=== 创建边
154+
要在两个节点之间创建边并设置其属性:
171155
172-
在两个节点之间创建边并设置属性:
173-
174-
[literal]
175-
----
176156
SELECT *
177157
FROM cypher('graph_name', $$
178158
MATCH (a:label), (b:label)
179159
WHERE a.property = 'Node A' AND b.property = 'Node B'
180160
CREATE (a)-[e:RELTYPE {property:a.property + '<->' + b.property}]->(b)
181161
RETURN e
182162
$$) as (e agtype);
183-
----
184-
185-
=== 查询图数据
186163
187164
查询连接的节点:
188165
189-
[literal]
190-
----
191166
SELECT * from cypher('graph_name', $$
192-
MATCH (V)-[R]-(V2)
193-
RETURN V,R,V2
167+
MATCH (V)-[R]-(V2)
168+
RETURN V,R,V2
194169
$$) as (V agtype, R agtype, V2 agtype);
195-
----
196-
197-
=== 基本查询示例
198-
199-
[literal]
200-
----
201-
-- 查询所有节点
202-
SELECT * FROM cypher('graph_name', $$
203-
MATCH (V)
204-
RETURN V
205-
$$) as (V agtype);
206-
207-
-- 查询特定标签的节点
208-
SELECT * FROM cypher('graph_name', $$
209-
MATCH (V:label)
210-
RETURN V
211-
$$) as (V agtype);
212-
213-
-- 查询特定属性的节点
214-
SELECT * FROM cypher('graph_name', $$
215-
MATCH (V:label {property: "Node A"})
216-
RETURN V
217-
$$) as (V agtype);
218-
219-
-- 查询所有边
220-
SELECT * FROM cypher('graph_name', $$
221-
MATCH ()-[R]->()
222-
RETURN R
223-
$$) as (R agtype);
224-
225-
-- 查询特定类型的边
226-
SELECT * FROM cypher('graph_name', $$
227-
MATCH ()-[R:RELTYPE]->()
228-
RETURN R
229-
$$) as (R agtype);
230-
----
231-
232-
=== 更新和删除
233170
234-
[literal]
235-
----
236-
-- 更新节点属性
237-
SELECT * FROM cypher('graph_name', $$
238-
MATCH (V:label {property: "Node A"})
239-
SET V.property = "Updated Node A"
240-
RETURN V
241-
$$) as (V agtype);
242-
243-
-- 删除边
244-
SELECT * FROM cypher('graph_name', $$
245-
MATCH (a:label {property: "Node A"})-[r:RELTYPE]->(b:label {property: "Node B"})
246-
DELETE r
247-
$$) as (r agtype);
248-
249-
-- 删除节点(必须先删除相关的边)
250-
SELECT * FROM cypher('graph_name', $$
251-
MATCH (V:label {property: "Node B"})
252-
DETACH DELETE V
253-
$$) as (V agtype);
254-
----
255-
256-
=== 与 SQL 结合使用
257-
258-
[literal]
259-
----
260-
-- 将图查询结果用于关系表查询
261-
SELECT * FROM cypher('graph_name', $$
262-
MATCH (V:label)
263-
RETURN V.property AS name
264-
$$) as (name text)
265-
WHERE name IS NOT NULL;
266-
267-
-- 统计节点数量
268-
SELECT count(*) FROM cypher('graph_name', $$
269-
MATCH (V)
270-
RETURN V
271-
$$) as (V agtype);
272171
----
273172

274173
== 管理命令

EN/modules/ROOT/nav.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
*** xref:master/ecosystem_components/pg_stat_monitor.adoc[pg_stat_monitor]
5656
*** xref:master/ecosystem_components/pg_partman.adoc[pg_partman]
5757
*** xref:master/ecosystem_components/pgbouncer.adoc[pgbouncer]
58-
*** xref:master/ecosystem_components/age.adoc[AGE]
58+
*** xref:master/ecosystem_components/age.adoc[age]
5959
*** xref:master/ecosystem_components/pg_curl.adoc[pg_curl]
6060
*** xref:master/ecosystem_components/pg_textsearch.adoc[pg_textsearch]
6161
*** xref:master/ecosystem_components/pg_hint_plan.adoc[pg_hint_plan]

EN/modules/ROOT/pages/master/ecosystem_components/age.adoc

Lines changed: 7 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -133,158 +133,40 @@ SELECT * FROM pg_extension WHERE extname = 'age';
133133

134134
== Usage
135135

136-
=== Create a Graph Database
137-
138136
[literal]
139137
----
140-
-- Load AGE language
141-
LOAD 'age';
142-
143-
-- Load Cypher functions
144-
SET search_path = ag_catalog, "$user", public;
138+
To create a graph, use the create_graph function located in the ag_catalog namespace.
145139
146-
-- Create a graph
147140
SELECT create_graph('graph_name');
148-
----
149141
150-
=== Create Vertices
142+
To create a single vertex with label and properties, use the CREATE clause.
151143
152-
To create a single vertex with label and properties:
153-
154-
[literal]
155-
----
156-
SELECT *
144+
SELECT *
157145
FROM cypher('graph_name', $$
158146
CREATE (:label {property:"Node A"})
159147
$$) as (v agtype);
160-
----
161148
162-
[literal]
163-
----
164-
SELECT *
149+
SELECT *
165150
FROM cypher('graph_name', $$
166151
CREATE (:label {property:"Node B"})
167152
$$) as (v agtype);
168-
----
169-
170-
=== Create Edges
171153
172154
To create an edge between two nodes and set its properties:
173155
174-
[literal]
175-
----
176-
SELECT *
156+
SELECT *
177157
FROM cypher('graph_name', $$
178158
MATCH (a:label), (b:label)
179159
WHERE a.property = 'Node A' AND b.property = 'Node B'
180160
CREATE (a)-[e:RELTYPE {property:a.property + '<->' + b.property}]->(b)
181161
RETURN e
182162
$$) as (e agtype);
183-
----
184-
185-
=== Query Graph Data
186163
187164
And to query the connected nodes:
188165
189-
[literal]
190-
----
191166
SELECT * from cypher('graph_name', $$
192-
MATCH (V)-[R]-(V2)
193-
RETURN V,R,V2
167+
MATCH (V)-[R]-(V2)
168+
RETURN V,R,V2
194169
$$) as (V agtype, R agtype, V2 agtype);
195-
----
196170
197-
=== Basic Query Examples
198-
199-
[literal]
200-
----
201-
-- Query all vertices
202-
SELECT * FROM cypher('graph_name', $$
203-
MATCH (V)
204-
RETURN V
205-
$$) as (V agtype);
206-
207-
-- Query vertices with specific label
208-
SELECT * FROM cypher('graph_name', $$
209-
MATCH (V:label)
210-
RETURN V
211-
$$) as (V agtype);
212-
213-
-- Query vertices with specific property
214-
SELECT * FROM cypher('graph_name', $$
215-
MATCH (V:label {property: "Node A"})
216-
RETURN V
217-
$$) as (V agtype);
218-
219-
-- Query all edges
220-
SELECT * FROM cypher('graph_name', $$
221-
MATCH ()-[R]->()
222-
RETURN R
223-
$$) as (R agtype);
224-
225-
-- Query edges by type
226-
SELECT * FROM cypher('graph_name', $$
227-
MATCH ()-[R:RELTYPE]->()
228-
RETURN R
229-
$$) as (R agtype);
230171
----
231172

232-
=== Update and Delete
233-
234-
[literal]
235-
----
236-
-- Update vertex properties
237-
SELECT * FROM cypher('graph_name', $$
238-
MATCH (V:label {property: "Node A"})
239-
SET V.property = "Updated Node A"
240-
RETURN V
241-
$$) as (V agtype);
242-
243-
-- Delete edge
244-
SELECT * FROM cypher('graph_name', $$
245-
MATCH (a:label {property: "Node A"})-[r:RELTYPE]->(b:label {property: "Node B"})
246-
DELETE r
247-
$$) as (r agtype);
248-
249-
-- Delete vertex (must delete related edges first)
250-
SELECT * FROM cypher('graph_name', $$
251-
MATCH (V:label {property: "Node B"})
252-
DETACH DELETE V
253-
$$) as (V agtype);
254-
----
255-
256-
=== Combining with SQL
257-
258-
[literal]
259-
----
260-
-- Use graph query results in relational queries
261-
SELECT * FROM cypher('graph_name', $$
262-
MATCH (V:label)
263-
RETURN V.property AS name
264-
$$) as (name text)
265-
WHERE name IS NOT NULL;
266-
267-
-- Count vertices
268-
SELECT count(*) FROM cypher('graph_name', $$
269-
MATCH (V)
270-
RETURN V
271-
$$) as (V agtype);
272-
----
273-
274-
== Management Commands
275-
276-
[literal]
277-
----
278-
-- List all graphs
279-
SELECT * FROM ag_graph;
280-
281-
-- Delete graph (deletes all related vertices and edges)
282-
SELECT drop_graph('graph_name', true);
283-
284-
-- View graph statistics
285-
SELECT
286-
graph_name,
287-
(SELECT count(*) FROM ag_vertex WHERE graph_id = ag_graph.graph_id) AS vertex_count,
288-
(SELECT count(*) FROM ag_edge WHERE graph_id = ag_graph.graph_id) AS edge_count
289-
FROM ag_graph;
290-
----

0 commit comments

Comments
 (0)