Building and Using Knowledge Graphs via Virtuoso

Virtuoso provides an unrivalled platform for secure, high-performance Knowledge Graph construction. Its capabilities are deceptively simple in both creation and use, while addressing the needs of a wide range of user and operator profiles.

End Users

The following steps get you started quickly:

  1. Install Virtuoso using the native installers for Windows, macOS, or Linux, Docker Container, Nexus Repository, or a cloud virtual machine (AWS, Azure, or GCP).
  2. Start the Virtuoso server via the control panels (available for Windows and macOS) or from the command line on Linux, macOS, or Windows.
  3. Populate your Knowledge Graph using any of the following options:
    • Large Language Models (LLMs)
    • ODBC
    • Sponger Middleware Service
    • Mounted WebDAV DET (Dynamic Extension Type) folders
    • SPARQL queries leveraging the Sponger Middleware Service

Large Language Models (LLMs)

This approach assumes that you have installed and configured both the OpenLink AI Layer (OPAL) module and the Virtuoso Data Connectivity Kit for your platform as part of the installation process.

  1. Obtain an API key for your target LLM.
  2. Start the Virtuoso server.
  3. Navigate to the OPAL endpoint, for example: https://{CNAME}/chat; there’s also alive instance at http://linkeddata.uriburner.com/chat
  4. Provide your target LLM’s API key.
  5. Enable the Data Twingler Agent configuration from the OPAL UI.
  6. Issue the prompt:“With sponging enabled, provide a starting point for exploring the knowledge graph at https://virtuoso.openlinksw.com.”
  7. Repeat for other HTTP-accessible documents of interest.
  8. Ask OPAL to explore the Knowledge Graphs associated with the current Virtuoso instance.

Virtuoso Knowledge Graph Generation via ODBC Data Source Connections

This method assumes that you have installed the Virtuoso Data Connectivity Kit for your platform.

  1. Start the Virtuoso server.
  2. Use an ODBC- or JDBC-based application to connect to Virtuoso via Data Source Names (DSNs) installed with the Virtuoso ODBC drivers.
  3. Identify available ODBC DSNs for external databases.
  4. Use the Virtual Database Manager to attach tables from external databases using their respective DSNs.
  5. Use the RDF-based Linked Data Wizard in the Virtuoso Conductor(http://{CNAME}/conductor, e.g., http://localhost:8890/conductor)to guide you from table attachment through to generating virtual Knowledge Graphs that are deployed using Linked Data principles.

Virtuoso Knowledge Graph Generation via Sponger Middleware

This approach assumes that the Virtuoso Sponger Middleware modules (including transformer and meta cartridges for various document types—HTML enabled by default) are installed.

  1. Start the Virtuoso server.
  2. Identify documents whose content you want to transform into Knowledge Graph data.
  3. Use the following URL pattern in your browser to perform a best-effort transformation of a target document: http://{CNAME}/about/html/{document-url}
    Example: http://localhost:8890/about/html/http/virtuoso.openlinksw.com
    Live Instance Example: https://linkeddata.uriburner.com/about/html/http/virtuoso.openlinksw.com
  4. Repeat for other documents of interest.
  5. Begin using your newly generated Knowledge Graphs.

Virtuoso Knowledge Graph Generation via WebDAV DET (Dynamic Extension Type) Folders

This method assumes that the Virtuoso Briefcase module is installed.

  1. Start the Virtuoso server.
  2. Open the Briefcase interface at: http://{CNAME}/DAV/home/{username}/ or if you have an OpenLink Account: https://my.openlinksw.com/DAV/home/{username} with public folder at https://my.openlinksw.com/DAV/home/{username}/Public
  3. Create an RDF Sink DET folder, specifying the named graph identifier for the generated Knowledge Graph.
  4. Mount Virtuoso into your local operating system using its built-in WebDAV mounting functionality.
  5. Identify documents whose content you want to transform into Knowledge Graph data.
  6. Drag and drop the selected documents into your mounted WebDAV folder.
  7. Begin using your newly generated Knowledge Graphs via ODBC, JDBC, or SPARQL.

SPARQL Queries Leveraging the Sponger Middleware Service

This approach assumes that the Virtuoso Sponger Middleware modules are installed.

  1. Identify documents whose content you want to transform into Knowledge Graph data.
  2. Use the document URL(s) as Named Graph IRIs in the FROM clause of your SPARQL query to perform a best-effort transformation.

Example SPARQL query:

DEFINE get:soft "soft"  # Enables HTTP crawling as part of query execution
SELECT ?type (COUNT(*) AS ?entityCount) (SAMPLE(?entity) AS ?sampleEntity)
WHERE {
    GRAPH ?g {
        ?entity a ?type .
    }
}
GROUP BY ?type
ORDER BY DESC(?entityCount)

From an ODBC-compliant application, you can execute the SQL/SPARQL hybrid variant below, as Virtuoso natively supports both SQL and SPARQL:

SPARQL
DEFINE get:soft "soft"
SELECT ?type (COUNT(*) AS ?entityCount) (SAMPLE(?entity) AS ?sampleEntity)
FROM <https://virtuoso.openlinksw.com/>
WHERE {
    ?entity a ?type .
}
GROUP BY ?type
ORDER BY DESC(?entityCount)

Or embedded within SQL:

SELECT X.type, X.sampleEntity, X.entityCount
FROM (
    SPARQL
    DEFINE get:soft "soft"
    SELECT ?type (COUNT(*) AS ?entityCount) (SAMPLE(?entity) AS ?sampleEntity)
    FROM <https://virtuoso.openlinksw.com/>
    WHERE {
        ?entity a ?type .
    }
    GROUP BY ?type
    ORDER BY DESC(?entityCount)
) AS X
  1. Repeat for additional documents or add more FROM clauses for new target URLs.
  2. Begin using your generated Knowledge Graphs, for example:
  • Via Virtuoso ODBC DSNs in analytics and business intelligence tools
  • By embedding entity hyperlinks in communications, enabling recipients to click through and explore linked Knowledge Graph data

Developers

Depending on your preferred development environment, HTTP, ODBC, or JDBC provide direct access to Virtuoso through its native protocol support. For ODBC and JDBC, create DSNs or JDBC URLs using the Virtuoso drivers installed as part of the Client Connectivity Kits for Windows, macOS, Linux, or cloud virtual machines.

All of the end-user workflows described above can be repeated programmatically using any of these supported protocols from Python, Typescript, Java etc.

Basic Database Connectivity Examples Repo