among others, two options:
1) simply use the last part of the URI in your Java code
2) ask for the rdfs:label for each ?s in the query
Lorenz
On 26.02.2016 16:37, kumar rohit wrote:
I want to ask a question from dbpedia using Jena code. There is a GUI
button in eclipse "Solve question" when clicked JEna code is executed and
SPARQL query runs against dbpedia.
The question is what is capital city of Germany and have four options. My
query is like this:
select distinct ?rightAnswer ?wrongAnswer where {
dbr:Germany dbo:capital ?rightAnswer . ?s dbo:capital ?wrongAnswer .
filter ( ?s != dbr:Germany && ?wrongAnswer != ?rightAnswer )} limit 4
It gives me answer like shown in table below: I want answer in format
like this so that user can select one name:
.Berlin
.Padeborn
.Budapest
.Stanley
How can I achieve this?
rightAnswerwrongAnswer
http://dbpedia.org/resource/Berlin http://dbpedia.org/resource/Apia
http://dbpedia.org/resource/Berlin http://dbpedia.org/resource/Paderborn
http://dbpedia.org/resource/Berlin
http://dbpedia.org/resource/Stanley,_Falkland_Islands
http://dbpedia.org/resource/Berlin http://dbpedia.org/resource/Budapest