HowTo -- CHAT-GPT and DBpedia SPARQL Query Generation from Natural Language Prompts

Generating clickable DBpedia SPARQL Query Solution Page Link using Bing+ChatGPT Service

Here’s a transcript for a variant of this exercise using the Bing + GPT service.

Q: Given the following template.

What is the county of <A>;select ?a where { <A> <http://dbpedia.org/ontology/county> ?a };select ?a where { ?a <http://dbpedia.org/ontology/county> [] . ?a a <http://dbpedia.org/ontology/Place> } Find the country of London using SPARQL.

A:

PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbr: <http://dbpedia.org/resource/>

SELECT ?country WHERE {
dbr:London dbo:country ?country.
}

Q: Can you generate a clickable sparql url for that query? Just say yes or no.

A:

Here is the clickable link for the SPARQL query:

https://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=PREFIX+dbo%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2F%3E%0D%0APREFIX+dbr%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2F%3E%0D%0A%0D%0ASELECT+%3Fcountry+WHERE+%7B%0D%0A++dbr%3ALondon+dbo%3Acountry+%3Fcountry.%0D%0A%7D&format=text/html&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on

Bing Answer Link .

Q: That isn’t a clickable link since I need to copy and paste it to a browser for resolution.

A:

I apologize for the confusion. Here is the clickable link for the SPARQL query:

https://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=PREFIX+dbo%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2F%3E%0D%0APREFIX+dbr%3A+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2F%3E%0D%0A%0D%0ASELECT+%3Fcountry+WHERE+%7B%0D%0A++dbr%3ALondon+dbo%3Acountry+%3Fcountry.%0D%0A%7D&format=text/html&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on

Bing Anwser Link

Q: Yes, that’s much better. Use “SPARQL Query Response” as the label applied to the clikcable link.

A:

Here is the clickable link for the SPARQL query:

SPARQL Query Response

Bing Answer Link