9 GraphQL Language Used for JSON-Relational Duality Views
GraphQL is an open-source, general-purpose query and data manipulation language that is compatible with a variety of databases.
Beginning with Oracle AI Database 26ai, Oracle introduces the support for GraphQL queries. For details on Oracle’s custom GraphQL syntax, refer to the chapter Custom GraphQL Syntax in Oracle in the Oracle Database Support for GraphQL Developer's Guide . It is essential to familiarize yourself with the GraphQL Schema Conventions in Oracle AI Database, as these outline the specific naming conventions employed.
Oracle AI Database supports a subset of GraphQL syntax and operations for creating
JSON-relational duality views, including:
- Custom GraphQL Scalars: Oracle AI Database supports extending the GraphQL type system with custom scalar types. This enables direct mapping between native Oracle data types and GraphQL, allowing more accurate representation and manipulation of database-specific data in GraphQL queries.
- Implicit Field Aliasing Support for GraphQL: The database supports implicit aliasing of fields in GraphQL queries. This means that, when needed to prevent naming collisions (such as when fields from different tables share names), Oracle automatically assigns unique aliases to ensure output consistency and clarity.
- Generating a GraphQL Schema from a Relational Schema: Oracle can generate a GraphQL schema automatically from an existing relational schema. This process translates tables, relationships, and columns in the Oracle AI Database into GraphQL types and fields, making the underlying data accessible through GraphQL with minimal manual schema definition effort.
- Custom GraphQL Directives for JSON-relational duality
views: A directive in GraphQL is a special annotation, prefixed with
the
@
symbol, that can be attached to fields, fragments, or operations within a GraphQL schema or query. Directives instruct the GraphQL processor to alter the execution, control filtering, change result shapes, or define advanced behaviors such as joins and computed fields. In Oracle AI Database, directives provide powerful means to customize both queries and the creation of JSON-relational duality views. While the Custom GraphQL Directives in Oracle from Oracle Database Support for GraphQL Developer's Guide presents examples of all GraphQL directives supported by Oracle, the topic GraphQL Directives supported by Oracle for Duality-View Creation offers more in-depth examples specifically tailored to the creation of duality views. - QBEs for JSON-relational duality views: GraphQL
Query-By-Example (QBE) allows developers to specify example field values
directly in queries to filter results. QBE uses a standardized set of operators
(such as
_eq
,_lt
,_like
,_and
, or_or
) within thecheck
clause to define predicates for filtering data in duality views. While the GraphQL QBEs in Oracle presents examples of all QBE operators supported by Oracle, the topic QBEs for Duality View Creation provides you with duality view specific examples. - GraphQL Arguments for JSON-relational duality views: Oracle AI Database allows the use of standard arguments in GraphQL queries for duality views. Arguments can be used to filter, sort, or otherwise refine the result set returned, leveraging GraphQL's flexible query capabilities on top of Oracle’s duality views for more targeted data access.