Build powerful, secure, and scalable Knowledge Graphs with the Virtuoso Data Spaces platform.
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.
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.
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.
Using The OpenLink AI Layer (OPAL), we can create and upload a knowledge graph using natural language.
This example demonstrates adding email content and extracted entities to our knowledge graph.
This example demonstrates adding a Legal Document to our knowledge graph.
This example demonstrates converting call transcript files to RDF turtle, and also executing entity extraction.
This example demonstrates converting a report to RDF turtle, and adding it to our knowledge graph.
OPAL can be integrated directly into web applications to provide natural language interaction capabilities.
Virtuoso Homepage ExampleHere’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.
In this screencast example, the same Customer Support Agent handles a product support-related interaction.
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.
This screencast demonstrates an A2A instigated Agentic workflow that includes interactions with an AI Agent/Assistant created and deployed using OPAL.
This synthetic dataset includes: Transaction Data, Customer Data, Account Data, and Fraud Labels. View on GitHub.
Convert customer and transaction data into Virtual and Physical RDF triples using R2RML (Wizard and Linked Data View Generator).
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;
};
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;
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.
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.
1. List All Accounts and their Primary + Secondary Account Holders
2. List All Accounts and their Balances
3. List All Accounts With a Primary or Secondary Account Holder with a Risk Score over 80.
Any ODBC-, JDBC-, or HTTP-compliant application can connect to Virtuoso.
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.
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.
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.
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.
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.
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
Virtual and Physical RDF Views can be generated using the “Linked Data Views” feature, or using an R2RML script.
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;
List the Awards, past partners, and past/current spouses of Robert Downey Jr.
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.
-- 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
This article demonstrates the use of British Royal Family data snippets to showcase SPARQL query language-based reasoning.
This article explores Magic Sets and Custom Inference Rules in Virtuoso.