Rupesh Ghosh
Rupesh Ghosh

Reputation: 57

Query a local ttl file using SPARQL on Virtuoso Conductor?

I am trying to learn SPARQL and I am trying to query a local ttl file which is my downloads

The path is : C:/Users/abc/Downloads/human-instructions-english-wikihow/en_0_rdf_result.ttl

SELECT ?s ?p ?o
FROM <C:/Users/abc/Downloads/human-instructions-english-wikihow/en_0_rdf_result.ttl>
WHERE {?s ?p ?o}
LIMIT 1000 

So I am trying to execute a very simple query like this but it does not return any output.

I understand we have to put a SPARQL endpoint or something with 'http' in FROM but this file is on my Downloads and I cant seem to figure out what would be the endpoint.

Please, help me with this. Thanks.

Upvotes: 0

Views: 375

Answers (1)

TallTed
TallTed

Reputation: 9434

(If you haven't already, you need to install the Virtuoso Sponger Middleware module, cartridges_dav.vad, for your version of Virtuoso Enterprise/Commercial Edition or Open Source Edition.)

First, you need to add this line to the top of your SPARQL query --

define get:soft "replace"

That "define pragma" is a SPARQL extension, which tells Virtuoso to resolve remote URLs it encounters in the rest of the query.

Then, you need to use a full URI for the target file. This may be a file: scheme URI, IFF --

  • the URI is properly constructed
  • the target file is accessible through the filesystem where Virtuoso is running
  • the directory holding the target file is included in the DirsAllowed parameter in the virtuoso.ini file

Also see How to import JSON-LD into Virtuoso.

Upvotes: 1

Related Questions