Can I use Studio with a connection to DBPedia sparql endpoint?

Can I use Studio with a connection to DBPedia sparql endpoint at https://dbpedia.org/sparql?

Studio can only connect to Stardog endpoints, however you can connect to a Stardog endpoint within Studio and then use a Federated query to query dbpedia.

Stephen,

Thanks for your answer. It is nice to know that this capability exists in Stardog.

I wish there was a blog/tutorial on using SERVICE from inside Studio. Such a tutorial could show how a local Stardog knowledge graph can be enriched with data from DBPedia. I would be happy to contribute to such a blog.

The first step would be able to run such a query:


PREFIX dbp: <http://dbpedia.org/property/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX res: <http://dbpedia.org/resource/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?uri ?string 
WHERE { 
	?uri rdf:type dbo:Company  .
        ?uri dbp:industry ?industry .
        FILTER regex(?industry,'advertising','i') .
        OPTIONAL {?uri rdfs:label ?string . FILTER (lang(?string) = 'en') }
}

The above query comes from this site https://aifb-ls3-kos.aifb.kit.edu/projects/spartiqulator/examples.htm

  • Can you please outline the steps necessary to run this as a SERVICE?

Thanks,
Radu

PREFIX dbp: <http://dbpedia.org/property/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX res: <http://dbpedia.org/resource/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?uri ?string 
WHERE { 
    SERVICE <http://dbpedia.org/sparql> {
	?uri rdf:type dbo:Company  .
        ?uri dbp:industry ?industry .
        FILTER regex(?industry,'advertising','i') .
        OPTIONAL {?uri rdfs:label ?string . FILTER (lang(?string) = 'en') }
    }
}

You just need to wrap the portion that you would like to run remotely in a SERVICE followed by the sparql endpiont.

See https://www.w3.org/TR/sparql11-federated-query/

After running the above query I am getting this

Not sure what went wrong. IMy server version is 6.1 but I can upgrade to latest.

Regards,
Radu

I just successfully ran the query in 7.1.0 but there isn't anything in the query that shouldn't have run successfully in 6.1 as well. How are you running the query? Is there anything in the logs?

getting Caused by: java.net.UnknownHostException: dbpedia.org

Sounds like you have a dns problem. Can you get to dbpedia.org with a browser?

Yes my browser opens dpbedia.org

Zach,

BTW - I can also use curl and pass http proxy credentials with proxy and port number and able to make http request to http://dbpedia.org/ from the same host where Stardog is running.

  • How do I specify this proxy info in Stardog? Or better yet can Stardog read environment variables?

Regards,
Radu

You need to set some JVM system arguments. httpProxyHost, httpProxyPort, httpProxyPassword, and httpProxyUser you can also add https variants if you need that.

You can set these in the STARDOG_SERVER_JAVA_ARGS environment variable

export STARDOG_SERVER_JAVA_ARGS="-DhttpProxyHost=myproxyhost -DhttpProxyPort=7777 ...."

Zach,

I've tried the above arguments on a windows (used SET instead of EXPORT) box with Stardog 6 installed and getting the same error.

It should work in v6 ... thinking that I could try v7 ... but it requires docker...

Regards,
Radu

I should have mentioned that not being able to resolve the name isn't going to be fixed by setting up an http proxy although if you're network is setup to use a proxy you're going to need that setup as well.

Can you resolve the name when running the following command from cmd.exe?

$> nslookup dbpedia.org

I don't know exactly how windows handles the dns resolution for java but you can tell java to use a specific nameserver with the following system property. I'm guessing it would work for non Oracle JVM's but not sure. I don't think I've ever messed around with that before.

sun.net.spi.nameservice.nameservers=<my-nameserver-ip-address>

dns is not the problem - i've replaced dbpedia.org with 194.109.129.58 - and still getting error