Turn Your Data Into Decisive Knowledge

Build powerful, secure, and scalable Knowledge Graphs with the Virtuoso Data Spaces platform.

Overview

This document presents a collection of practical use-case demonstrations showcasing the Virtuoso Data Spaces platform (spanning databases, knowledge graphs, and filesystems), the OpenLink AI Layer (OPAL), and other complementary tools from our vertically integrated product portfolio.

Generating A Knowledge Graph from a WebPage (Unstructured + Structured Text)

Using a combination of the OpenLink Structure Data Sniffer (OSDS) and OpenLink AI Layer (OPAL), a knowledge graph can be immediately generated and stored without hand-written code.

Generating a Knowledge Graphs from Unstructured sources via OPAL

About OPAL

The OpenLink AI Layer (OPAL) is an Virtuoso add-on layer for the creation, deployment, and use of AI Agents and Assistants that are loosely coupled with services and data spaces. It includes support for important protocols such as MCP (Model Context Protocol) and A2A (Agent-2-Agent Protocol) for AI Agent/Assistant construction and use in modern agentic workflows.

OPAL is immediately usable with LLMs from vendors such as OpenAI, Anthropic, Grok, Mistral, Gemini, and others. Additionally, it can be easily configured to work with any LLM service that supports the OpenAI API for external function (i.e., tools) integration—such as Ollama, LM Studio, and more.

OPAL Architecture

Using The OpenLink AI Layer (OPAL), we can create and upload a knowledge graph using natural language.

  • The /chat interface allows users to communicate with Assistants powered by JSON configurations. These configurations can be used with OpenAI, Anthropic, Gemini, and other models.
  • The /assist-metal/ interface allows users to develop and communicate with assistants built for use with the OpenAI API.

From Email Files

This example demonstrates adding email content and extracted entities to our knowledge graph.

From a Legal Document

This example demonstrates adding a Legal Document to our knowledge graph.

From Call Transcripts

This example demonstrates converting call transcript files to RDF turtle, and also executing entity extraction.

From a DoD Report

This example demonstrates converting a report to RDF turtle, and adding it to our knowledge graph.

Integration with LLMs

Webpage Integration

OPAL can be integrated directly into web applications to provide natural language interaction capabilities.

Virtuoso Homepage Example

Evaluation License Generation

Here’s a screencast demonstrating an OPAL-deployed AI Agent/Assistant embedded in an HTML page and accessed via a Chatbot interface. In this example, a Customer Support Agent handles a request for an evaluation license.

OPAL Demo for License Generation

Support Agent

In this screencast example, the same Customer Support Agent handles a product support-related interaction.

OPAL Demo for Support

MCP Servers

OPAL’s core functionality—along with the AI Agents/Assistants built using it—is also directly accessible as MCP (Model Context Protocol) tools via the OPAL MCP server. As a Virtuoso add-on, OPAL additionally exposes a broad range of functionality, including: Database administration, Fine-grained, attribute-based access controls, WebDAV filesystem management, Virtual and native multi-model database management, Query processing (SQL, SPARQL, GraphQL), and more.

Using Claude + MCP (SSE) to query remote PostgreSQL tables via Virtuoso

Using Claude + MCP (SSE) to query remote PostgreSQL tables via Virtuoso

Using OPAL to query Virtuoso via MCP Inspector + SSE

OpenLink MCP Servers

A2A Example

This screencast demonstrates an A2A instigated Agentic workflow that includes interactions with an AI Agent/Assistant created and deployed using OPAL.

Additional Examples

Virtual + Physical Knowledge Graphs from CSV Documents

Dataset

This synthetic dataset includes: Transaction Data, Customer Data, Account Data, and Fraud Labels. View on GitHub.

Script Breakdown: Creating a Knowledge Graph from 80 CSV Documents.

Convert customer and transaction data into Virtual and Physical RDF triples using R2RML (Wizard and Linked Data View Generator).

Load Data into Virtual and Physical SQL Tables

Install Custom Stored Procedure for quickly mapping multiple CSV documents to a virtual SQL table:

                    
DROP PROCEDURE file_dirlist_full;
CREATE PROCEDURE file_dirlist_full (IN a ANY)
    {
        DECLARE _inx integer;        
        DECLARE F VARCHAR;
        DECLARE L INT;

        F := file_dirlist(a,1);
        L := length(F);
        _inx := 0;

        
        While(_inx < L){
            DECLARE v any;
        F[_inx] := concat(a,'/',F[_inx]);
        _inx := _inx + 1;

        }

        return F;
    
    };

DROP PROCEDURE attach_from_csv_dir;
CREATE PROCEDURE attach_from_csv_dir (IN tb VARCHAR, IN dir ANY, in delimiter VARCHAR, in newline VARCHAR, in esc VARCHAR, in skip_rows int, in pkey_columns any := null)
    {
    declare f VARCHAR;

    f:= attach_from_csv(tb,file_dirlist_full(dir),delimiter,newline,esc,skip_rows,pkey_columns);

    return F;
    };
                        
                
