Hi,
I just noticed that OpenAI has fixed the Wikidata property and item mappings so now it can generate working SPARQL. Example:
Prompt : Search finnish female journaists using SPARQL from Wikidata?
GPT-3.5 (default)
To search for Finnish female journalists using SPARQL from Wikidata, you can use the following query:
SELECT ?journalistLabel
WHERE
{
?journalist wdt:P106 wd:Q1930187 .
?journalist wdt:P27 wd:Q33 .
?journalist wdt:P21 wd:Q6581072 .
?journalist wdt:P569 ?birthdate .
?journalist wdt:P21 ?gender .
FILTER(YEAR(?birthdate) < 2005) .
FILTER(?gender = wd:Q6581072) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
}
This query will retrieve the labels (names) of all female journalists who were born before the year 2005, are Finnish citizens, and have a profession (P106) of journalist (Q1930187). You can execute this query on the Wikidata Query Service (https://query.wikidata.org/) by pasting the query into the query editor and clicking the "Run" button. The results will be displayed in a table format.
GPT-4
To search for Finnish female journalists using SPARQL on Wikidata, you can use the following query:
SELECT ?journalist ?journalistLabel WHERE {
?journalist wdt:P31 wd:Q5; # instance of human
wdt:P106 wd:Q1930187; # occupation: journalist
wdt:P21 wd:Q6581072; # gender: female
wdt:P27 wd:Q33. # country of citizenship: Finland
SERVICE wikibase:label { bd:serviceParam wikibase:language "fi,en". }
}
This query searches for entities that are instances of human (Q5), have an occupation as a journalist (Q1930187), are female (Q6581072), and have Finnish citizenship (Q33). The query results will include the journalist's Wikidata ID and their label (name) in Finnish or English. You can run this query using the Wikidata Query Service (https://query.wikidata.org/).
Br,
-- Kimmo Virtanen, Zache