No answer in SparQL Endpoint

I’m currently trying to familiarize myself with the topic of SPARQL queries for an AI project. Unfortunately, all queries to Wikidata work without any problems. However, queries to dbpedia generally do not produce any results.
Have there been any syntax changes between the printing of my textbook and now?
Here is an example of a Java test program that doesn’t work. Also all the usual editors, such as

OpenLink Virtuoso SPARQL Query Editor does not provide any results.

import org.apache.jena.query.*;
import org.apache.jena.rdf.model.Literal;

public class DBpediaQuery {

    public static void main(String[] args) {
        // Die DBpedia-SPARQL-Endpunkt-URL
        String sparqlEndpoint = "http://dbpedia.org/sparql";

        // Die SPARQL-Abfrage, um das Geburtsdatum abzurufen
        String sparqlQuery = "PREFIX dbo: <http://dbpedia.org/ontology/> "
                + "SELECT ?birthdate "
                + "WHERE { "
                + "  <http://dbpedia.org/resource/Michel_Ney> dbo:birthDate ?birthdate . "
                + "}";

        Query query = QueryFactory.create(sparqlQuery);
        QueryExecution queryExecution = QueryExecutionFactory.sparqlService(sparqlEndpoint, query);

        try {
            ResultSet results = queryExecution.execSelect();
            while (results.hasNext()) {
                QuerySolution solution = results.nextSolution();
                Literal birthDateLiteral = solution.getLiteral("birthdate");

                if (birthDateLiteral != null) {
                    String birthDate = birthDateLiteral.getLexicalForm();
                    System.out.println("Geburtsdatum von Michel Ney: " + birthDate);
                } else {
                    System.out.println("Geburtsdatum nicht gefunden.");
                }
            }
        } finally {
            queryExecution.close();
        }
    }
}
1 Like

Hi @dimontalban,

Not all individuals in DBpedia have their birth dates structured under dbo:birthDate, including Michel Ney. His birth date, however, is mentioned within the abstract of his DBpedia page. To access this, one can use a SPARQL query to extract the dbo:abstract property:

SELECT ?abstract
WHERE {
http://dbpedia.org/resource/Michel_Ney dbo:abstract ?abstract .
FILTER(LANG(?abstract) = “en”)
}

This abstract can then be processed using feature extraction techniques to identify the birth date.