Create Virtual and Physical SQL Tables of CSV Data
                        
SPARQL CLEAR GRAPH  ;
DROP TABLE demo.fint.account IF EXISTS;
DROP TABLE demo.fint.customer IF EXISTS;
DROP TABLE demo.fint.transaction IF EXISTS;
DROP TABLE demo.fint.fraud_label IF EXISTS;

DROP TABLE demo.fint.account_physical IF EXISTS;
DROP TABLE demo.fint.customer_physical IF EXISTS;
DROP TABLE demo.fint.transaction_physical IF EXISTS;
DROP TABLE demo.fint.fraud_label_physical IF EXISTS;

ATTACH_FROM_CSV_DIR('demo.fint.account','fint/synthetic_data/accounts',',','\n',null,1,VECTOR(1));
ATTACH_FROM_CSV_DIR('demo.fint.customer','fint/synthetic_data/customers',',','\n',null,1,VECTOR(1));
ATTACH_FROM_CSV_DIR('demo.fint.transaction','fint/synthetic_data/transactions',',','\n',null,1,VECTOR(1));
ATTACH_FROM_CSV_DIR('demo.fint.fraud_label','fint/synthetic_data/fraud_labels',',','\n',null,1,VECTOR(1));

GRANT SELECT ON demo.fint.account to SPARQL_SELECT;
GRANT SELECT ON demo.fint.customer to SPARQL_SELECT;
GRANT SELECT ON demo.fint.transaction to SPARQL_SELECT;
GRANT SELECT ON demo.fint.fraud_label to SPARQL_SELECT;


-- Optional Create SQL Tables Containing Physical Data

CREATE TABLE demo.fint.account_physical
AS SELECT * FROM demo.fint.account
WITH DATA;

CREATE TABLE demo.fint.customer_physical
AS SELECT * FROM demo.fint.customer
WITH DATA;

CREATE TABLE demo.fint.transaction_physical
AS SELECT * FROM demo.fint.transaction
WITH DATA;

CREATE TABLE demo.fint.fraud_label_physical
AS SELECT * FROM demo.fint.fraud_label
WITH DATA;

GRANT SELECT ON demo.fint.account_physical to SPARQL_SELECT;
GRANT SELECT ON demo.fint.customer_physical to SPARQL_SELECT;
GRANT SELECT ON demo.fint.transaction_physical to SPARQL_SELECT;
GRANT SELECT ON demo.fint.fraud_label_physical to SPARQL_SELECT;                        
                    
                
Creating SQL tables from CSVs

Confirm Virtual and Physical Table Creation by Chatting with our Data

We can use OPAL to query the generated table using natural language. A configuration file provides the DDL (Data Definition Language), which can be used to generate queries, provide hard-coded queries to execute, and deliver answers.

Chatting with OPAL to confirm SQL tables

Generate Virtual and Physical Linked Data Views

Option 2: Linked Data View Generator
Linked Data View Generator Demo
Option 3: SQL Script
Example SQL Script on GitHub

Chatting with our Knowledge Graph to confirm its creation

Chatting with OPAL

Querying Virtuoso

SPARQL Query Editor
SPARQL Query Editor
Authentication Demo

When logged in as demo, we can access the Virtual Named Graph after authenticating due to `SELECT` permissions having been granted in the setup script. Without having granted `SELECT` permissions on the underlying table, access will be denied.

This is a result of ACLs applied to the Virtuoso Authentication Layer (VAL). VAL is an open-standards-based, multi-protocol authentication layer, that provides fine-grained, attributed-based access controls (ABAC) for protected resources (HTTP-accessible documents, folders, services [via their endpoints], and SPARQL named graphs). In a nutshell, this solution uses logic, expressed in the form of entity relationships, to address issues such as identity, authorization, and restriction. ACLs can be applied to physical and virtual data, in addition to limiting access and usage to applications and services.

SPARQL Query Editor Example
SPARQL Editor Auth Error
cURL Example
cURL Auth Error
SPASQL QB
SPARQL-within-SQL Example (Blue Links = Globally Resolvable)
SPASQL QB SPARQL Example
SQL Example (Green Links = Locally Resolvable)
SPASQL QB SQL Example Query Result using SPASQLQB
Example Queries Against the Physical Dataset

Using Third-Party Tools

Any ODBC-, JDBC-, or HTTP-compliant application can connect to Virtuoso.

NetworkX (HTTP, ODBC, JDBC)

In this example, we demonstrate how NetworkX can be used in Python to operate on data retrieved from Virtuoso using HTTP(S), ODBC, or JDBC connections. Virtuoso serves as the backend triplestore where RDF data is stored, and this data can be accessed programmatically from Python using SPARQL queries over HTTP(S) or through database connections via ODBC or JDBC. Once the data is retrieved, it is processed and converted into graph structures compatible with NetworkX, enabling users to perform complex network analysis, graph algorithms, and visualizations within the Python environment. This integration provides a powerful means of bridging semantic web data with Python's analytical capabilities.

