This project has moved. For the latest updates, please go here.

How to connect to dbpedia with brightstardb

Jul 17, 2014 at 9:54 AM
Edited Jul 18, 2014 at 10:50 AM
Hi there,

I am new to sparql and to brightstarDB.

I am trying to connect to dbpedia using brightstardb, but am confused of how a dotNetRdf.config.ttl file should look like. In case of using the dbpedia, I am not clear of what should replace example.org in the prefix section. At the moment my dotNetRdf.config.ttl looks as follows:
@prefix dnr: <http://www.dotnetrdf.org/configuration#> .
@prefix : <http://example.org/configuration#>.

:sparqlQuery a dnr:SparqlQueryEndpoint ;
    dnr:type "VDS.RDF.Query.SparqlRemoteEndpoint" ;
    dnr:queryEndpointUri <http://dbpedia.org/sparql> .
Could you please let us know what should appear instead of example.org in this case? And should I replace sparqlQuery too?

Thanks!
Coordinator
Jul 20, 2014 at 3:58 PM
Hi,

Did you try just using the type=sparql connection string instead? I think this should work (though not tested):
type=sparql;query=http://dbpedia.org/sparql
If you want to use the DNR config instead then the thing to remeber is that it is the URI of the dnr:SparqlQueryEndpoint that you include in your connection string. So with you configuration as it stands, the URI of the dnr:SparqlQueryEndpoint resource is http://example.org/configuration#sparqlQuery (because the : prefix is mapped to http://example.org/configuration#). So the connection string you would use would be:
type=dotnetrdf;configuration=c:\path\to\dotNetRdf.config.ttl;query=http://example.org/configuration#sparqlQuery
You can change the mapping of the : prefix to anything you like, but then you will need to make sure that you change the value of the query parameter in the connection string.
Jul 21, 2014 at 8:54 AM
Hi there,

I did use the sparql connection string and it worked fine, but I would like to know how to make it work with DNR config. I change the config as follows:
@prefix dnr: <http://www.dotnetrdf.org/configuration#> .
@prefix : <http://dbpedia.org/>.

:sparql a dnr:SparqlQueryEndpoint ;
    dnr:type "VDS.RDF.Query.SparqlRemoteEndpoint" ;
    dnr:queryEndpointUri <http://dbpedia.org/sparql> .
And the code looks as follows:
           //var connectionString = "type=sparql;query=http://dbpedia.org/sparql";

           var conf = @"C:\path\to\dotNetRdf.config.ttl";
           var connectionString1 = "type=dotnetrdf;configuration=" + conf;
          
           var context = BrightstarService.GetDataObjectContext(connectionString1);
           var store = context.OpenStore("sparql");
when I use the 'sparql' connection string it works fine, but when I use the 'dotnetrdf' connection string I get the following error when hitting
var store = context.OpenStore("sparql");

"The store 'sparql' does not exist or cannot be accessed."

Any idea what I have done wrong?

Thanks!
Coordinator
Jul 29, 2014 at 1:36 PM
Hi,

Confusingly, when the connection type is sparql, the name of the store always defaults to 'sparql'. However when you use the dotNetRDF configuration, the name assigned to the store is the full URI of the configuration node in the configuration file (this allows you to store multiple separate configurations in a single file), so in your code you need to pass 'http://dbpedia.org/sparql' as the name of the store as that is the full expanded URI of your configuration node (the :sparql node in the .ttl file).

Hope that makes some sense now!

Cheers

Kal
Jul 29, 2014 at 1:39 PM
Great, it does :-). Will give it a go, thanks!