Introducing Native GraphQL Support in Virtuoso

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
  • 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 (insert and delete) mutation 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

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

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

  2. Repeat step 3.

iPhone 14 Product Page

iPhone 14 Offers Page

  1. 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
                      offers {
                              iri
                              sku
                              price
                      }
              }
      }
    

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

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

Related

1 Like