NetworkX Image

Excel

Data from Virtuoso can be queried from Excel using the Virtuoso ODBC Driver, allowing users to seamlessly access and work with semantic data directly within the familiar Excel environment. By establishing an ODBC connection, Excel can interact with the Virtuoso triplestore, enabling users to import, filter, and analyze RDF-based data without leaving the spreadsheet interface. This integration is especially useful for business analysts and data professionals who rely on Excel for reporting and data manipulation, as it brings the power of linked data into everyday workflows.

Excel Example

Tableau (ODBC or JDBC)

Data from Virtuoso can be queried by Tableau through the use of either an ODBC or JDBC driver, enabling direct integration between the two systems. By connecting Tableau to Virtuoso in this way, users can visualize and analyze RDF-based data stored in Virtuoso using Tableau's powerful data exploration and dashboarding capabilities. This setup allows for real-time or scheduled access to semantic data, making it easier for business users and analysts to derive insights from complex datasets without needing to export or manually transform the data.

Tableau Example

Neo4j

Virtuoso content can be queried from Neo4j by leveraging Virtuoso's JDBC Driver, which facilitates seamless connectivity between the two platforms. By using this driver, data stored within the Virtuoso triplestore can be accessed and integrated into Neo4j workflows, allowing for efficient querying and analysis across heterogeneous data sources. This approach enables developers and data analysts to bridge RDF-based semantic data in Virtuoso with property graph data in Neo4j, enhancing the ability to perform complex queries, data federation, and knowledge graph enrichment within a unified environment.

Neo4j Example

Example HTTP(s) consumer utilizing GraphQL

In this example, we demonstrate how GraphQL can be used in conjunction with an HTML-based Single Page Application (SPA) to operate on data retrieved from Virtuoso using SPARQL. The SPA serves as a dynamic front-end interface, while GraphQL acts as an intermediary layer that abstracts and simplifies access to the underlying RDF data. Data is initially queried from the Virtuoso triplestore using SPARQL, then exposed through a GraphQL API, which the SPA consumes to render interactive and responsive user experiences. This approach combines the flexibility of SPARQL with the developer-friendly querying capabilities of GraphQL, making it easier to build rich, data-driven web applications on top of semantic data.

GraphQL Example

Federated Queries

Creating a Knowledge Graph from Federated SQL RDBMS Tables (local, SQLServer, MySQL)

Tables can be attached via Conductor interface, or programmatically using the `ATTACH_TABLE()` command.

This example runs a SQL query against a Local Virtuoso SQL table and remotely attached SQL Server and MySQL tables

Federated SQL Example Federated SQL Query Example

Virtual and Physical RDF Views can be generated using the “Linked Data Views” feature, or using an R2RML script.

Storing the query as a SQL View

DROP VIEW demo.sql_federation.data;
CREATE VIEW demo.sql_federation.data AS (
  SELECT 
    A.CustomerID, A.CompanyName, B.OrderID, 
    C.EmployeeID, C.LastName, C.FirstName 
  FROM "sqlserver"."northwind"."customers" A 
  NATURAL JOIN "mysql5"."northwind"."orders" B 
  NATURAL JOIN "Demo"."demo"."employees" C
);
GRANT SELECT ON demo.sql_federation.data TO SPARQL_SELECT;

Creating a Virtual Linked Data View

Creating a Virtual Linked Data View

Federated SPARQL Queries (SPARQL-FED)

List the Awards, past partners, and past/current spouses of Robert Downey Jr.

Attribute-based Access Control (ABAC) Example

In this example, access control is used to constrain access to a specific named graph such that, when users haven't logged in via successful authentication, query solutions scoped to the graph return nothing. In other words, only authenticated users will receive query solutions from the protected named graph.

The ACL Implementation Script

-- Cleanup
SPARQL CLEAR GRAPH ;
SPARQL 
DELETE WHERE {
  GRAPH  {
     ?p ?o .
  }
};

-- Make Named Graph Private
DB.DBA.RDF_GRAPH_GROUP_INS ('http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs', 'urn:fint:private');

-- Add an ACL
SPARQL
PREFIX  oplacl:   
PREFIX     acl:   
INSERT INTO GRAPH  {
    a  acl:Authorization ;
    foaf:maker <#dhm> ;
    oplacl:hasAccessMode oplacl:Read ;
    acl:accessTo  ;
    acl:agent ;
    oplacl:hasScope oplacl:PrivateGraphs ;
    oplacl:hasRealm oplacl:DefaultRealm .
};
ACL Quickstart Guide

Benchmarks, Loading & Analysis

Reasoning and Inference

Built-In Reasoning and Inference (RDFS, OWL)

This article demonstrates the use of British Royal Family data snippets to showcase SPARQL query language-based reasoning.

Custom Reasoning and Inference (SPIN)

This article explores Magic Sets and Custom Inference Rules in Virtuoso.