From 4f548375866c17d38f582f34640afc66c1b7b82a Mon Sep 17 00:00:00 2001 From: Ashutosh Bapat Date: Wed, 1 Jan 2025 14:02:28 +0530 Subject: [PATCH v12 08/14] Document fixes Assorted grammar and typo fixes. Author: Junwang Zhou Reviewed with minor adjustments by: Ashutosh Bapat --- doc/src/sgml/ddl.sgml | 24 ++++++++------- doc/src/sgml/information_schema.sgml | 20 ++++++------ doc/src/sgml/ref/alter_property_graph.sgml | 2 +- doc/src/sgml/ref/create_property_graph.sgml | 2 +- doc/src/sgml/ref/drop_property_graph.sgml | 2 +- src/backend/rewrite/rewriteGraphTable.c | 34 ++++++++++----------- src/backend/utils/adt/ruleutils.c | 6 ++-- 7 files changed, 45 insertions(+), 45 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 32cf474a609..d67f12edbf0 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -5364,14 +5364,14 @@ EXPLAIN SELECT count(*) FROM measurement WHERE logdate >= DATE '2008-01-01'; relational databases. PostgreSQL implements SQL/PGQHere, PGQ stands for property graph query. In the jargon of graph databases, property graph is normally abbreviated as PG, - which is clearly confusing for practioners of PostgreSQL, also usually + which is clearly confusing for practitioners of PostgreSQL, also usually abbreviated as PG., which is part of the SQL standard, where a property graph is defined as a kind of read-only view over relational tables. So the actual data is still in tables or table-like objects, but is exposed as a graph for graph querying operations. (This is in contrast to native graph databases, where the data is stored directly in a graph structure.) Underneath, both relational queries and graph queries - use the same query planning and execution infrastucture, and in fact + use the same query planning and execution infrastructure, and in fact relational and graph queries can be combined and mixed in single queries. @@ -5452,7 +5452,7 @@ CREATE PROPERTY GRAPH myshop This graph could then be queried like this: -- get list of customers active today -SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c IS customers)-[IS customer_orders]->(o IS orders WHERE ordered_when = current_date) COLUMNS (c.name AS customer_name)); +SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c IS customers)-[IS customer_orders]->(o IS orders WHERE o.ordered_when = current_date) COLUMNS (c.name AS customer_name)); corresponding approximately to this relational query: @@ -5463,10 +5463,10 @@ SELECT customers.name FROM customers JOIN customer_orders USING (customer_id) JO The above definition requires that all tables have primary keys and that - for each edge there is an appropriate foreign key. Otherwise, additional - clauses have to be specified to identify the key columns. For example, - this would be the fully verbose definition that does not rely on primary - and foreign keys: + each edge has an appropriate foreign key for both the source and destination + vertices, respectively. Otherwise, additional clauses have to be specified + to identify the key columns. For example, this would be the fully verbose + definition that does not rely on primary and foreign keys: CREATE PROPERTY GRAPH myshop VERTEX TABLES ( @@ -5488,7 +5488,7 @@ CREATE PROPERTY GRAPH myshop As mentioned above, by default, the names of the tables and columns are exposed as labels and properties, respectively. The clauses IS - customer, IS order, etc. in the + customers, IS orders, etc. in the MATCH clause in fact refer to labels, not table names. @@ -5504,19 +5504,21 @@ CREATE PROPERTY GRAPH myshop VERTEX TABLES ( products LABEL product, customers LABEL customer, - orders LABEL order + orders LABEL orders ) EDGE TABLES ( order_items SOURCE orders DESTINATION products LABEL contains, customer_orders SOURCE customers DESTINATION orders LABEL has ); + + (We explicitly set the LABEL as orders instead of order because order is a reserved keyword.) With this definition, we can write a query like this: -SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c:customer)-[:has]->(o:order WHERE ordered_when = current_date) COLUMNS (c.name AS customer_name)); +SELECT customer_name FROM GRAPH_TABLE (myshop MATCH (c:customer)-[:has]->(o:orders WHERE o.ordered_when = current_date) COLUMNS (c.name AS customer_name)); With the new labels and using the colon instead of IS, which are equivalent, the MATCH clause is now more @@ -5539,7 +5541,7 @@ CREATE PROPERTY GRAPH myshop VERTEX TABLES ( products LABEL product, customers LABEL customer LABEL person PROPERTIES (name), - orders LABEL order, + orders LABEL orders, employees LABEL employee LABEL person PROPERTIES (employee_name AS name) ) EDGE TABLES ( diff --git a/doc/src/sgml/information_schema.sgml b/doc/src/sgml/information_schema.sgml index e6561543f62..a370f1e537d 100644 --- a/doc/src/sgml/information_schema.sgml +++ b/doc/src/sgml/information_schema.sgml @@ -4227,7 +4227,7 @@ ORDER BY c.ordinal_position; property_graph_name sql_identifier - Name of the property_graph + Name of the property graph @@ -4346,7 +4346,7 @@ ORDER BY c.ordinal_position; property_graph_name sql_identifier - Name of the property_graph + Name of the property graph @@ -4430,7 +4430,7 @@ ORDER BY c.ordinal_position; property_graph_name sql_identifier - Name of the property_graph + Name of the property graph @@ -4461,7 +4461,7 @@ ORDER BY c.ordinal_position; <literal>pg_element_table_properties</literal> - The view pg_element_table_labels shows the definitions + The view pg_element_table_properties shows the definitions of the properties for the element tables of property graphs defined in the current database. Only those property graphs are shown that the current user has access to (by way of being the owner or having some privilege). @@ -4505,7 +4505,7 @@ ORDER BY c.ordinal_position; property_graph_name sql_identifier - Name of the property_graph + Name of the property graph @@ -4589,7 +4589,7 @@ ORDER BY c.ordinal_position; property_graph_name sql_identifier - Name of the property_graph + Name of the property graph @@ -4700,7 +4700,7 @@ ORDER BY c.ordinal_position; property_graph_name sql_identifier - Name of the property_graph + Name of the property graph @@ -4774,7 +4774,7 @@ ORDER BY c.ordinal_position; property_graph_name sql_identifier - Name of the property_graph + Name of the property graph @@ -4839,7 +4839,7 @@ ORDER BY c.ordinal_position; property_graph_name sql_identifier - Name of the property_graph + Name of the property graph @@ -5255,7 +5255,7 @@ ORDER BY c.ordinal_position; property_graph_name sql_identifier - Name of the property_graph + Name of the property graph diff --git a/doc/src/sgml/ref/alter_property_graph.sgml b/doc/src/sgml/ref/alter_property_graph.sgml index 604c5180117..4ae53deb092 100644 --- a/doc/src/sgml/ref/alter_property_graph.sgml +++ b/doc/src/sgml/ref/alter_property_graph.sgml @@ -99,7 +99,7 @@ ALTER PROPERTY GRAPH [ IF EXISTS ] nameALTER {VERTEX|NODE|EDGE|RELATIONSHIP} TABLE ... DROP LABEL - This form removes a new label from an existing vertex or edge table. + This form removes a label from an existing vertex or edge table. diff --git a/doc/src/sgml/ref/create_property_graph.sgml b/doc/src/sgml/ref/create_property_graph.sgml index ae301b52e0a..76bfef317af 100644 --- a/doc/src/sgml/ref/create_property_graph.sgml +++ b/doc/src/sgml/ref/create_property_graph.sgml @@ -151,7 +151,7 @@ CREATE [ TEMP | TEMPORARY ] PROPERTY GRAPH name The vertex tables that the edge table is linked to. These refer to the - aliases of a the vertex table. + aliases of the source and destination vertex tables respectively. diff --git a/doc/src/sgml/ref/drop_property_graph.sgml b/doc/src/sgml/ref/drop_property_graph.sgml index 31cb77a2af1..e16de5507b1 100644 --- a/doc/src/sgml/ref/drop_property_graph.sgml +++ b/doc/src/sgml/ref/drop_property_graph.sgml @@ -96,7 +96,7 @@ DROP PROPERTY GRAPH g1; DROP PROPERTY GRAPH conforms to ISO/IEC 9075-16 (SQL/PGQ), except that the standard only allows one property graph to be dropped per command, and apart from the IF EXISTS - option, which is a PostgreSQL extension.. + option, which is a PostgreSQL extension. diff --git a/src/backend/rewrite/rewriteGraphTable.c b/src/backend/rewrite/rewriteGraphTable.c index 80e28db752d..9046d6ada12 100644 --- a/src/backend/rewrite/rewriteGraphTable.c +++ b/src/backend/rewrite/rewriteGraphTable.c @@ -142,7 +142,7 @@ rewriteGraphTable(Query *parsetree, int rt_index) } /* - * Generate queries represeting the given path pattern applied to the given + * Generate queries representing the given path pattern applied to the given * property graph. * * A path pattern consists of one or more element patterns. Each of the element @@ -154,7 +154,7 @@ rewriteGraphTable(Query *parsetree, int rt_index) * queries is returned. * * Assuming that the numbering starts at 0, every element pattern at an even - * numbered position in the path is a vertex pattern. Every element in even + * numbered position in the path is a vertex pattern. Every element in odd * numbered position is an edge pattern. Thus every even numbered element is a * vertex table and odd numbered element is an edge table. An edge connects two * vertices identified by the source and destination keys respectively. The @@ -273,7 +273,7 @@ generate_queries_for_path_pattern(RangeTblEntry *rte, List *path_pattern) * an edge pointing right. Edge pointing in any direction is treated * similar to that pointing in right direction here. When constructing * a query, in generate_query_for_graph_path() we will swap source and - * destination elements if the edge element turns out to be and edge + * destination elements if the edge element turns out to be an edge * pointing in left direction. * * If multiple edge patterns share the same variable name, they @@ -339,6 +339,8 @@ generate_queries_for_path_pattern(RangeTblEntry *rte, List *path_pattern) /* * Recursive workhorse function of generate_queries_for_path_pattern(). + * + * `elempos` is the position of the element pattern in the path pattern. */ static List * generate_queries_for_path_pattern_recurse(RangeTblEntry *rte, List *pathqueries, List *cur_path, List *path_elem_lists, int elempos) @@ -713,10 +715,8 @@ generate_setop_from_pathqueries(List *pathqueries, List **rtable, List **targetl } /* - * Construct a graph_path_element object for the graph element given by `elemoid` - * statisfied by the graph element pattern `gep`. - * - * 'elempos` is the position of given element pattern in the path pattern. + * Construct a path_element object for the graph element given by `elemoid` + * statisfied by the path factor `pf`. * * If the type of graph element does not fit the element pattern kind, the * function returns NULL. @@ -871,16 +871,14 @@ get_labels_for_expr(Oid propgraphid, Node *labelexpr) } /* - * Given a graph element pattern `gep`, return a list of all the graph elements - * that satisfy the graph pattern. + * Given a path factor `pf`, return a list of all the graph elements that + * satisfy the graph pattern. * * First we find all the graph labels that satisfy the label expression in - * graph element pattern. Each label has associated with one or more graph - * elements. A union of all such elements satisfies the element pattern. The - * returned list contains one graph_path_element object representing each of - * these elements respectively. - * - * `elempos` is position of the element pattern in the path pattern. + * path factor. Each label has associated with one or more graph elements. + * A union of all such elements satisfies the element pattern. The returned + * list contains one path_element object representing each of these elements + * respectively. */ static List * get_path_elements_for_path_factor(Oid propgraphid, struct path_factor *pf) @@ -916,9 +914,9 @@ get_path_elements_for_path_factor(Oid propgraphid, struct path_factor *pf) /* * Found a new element that is associated with labels in the * given element pattern. If it fits the element pattern kind - * we will create GraphPathPattern object for it and flag that - * the current label has at least one element, that satisfies - * the given element pattern, associated with it. + * we will create path_element object for it and flag that the + * current label has at least one element, that satisfies the + * given element pattern, associated with it. */ struct path_element *pe = create_gpe_for_element(pf, elem_oid); diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index ed103e00431..5ebf4e7b7c1 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -1770,7 +1770,7 @@ make_propgraphdef_elements(StringInfo buf, Oid pgrelid, char pgekind) /* * Generates label and properties list. Pass in the element OID, the element - * alias, and the graph relation OID. Result is append to buf. + * alias, and the element table OID. Result is append to buf. */ static void make_propgraphdef_labels(StringInfo buf, Oid elid, const char *elalias, Oid elrelid) @@ -1845,8 +1845,8 @@ propdata_by_name_cmp(const ListCell *a, const ListCell *b) /* * Generates element table properties clause (PROPERTIES (...) or NO - * PROPERTIES). Pass in label ODI and element table OID. Result is appended - * to buf. + * PROPERTIES). Pass in element label OID and element table OID. Result is + * appended to buf. */ static void make_propgraphdef_properties(StringInfo buf, Oid ellabelid, Oid elrelid) -- 2.39.5