Select AI for Property Graphs

Select AI generates Property Graph Query (PGQ) on Oracle Property Graphs using natural language. It enables users to query graph data through the GRAPH_TABLE operator with minimal SQL knowledge.

Select AI extends its natural language to SQL (NL2SQL) capability to graph structures enabling you to query SQL Property Graphs using natural language. Select AI applies the GRAPH_TABLE operator to interpret relationships and attributes in graph-structured data. It generates SQL or PGQ graph queries based on the data objects defined in the AI profile. When a property graph is included in the AI profile, Select AI uses generative AI to build a PGQ query that references the graph through the GRAPH_TABLE operator. The LLM automatically receives the graph object's metadata such as CREATE PROPERTY GRAPH statements to generate accurate queries. When a table, view, or relational object is specified, Select AI generates a SQL query. This capability simplifies pattern-matching queries on graph data stored in Oracle AI Database and reduces dependency on manually constructing SQL queries.

When you create an AI profile with one or more property graphs defined in the object_list attribute, the LLM defined in AI profile interprets prompts by using the context of the specified property graphs. Select AI builds an augmented prompt that includes:
  • Instructions to construct PGQ queries.

  • Metadata describing the provided property graphs (from their CREATE PROPERTY GRAPH statements).

This augmented prompt is sent to the LLM. Select AI runs the query and returns results. If a property graph is specified along with other object types such as tables, schema, or views in the AI profile, Select AI raises an error.

SQL vs PGQ

With Select AI, the type of query generated depends on the objects defined in the object_list attribute of your AI profile.
  • SQL Query: uses relational data such as schema, tables, or views.

  • PGQ Query: uses property graphs and applies the GRAPH_TABLE operator for pattern matching.

See SQL Property Graph and SQL GRAPH Queries for more details.

Topics

Benefits of Using Select AI on Property Graphs

Database users can query property graphs using Select AI to generate graph queries from natural language, reducing manual work and improving understanding of graph relationships.

Key benefits include:
  • NL2SQL: Select AI’s NL2SQL capability now extends to graph queries enabling users to write natural language prompts such as “Find customers who bought a dress”.

  • SQL or PGQ: Depending on the data object, Select AI automatically generates SQL or PGQ query.

  • Productivity: Reduces time and effort in building graph queries using the GRAPH_TABLE operator.

  • Conversations: Retains conversation context and queries a property graph.

Limitations

Select AI for Property Graphs does not support the following capabilities:

How to Use Select AI on Property Graphs

Select AI enables you to explore graph data by using the DBMS_CLOUD_AI.GENERATE function or by using Select AI <action> <prompt>.

After you have defined property graphs in the object_list attribute of your AI profile, you can use:
  • SELECT AI <ACTION> <PROMPT> in the SQL command line to generate an output.

  • DBMS_CLOUD_AI.GENERATE function and supply your prompt within the function.

The following are the supported actions: runsql, showsql, explainsql, narrate, and showpropmt. Select AI for Property Graph also supports session-based short-term and customizable long-term conversations.

See Example: Select AI for Property Graphs and Example: Sample Prompts for Property Graphs to learn more.