Set the default Query Graph URI in ISQL

Hi there,

I have opened a sparql endpoint at http://subdomain.domain.org:8890/sparql/, and also loaded my RDF Graph under URI: http://localhost:8890/mydata, and I can get the data from it by specifying default-graph-uri in the query header itself.

My issue is simple, I would like to query the endpoint http://subdomain.domain.org:8890/sparql/ without specifying the default graph URI, but get data from a specific (my) RDF graph as a default.

Naturally, I have seen this documentation:
https://docs.openlinksw.com/virtuoso/rdfdefaultgraph/

So inserted this in ISQL:

INSERT INTO DB.DBA.SYS_SPARQL_HOST (SH_HOST, SH_GRAPH_URI) VALUES 
('subdomain.domain.org', 'http://localhost:8890/mydata');

I have also removed what other entry was there by default (it was a wildcard). As per the documentation:

The search of DB.DBA.SYS_SPARQL_HOST stops at the first found row, other possible matches are silently ignored.

After adding the new entry, I restarted the server to be sure.

So that did not solve anything. I still don’t get my data from my URI, but the default one.

Could you tell me what I’m missing?

1 Like

Have you tried setting the DefaultGraph INI file setting in the [SPARQL] section as detailed in the documentation, which is the easiest way to set the default graph to always be used when running a SPARQL query.

Yes, of course. This variable simply fills the “Default Data Set Name (Graph IRI)” input box in the virtuoso endpoint web UI. Pretty underwhelming. Programmatic queries, without specifying the exact graph, still go to the old default set, not the one specified in the DefaultGraph in the ini file.

What is the old default set graph you refer to ie where exactly is it being set ?

What is the output of querying the DB.DBA.SYS_SPARQL_HOST table so we can see what it contains ?

What is the Virtuoso version being used ?

What is the old default set graph you refer to ie where exactly is it being set ?

Whatever the virtuoso default graph is when you initiate it first time without any setup. Some RDF graph where all the subjects are openlink IRI, nothing more.

What is the output of querying the DB.DBA.SYS_SPARQL_HOST table so we can see what it contains ?

What I have inserted. One row:
SH_HOST | SH_BASE_URI | SH_GRAPH_URI | SH_DEFINES | SH_USER_URI
subdomain.domain.org | NULL | http://localhost:8890/mydata | NULL | NULL

What is the Virtuoso version being used ?

OpenLink Virtuoso Universal Server; Version 07.20.3235

Are you using the Virtuoso commercial or open source product ?

Note also that if as indicated your Virtuoso instance is running on port 8890, then that should be included as part of the hostname in the DB.DBA.SYS_SPARQL_HOST table as that would be returned in the HTTP response header ie subdomain.domain.org:8890.

1 Like

That was it! I should have added port.

I have interpreted this sentence from the documentation wrong:

From: 16.2.8.Default and Named Graphs

The SH_HOST field acts as ‘pattern’ argument for the SQL string operator LIKE. If a matching row is found, the text of SPARQL request is extended.

According to this SH_HOST is a pattern used to match the URL and “the text of SPARQL request is extended”. The pattern however is not specified, so I have assumed this means “S%” (extended), but it makes sense it is “%S” for “http/https” match.

Thanks a lot!

I’m using open source.

1 Like