Re: ChatGPT, ontologies and SPARQL

Hi.

Going back to the original topic of ChatGPT’s ability to generate SPARQL queries from NL.
I worry about the danger of inferring general abilities from the typical SPARQL examples we use, such as the one given.

I sort of think of LLMs as amazing, indexed search engines (over their corpus), combined with an astonishing ability to merge the results they find into a single search result.

When I use Google to look for the SPARQL result quoted in the first post, I find many examples that closely resemble the SPARQL given.
This is not surprising, as the inputs to ChatGPT for a quick experiment like this are likely to be the sort of ideas of queries that people have made up to show as examples of SPARQL.
And the corpus will contain many of them.
So the question for me is how far can things like ChatGPT go down the road of doing stuff that has no examples in the wild to work from?
That is, what can it do new for SPARQL (or anything else, of course)?

In particular, any evaluation of the utility of ChatGPT etc for NL->SPARQL would need to take a wide view of the sort of inputs used if it was to establish that they were really generally useful, rather than just filling in templates of typical queries.

What do you think?

Best
Hugh

> On 20 Jan 2023, at 11:07, Adeel <aahmad1811@gmail.com> wrote:
> 
> Hello,
> 
> I think for simple queries you can build a bridge between the two.
> However, for complicated sparql queries, chatgpt will not be sufficient, you will likely have to look further a field into KG embeddings or GNNs.
> 
> Thanks,
> 
> Adeel
> 
> On Fri, 20 Jan 2023 at 10:08, Patrick Logan <patrickdlogan@gmail.com> wrote:
> I wonder given such translations to SPARQL whether there's been any work to compare the original natural language query to a mechanical translation of that SPARQL back to natural language?
> More generally, what tools does a non-programmer need to have confidence in the SPARQL they've generated?
> 
> On Wed, Jan 18, 2023, 6:33 AM Dan Brickley <danbri@danbri.org> wrote:
> 
> 
> On Wed, 18 Jan 2023 at 14:21, Paola Di Maio <paola.dimaio@gmail.com> wrote:
> fyi - would be good to be able to generate sparql queries and interact with ontologies using natural language
> thanks to this user for discovering this feature
> 
> In general these new large LLM models seem to have a weird effect on commentators: their ability to casually and confidently just make up answers, tends to distract from their less exciting but potentially transformative ability to kinda-sorta-kinda “understand” questions expressed in natural language. 
> 
> Dan
> 
> ps. folk here might find 
> https://github.com/jerryjliu/gpt_index worth exploring, as a tool that supports idea of combining LLMs with external data. I have also had promising results using GPT-* etc to generate SPARQL…
> 
> 
> 
> ---------- Forwarded message ---------
> From: Paola Di Maio <paola.dimaio@gmail.com>
> Date: Wed, Jan 18, 2023 at 10:15 PM
> Subject: Re: ChatGPT, ontologies and SPARQL
> To: Contact - Cogsonomy <contact@cogsonomy.fr>
> Cc: Semantic Web <semantic-web@w3.org>
> 
> 
> assuming the syntax is good
>  (your example validates here http://sparql.org/$/validate/query)
> then it looks like a big YES
> It would be amazing to have a tool that can translate natural language queries into sparql
> and remove a major hurdle to using open ontologies on the web
> Please, lets set up a catalogue of examples and evaluate the results
> great functionality if it works
> thank you
> 
> 
> On Tue, Jan 17, 2023 at 10:41 PM Contact - Cogsonomy <contact@cogsonomy.fr> wrote:
> Hi,
> I asked chatGPT to create a sparql query for DBPedia by translating my question expressed in natural language : "Give me all the names of the cities located in France whose number of inhabitants is greater than 10,000".
> Its answer was as follows : 
> here's the SPARQL query to answer the question:
> 
> PREFIX dbo: <http://dbpedia.org/ontology/>
> PREFIX dbr: <http://dbpedia.org/resource/>
> SELECT ?city 
> WHERE {
>   ?city a dbo:City;
>         dbo:populationTotal ?population;
>         dbo:country dbr:France.
>   FILTER (?population > 10000)
> }
> This query uses the dbo prefix to access the DBpedia ontology and the dbr prefix to access the DBpedia resources. It selects the names of cities (?city) that are instances of dbo:City, have a total population (?population) greater than 10000, and have the dbo:country property with the value dbr:France (which represents France).
> We can see on social networks several tests of chatGPT related to ontologies.  Do you think we can use chatGPT to query natural language ontologies (if we give it the structure before, of course)? And if we give a consequent corpus in learning to the GPT-3 algorithm (or its successor), do you think that it could build the ontology based on this corpus? More generally, will our vision of ontologies not be modified by the arrival and the rise of this kind of tool?
> Best regards,
>          Xavier

Received on Tuesday, 24 January 2023 10:37:12 UTC