Package: virtuoso 0.1.8
virtuoso: Interface to 'Virtuoso' using 'ODBC'
Provides users with a simple and convenient mechanism to manage and query a 'Virtuoso' database using the 'DBI' (Data-Base Interface) compatible 'ODBC' (Open Database Connectivity) interface. 'Virtuoso' is a high-performance "universal server," which can act as both a relational database, supporting standard Structured Query Language ('SQL') queries, while also supporting data following the Resource Description Framework ('RDF') model for Linked Data. 'RDF' data can be queried using 'SPARQL' ('SPARQL' Protocol and 'RDF' Query Language) queries, a graph-based query that supports semantic reasoning. This allows users to leverage the performance of local or remote 'Virtuoso' servers using popular 'R' packages such as 'DBI' and 'dplyr', while also providing a high-performance solution for working with large 'RDF' 'triplestores' from 'R.' The package also provides helper routines to install, launch, and manage a 'Virtuoso' server locally on 'Mac', 'Windows' and 'Linux' platforms using the standard interactive installers from the 'R' command-line. By automatically handling these setup steps, the package can make using 'Virtuoso' considerably faster and easier for a most users to deploy in a local environment. Managing the bulk import of triples from common serializations with a single intuitive command is another key feature of this package. Bulk import performance can be tens to hundreds of times faster than the comparable imports using existing 'R' tools, including 'rdflib' and 'redland' packages.
Authors:
virtuoso_0.1.8.tar.gz
virtuoso_0.1.8.zip(r-4.5)virtuoso_0.1.8.zip(r-4.4)virtuoso_0.1.8.zip(r-4.3)
virtuoso_0.1.8.tgz(r-4.5-any)virtuoso_0.1.8.tgz(r-4.4-any)virtuoso_0.1.8.tgz(r-4.3-any)
virtuoso_0.1.8.tar.gz(r-4.5-noble)virtuoso_0.1.8.tar.gz(r-4.4-noble)
virtuoso_0.1.8.tgz(r-4.4-emscripten)virtuoso_0.1.8.tgz(r-4.3-emscripten)
virtuoso.pdf |virtuoso.html✨
virtuoso/json (API)
NEWS
# Install 'virtuoso' in R: |
install.packages('virtuoso', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org')) |
Reviews:rOpenSci Software Review #271
Bug tracker:https://github.com/ropensci/virtuoso/issues
Pkgdown site:https://docs.ropensci.org
On CRAN:virtuoso-0.1.8(2021-11-02)
Last updated 11 months agofrom:c04a01bc22 (on master). Checks:9 OK. Indexed: yes.
Target | Result | Latest binary |
---|---|---|
Doc / Vignettes | OK | Mar 14 2025 |
R-4.5-win | OK | Mar 14 2025 |
R-4.5-mac | OK | Mar 14 2025 |
R-4.5-linux | OK | Mar 14 2025 |
R-4.4-win | OK | Mar 14 2025 |
R-4.4-mac | OK | Mar 14 2025 |
R-4.4-linux | OK | Mar 14 2025 |
R-4.3-win | OK | Mar 14 2025 |
R-4.3-mac | OK | Mar 14 2025 |
Exports:has_virtuosovos_configurevos_connectvos_delete_dbvos_destroy_allvos_importvos_installvos_killvos_list_graphsvos_logvos_odbcinstvos_processvos_queryvos_set_pathsvos_startvos_statusvos_uninstall
Dependencies:bitbit64blobclicurlDBIdigestfsgluehmsinilifecycleodbcpkgconfigprocessxpsR6rappdirsRcpprlangvctrs
Citation
To cite package ‘virtuoso’ in publications use:
Boettiger C (2025). virtuoso: Interface to 'Virtuoso' using 'ODBC'. R package version 0.1.8, https://github.com/ropensci/virtuoso.
Corresponding BibTeX entry:
@Manual{, title = {virtuoso: Interface to 'Virtuoso' using 'ODBC'}, author = {Carl Boettiger}, year = {2025}, note = {R package version 0.1.8}, url = {https://github.com/ropensci/virtuoso}, }
Readme and manuals
virtuoso

The goal of virtuoso is to provide an easy interface to Virtuoso RDF database from R.
Installation
You can install the development version of virtuoso from GitHub with:
# remotes::install_github("ropensci/virtuoso")
install.packages("virtuoso", repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'))
Getting Started
library(virtuoso)
For Mac users, virtuoso
package includes a utility function to install
and configure a local Virtuoso Open Source instance using Homebrew.
Otherwise, simply install the Virtuoso Open Source edition for your
operating system.
vos_install()
#> Virtuoso is already installed.
We can now start our Virtuoso server from R:
vos_start()
#> PROCESS 'virtuoso-t', running, pid 14318.
#> Server is now starting up, this may take a few seconds...
#> latest log entry: 21:43:06 Server online at 1111 (pid 14318)
Once the server is running, we can connect to the database.
con <- vos_connect()
Our connection is now live, and accepts SPARQL queries directly.
DBI::dbGetQuery(con, "SPARQL SELECT * WHERE { ?s ?p ?o } LIMIT 4")
#> s
#> 1 http://www.openlinksw.com/virtrdf-data-formats#default-iid
#> 2 http://www.openlinksw.com/virtrdf-data-formats#default-iid-nullable
#> 3 http://www.openlinksw.com/virtrdf-data-formats#default-iid-nonblank
#> 4 http://www.openlinksw.com/virtrdf-data-formats#default-iid-nonblank-nullable
#> p
#> 1 http://www.w3.org/1999/02/22-rdf-syntax-ns#type
#> 2 http://www.w3.org/1999/02/22-rdf-syntax-ns#type
#> 3 http://www.w3.org/1999/02/22-rdf-syntax-ns#type
#> 4 http://www.w3.org/1999/02/22-rdf-syntax-ns#type
#> o
#> 1 http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat
#> 2 http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat
#> 3 http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat
#> 4 http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat
DSL
virtuoso
also provides wrappers around some common queries to make it
easier to work with Virtuoso and RDF.
The bulk loader can be used to quickly import existing sets of triples.
example <- system.file("extdata", "person.nq", package = "virtuoso")
vos_import(con, example)
Can also read in compressed formats as well. Remember to set the pattern match appropriately. This is convenient because N-Quads compress particularly well, often by a factor of 20 (or rather, can be particularly large when uncompressed, owing to the repeated property and subject URIs).
ex <- system.file("extdata", "library.nq.gz", package = "virtuoso")
vos_import(con, ex)
vos_import
invisibly returns a table of the loaded files, with error
message and loading times. If a file cannot be imported, an error
message is returned:
bad_file <- system.file("extdata", "bad_quads.nq", package = "virtuoso")
vos_import(con, bad_file)
#> Error: Error importing: bad_quads.nq 37000 SP029: NQuads RDF loader, line 2: Undefined namespace prefix at ITIS:1000000
We can now query the imported data using SPARQL.
df <- vos_query(con,
"SELECT ?p ?o
WHERE { ?s ?p ?o .
?s a <http://schema.org/Person>
}")
head(df)
#> p o
#> 1 http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://schema.org/Person
#> 2 http://schema.org/jobTitle Professor
#> 3 http://schema.org/name Jane Doe
#> 4 http://schema.org/telephone (425) 123-4567
#> 5 http://schema.org/url http://www.janedoe.com
vos_query(con,
"SELECT ?p ?o
WHERE { ?s ?p ?o .
?s a <http://example.org/vocab#Chapter>
}")
#> p
#> 1 http://www.w3.org/1999/02/22-rdf-syntax-ns#type
#> 2 http://purl.org/dc/elements/1.1/description
#> 3 http://purl.org/dc/elements/1.1/title
#> o
#> 1 http://example.org/vocab#Chapter
#> 2 An introductory chapter on The Republic.
#> 3 The Introduction
Server controls
We can control any virtuoso
server started with vos_start()
using a
series of helper commands.
vos_status()
#> latest log entry: 21:43:06 PL LOG: No more files to load. Loader has finished,
#> [1] "sleeping"
Advanced usage note: vos_start()
invisibly returns a processx
object
which we can pass to other server control functions, or access the
embedded processx
control methods directly. The virtuoso
package
also caches this object in an environment so that it can be accessed
directly without having to keep track of an object in the global
environment. Use vos_process()
to return the processx
object. For
example:
library(ps)
p <- vos_process()
ps_is_running(p)
#> [1] TRUE
ps_cpu_times(p)
#> user system children_user children_system
#> 1.61 0.29 0.00 0.00
ps_suspend(p)
#> NULL
ps_resume(p)
#> NULL
Going further
Please see the package vignettes for more information:
Please note that the virtuoso
R package is released with a
Contributor Code of
Conduct. By
contributing to this project, you agree to abide by its terms.
Help Manual
Help page | Topics |
---|---|
check for Virtuoso | has_virtuoso |
Configure Virtuoso Server ini file | vos_configure |
Connect to a Virtuoso Server over ODBC | vos_connect |
Delete Virtuoso Database | vos_delete_db |
Destroy all Virtuoso's directories | vos_destroy_all |
Bulk Import of RDF triples | vos_import |
Helper method for installing Virtuoso Server | vos_install |
Stop (kill) the Virtuoso server | vos_kill |
List graphs | vos_list_graphs |
Query the server logs | vos_log |
Configure the ODBC Driver for Virtuoso | vos_odbcinst |
Return a handle to an existing Virtuoso Process | vos_process |
Run a SPARQL query | vos_query |
set Virtuoso paths | vos_set_paths |
Start a Virtuoso Server | vos_start |
Query the server status | vos_status |
Uninstall Virtuoso | vos_uninstall |