Please, please read the Javadocs.

StmtIterator listStatements(Resource s, Property p, RDFNode o)

returns a StmtIterator, an iterator of _Statements_.

ResIterator listResourcesWithProperty(Property p, RDFNode o)

returns a ResIterator, an iterator of _Resources_.

Neither of the examples you give are sensible code. The literal "Student" is 
not a reasonable value for an rdf:type. Please go and actually try to write 
some code for your problem and then continue this discussion.

---
A. Soroka
The University of Virginia Library

> On Dec 29, 2016, at 9:16 AM, neha gupta <neha.bang...@gmail.com> wrote:
> 
> What is the difference between then in
> "model.listresourceswithproperty(RDF:type,
> Student )"  and
> 
> model.listStatements(null,RDF.type, "Student"); //Student is class in our
> ontology
> 
> If we want to just retrieve the list of Students (rdf:type Student), which
> of the above statement is correct? Or we should write both these
> statements.
> 
> Regards
> 
> On Thu, Dec 29, 2016 at 5:00 PM, A. Soroka <aj...@virginia.edu> wrote:
> 
>> No. The "resources in this model that have property p": the resource that
>> has a property is the subject of that property.
>> 
>> ---
>> A. Soroka
>> The University of Virginia Library
>> 
>>> On Dec 29, 2016, at 8:57 AM, neha gupta <neha.bang...@gmail.com> wrote:
>>> 
>>> Hi Soroka, it will lists both the subjects and objects of the Property p,
>>> right?
>>> 
>>> 
>>> 
>>> On Thu, Dec 29, 2016 at 4:29 PM, A. Soroka <aj...@virginia.edu> wrote:
>>> 
>>>> Please consult the Javadocs.
>>>> 
>>>> https://jena.apache.org/documentation/javadoc/jena/
>>>> org/apache/jena/rdf/model/Model.html#listResourcesWithProperty-org.
>>>> apache.jena.rdf.model.Property-
>>>> 
>>>> "Answer an iterator [with no duplicates] over all the resources in this
>>>> model that have property p. remove() is not implemented on this
>> iterator."
>>>> 
>>>> ---
>>>> A. Soroka
>>>> The University of Virginia Library
>>>> 
>>>>> On Dec 29, 2016, at 8:23 AM, neha gupta <neha.bang...@gmail.com>
>> wrote:
>>>>> 
>>>>> Hello, I want to ask what is the function of this method:
>>>>> listresourceswithproperty()
>>>>> 
>>>>> And is it the same as when we query SPARQL like:
>>>>> 
>>>>> Select ?x
>>>>> where { ?x rdf:type ?someclass }
>>>>> 
>>>>> A simple example is highly appreciated as I did not find any solid
>>>> examples
>>>>> on web about it.
>>>>> 
>>>>> Thank you
>>>> 
>>>> 
>> 
>> 

Reply via email to