If you have a fixed set of resources, again I'd suggest to use SPARQL. Indeed, DBpedia also allows to download parts of the dataset, but I don't see any need to download the comments for all resources of DBpedia.
In your case, use a SPARQL CONSTRUCT query which in fact returns plain RDF. Use this query once, save the file to the corresponding place and load this file then via Jena. On 08.09.2016 12:18, Sidra shah wrote: > Hello Lorenz sir, do we have some alternative way to get this like > downloading rdfs:comment of all resources from DBpedia and process it > locally? > Actually my data i-e about hundred cities are in the Arraylist and can be > accessed using loop so its not a straight forward way to access it via > endpoint. > > Regards > > On Thu, Sep 8, 2016 at 2:57 AM, Lorenz Buehmann < > [email protected]> wrote: > >> But the data is contained in the SPARQL endpoint of DBpedia, isn't it? >> So how should it work without >> >> a) loading the necessary data in-memory - which in that case would also >> be your task to first get the data from the remote endpoint >> >> b) get the information from the remote endpoint via SPARQL >> >> >> On 07.09.2016 13:46, Sidra shah wrote: >>> Cant we access it through a Resource? If I include comment with every >>> instance of Question (Question is class name) like: What is capital of >>> Spain? here I include rdfs:comment of Madrid. >>> Which country has more population? here I include rdfs:comment of China. >>> >>> So later I set condition like if user did not answer the question >>> correctly, display rdfs:comment of that question. >>> if(Question.get(i).answer not correct) then Question.get(i).addcomment(); >>> >>> addcomment() is a method of type Literal in Jena. >>> >>> On Wed, Sep 7, 2016 at 2:59 AM, Lorenz Buehmann < >>> [email protected]> wrote: >>> >>>> How many students of you are doing the same homework assignment? >>>> >>>> >>>> Write a SPARQL query to get the rdfs:comment from the DBpedia endpoint. >>>> >>>> On 06.09.2016 14:17, Sidra shah wrote: >>>>> I have a question class in my ontolgy which have instance: What is >>>> capital >>>>> city of Spain? I have then Answer class having instance Madrid along >> with >>>>> two other options London, Berlin. This is my owl file. >>>>> >>>>> Now in Jena/Java code, I want if user selects wrong option (not >> Madrid), >>>> it >>>>> means user does not know about Madrid so I want to display him about >>>> Madrid >>>>> a short details in shape of rdfs:comment Madrid. >>>>> >>>>> On Tue, Sep 6, 2016 at 3:53 AM, Lorenz Buehmann < >>>>> [email protected]> wrote: >>>>> >>>>>> I don't understand what you are after. >>>>>> >>>>>> >>>>>> 1) This is not a Protege mailing list >>>>>> 2) http://dbpedia.org/Madrid is not a valid DBpedia URI >>>>>> 3) rdfs:comment could be retrieved by >>>>>> 3)a) SPARQL query >>>>>> 3)b) Load all triples about a particular resource, load those triples >>>>>> into Jena, use Jena RDF layer interface to get the information >>>>>> 4) I can't see the image, probably attachments are not allowed here >>>>>> >>>>>> Lorenz >>>>>> >>>>>> On 06.09.2016 12:43, Sidra shah wrote: >>>>>>> Hi >>>>>>> >>>>>>> How can we get the rdfs:comment of certain resource in dbpedia? I >> give >>>>>>> the address of resource in protege, but when I close it and open >>>>>>> again, the address changes again to my ontology address and under >>>>>>> comment Annotation only the address appears like >>>>>>> http://dbpedia.org/Madrid instead of the comments about Madrid >> city.?. >>>>>>> And how can we use this rdfs:comment in the jena code? Is it possible >>>>>>> to import the rdfs:comment details in our ontology and then access it >>>>>>> using Jena code? >>>>>>> >>>>>>> Inline image 1 >>
