Load json-ld files into virtuoso fails

Hi

Virtuoso Version: Docker image for Virtuoso Open-Source Edition 7.2

So far I could upload (Bulk Loading) and query 10000 of ttl files without any issue following this steps (after setting up the Virtuoso server):

  • isql 1111
    1- LOAD rdfloader.sql;
    2- SPARQL create GRAPH http://example.org;
    2- ld_dir (‘import_data’, ‘.’, ‘http://example.org’);
    3- rdf_loader_run ();
    4- checkpoint;

Then query the stored data in the “http://example.org” graph using the virtuoso Sparql endpoint.

For the json-ld files I have installed the “Sponger Middleware - rdf_mappers_dav.vad” package and restart the virtuoso server. I followed the previous steps I have described earlier with no error. Unfortunately nothing is stored under the “json-ld Graph IRI” I have created.

When I query the created Graph “‘http://json-ld.org’”:

SPARQL SELECT COUNT(*) FROM <http://json-ld.org> WHERE { ?s ?p ?o}

callret-0
0

did I miss something?

What are you seeking to do bulk load json-ld dataset files with the Virtuoso RDF Bulk Loader ? As json-ld files are not a format supported by Virtuoso bulk loader as indicated in the docs, where the supported formats are listed.

Thanks for your reply. So there is no way to store and query json-ld in Virtuoso ?

You can load JSON-LD into Virtuoso using a variety of options:

  1. Sponger Middleware component where simply provide a JSON-LD doc URL
  2. OpenLink Structured Data Sniffer via its “Upload to SPARQL Endpoint” feature
  3. New JSON-LD bulk-loader (just like what exists for Turtle)

@hwilliams will publish a new guide for the new JSON-LD bulk-loader sometime today.

Thanks a lot for your kind response !

This HowTo – Load JSON-LD files into Virtuoso post has been published.

Thanks a lot.

To run virtuoso I am using : docker run --name virtuoso --publish 5555:5555 --publish 1111:1111 -e DBA_PASSWORD=dba --volume pwd:/database openlink/virtuoso-opensource-7:latest
When I run the rdf_load_json_ld (file_to_string('JSONLD_IMPORT/test.jsonld'),'', 'https://g.org');

I got this error: Undefined procedure DB.DBA.rdf_load_json_ld
Shouldn’t be the RDF_LOAD_JSON_LD( ) included in : openlink/virtuoso-opensource-7:latest

You must be running an old docker image version, check what version is being used with the command docker run openlink/virtuoso-opensource-7 version:

$ sudo docker run openlink/virtuoso-opensource-7 version

[openlink/virtuoso-opensource-7:7.2.9-r15-g2daec95-ubuntu]

This Docker image is using the following version of Virtuoso:

Virtuoso Open Source Edition (Column Store) (multi threaded)
Version 7.2.9.3236-pthreads as of Feb 27 2023 (795af34a7)
Compiled for Linux (x86_64-ubuntu_bionic-linux-gnu)
Copyright (C) 1998-2023 OpenLink Software
$

and if not running the latest, you can force the update of your locally pulled image with the command docker pull openlink/virtuoso-opensource-7:latest:

$ sudo docker pull openlink/virtuoso-opensource-7:latest
latest: Pulling from openlink/virtuoso-opensource-7
72d9f18d70f3: Pull complete 
493cb2e342d9: Pull complete 
bce6920f6256: Pull complete 
4f4fb700ef54: Pull complete 
Digest: sha256:d0a22310d917abf5bcc29bc57c60a8463f0a77521994075d626e29335c5050a1
Status: Downloaded newer image for openlink/virtuoso-opensource-7:latest
docker.io/openlink/virtuoso-opensource-7:latest
$

With the Version 7.2.9.3236-pthreads as of Feb 27 2023 (795af34a7) image the rdf_load_json_ld(...) procedure does exist:

SQL> rdf_load_json_ld (file_to_string('test.jsonld'),'', 'urn:test:jsonld');

Done. -- 44 msec.
SQL> sparql select * from <urn:test:jsonld> where {?s ?p ?o};
s                                                                                 p                                                                                 o
LONG VARCHAR                                                                      LONG VARCHAR                                                                      LONG VARCHAR
_______________________________________________________________________________

http://dbpedia.org/resource/John_Lennon                                           http://schema.org/spouse                                                          http://dbpedia.org/resource/Cynthia_Lennon
http://dbpedia.org/resource/John_Lennon                                           http://xmlns.com/foaf/0.1/name                                                    John Lennon
http://dbpedia.org/resource/John_Lennon                                           http://schema.org/birthDate                                                       1940-10-09

3 Rows. -- 1 msec.
SQL> status();
REPORT
VARCHAR
_______________________________________________________________________________

OpenLink Virtuoso  Server
Version 07.20.3236-pthreads for Linux as of Feb 27 2023 (795af34a7)
Started on: 2023-05-19 10:23 GMT+0

Note if you have an existing database you will have to remove the image ie --name virtuoso and recreate with the same persistent volume ie --volume pwd:/database

Thanks, this was the reason.

Last question, How can I load more than one jsonld file at the time? e.g., *.jsonld

In the upcoming Virtuoso open source and commercial. releases, support has been added to the Virtuoso RDF Bulk Loader to enable bulk loading of JSON-LD datasets as for other datasets (TTL, N3, NQUAD etc). This is not available in the docker containers, until these have been updated when the release is made. Although the fix is in the Virtuoso open source develop/7 branch, such that binary with such support can be built from source for testing.

1 Like