Native GraphQL Support in Virtuoso — The Basics

Kingsley Uyi Idehen
OpenLink Virtuoso Weblog
4 min readOct 11, 2022

Why?

We wanted to broaden our powerful multi-model data connectivity to include the extensive ecosystem of GraphQL-based APIs. For instance, this would allow the same API to be used for interaction with data managed by any combination of the following:

  • ODBC- or JDBC-accessible data managed by RDBMS platforms, meaning immediate support for Oracle, Microsoft SQL Server, IBM DB2, PostgreSQL, MySQL, Informix, Ingres, Progress OpenEdge, and others
  • HTTP[S]- or HTTP[S]+SPARQL-accessible Private Enterprise Knowledge Graphs
  • Public Knowledge Graphs such as the massive LOD Cloud

What?

We have added a built-in query service endpoint for handling HTTP messages comprising GraphQL payloads that perform query and mutation (insert and delete) operations from GraphQL clients.

How?

Database Administrators (DBAs) or others assigned such privileges can declare Virtuoso Views, scoped to relational Tables or Graphs, to be GraphQL-accessible using any of the following approaches:

  • a Wizard Interface
  • Custom Schema Annotations (including support for the GraphQL Scehema Definition Language [SDL])

Example — iPhone Offers from various sources

  1. Ensure you have the OpenLink Structured Data Sniffer Extension [OSDS] (for Chrome-based Browsers, Firefox, Apple Safari, Microsoft Edge, etc.) installed in your browser
  2. Visit an iPhone 14 product page

3. Invoke OSDS by clicking on its Doggie icon in your browser’s toolbar

4. Select the option to Download structured data discovered in these HTML pages to the default SPARQL Query Services Endpoint for our publicly accessible URIBurner instance of Virtuoso. Note that you will need to set the target Named Graph identifier to urn:schemaorg:products:abox.

Page Showing Extraction and Upload Results

4. Visit the offers/shop page associated with the iPhone 14 product page.

5. Repeat step 3.

iPhone 14 Product Page

iPhone 14 Offers Page

6. Open up your favorite GraphQL Client (GraphiQL, Insomnia, GraphQL Bin, etc.), set your target GraphQL Query Service endpoint to https://linkeddata.uriburner.com/graphql, and paste in one of the queries below:

query iPhoneProducts {              
Products (description: {like: "%Phone%"})
{
iri
name
description
offers {
iri
sku
price
}
}
}

or

query iPhoneProducts {              
Products (description: {like: "%Phone%"})
{
iri
name
description
offers {
iri
sku
price
}
}
}

The screenshots below display the effects in a couple of GraphQL clients

Insomnia GraphQL Client

GraphiQL GraphQL Client

Conclusion

Native GraphQL support in Virtuoso adds a new Data Access & Data Connectivity option alongside our existing support of SPARQL and SQL. The net effect is that an even broader collection of client tools can now take advantage of Virtuoso’s secure, high-performance, and platform-independent services for data access, integration, virtualization, and management.

GraphQL Client Tools Used

Live GraphQL Query Service Editing & Execution Endpoints

Live GraphiQL Interactive Query Service Endpoints

Related

--

--

Kingsley Uyi Idehen
OpenLink Virtuoso Weblog

CEO, OpenLink Software —High-Performance Data Centric Technology Providers.