I’v tried this query, it compiled and run. but it retrieve just the column names without their values. how can I retrieve their values ? is there any special method for that ?
String str = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"+
"PREFIX dbo: <http://dbpedia.org/ontology/>"+
"PREFIX dbpprop: <http://dbpedia.org/property/>"+
"PREFIX foaf: <http://xmlns.com/foaf/0.1/>"+
"SELECT DISTINCT ?label ?abstract ?placeOfBirth"+
"?birthPlace ?birthDate ?deathDate ?page ?thumbnail WHERE {"+
"OPTIONAL {<http://dbpedia.org/resource/Neil_Simon> dbpprop:placeOfBirth ?placeOfBirth ; dbo:abstract ?abstract ; foaf:page ?page .}"+
"OPTIONAL {<http://dbpedia.org/resource/Neil_Simon> dbpprop:placeOfBirth ?placeOfBirth ; dbpprop:birthPlace ?birthPlace ;}"+
"OPTIONAL {<http://dbpedia.org/resource/Neil_Simon> dbpprop:placeOfBirth ?placeOfBirth ; dbo:birthDate ?birthDate ;}"+
"OPTIONAL {<http://dbpedia.org/resource/Neil_Simon> dbpprop:placeOfBirth ?placeOfBirth ; dbo:deathdate ?deathDate ;}"+
"OPTIONAL {<http://dbpedia.org/resource/Neil_Simon> dbpprop:placeOfBirth ?placeOfBirth ; dbo:thumbnail ?thumbnail .}"+
"FILTER (LANG(?label) = 'en')"+
"FILTER (LANG(?abstract) = 'en')}"+
"LIMIT 1";
If you get column names and no values then it likely means that there are no answers to your query.
Try removing parts of your query until you get an answer – the main parts to start with would be the
FILTERclauses. You are filtering on variables that don’t actually get bound in your query anywhere so they will always evaluate to false and result in no results