Your statement

model.listResourcesWithProperty(RDF.type, std)

will list all the studen resources in the graph

the statement:

model.listStatements(null,RDF.type, "Student");

will probably list nothing given what I think you have in the graph as you
probably don't have any statements where the type is the literal "Student".

however:

model.listStatements(null,RDF.type, std);

would list all the statements (triples) that identify users.

In either case your example does not do anything with the result of the
listStatements() method call, and does not need it to print out the list of
students.

Claude


On Fri, Nov 11, 2016 at 7:56 PM, kumar rohit <kumar.en...@gmail.com> wrote:

> Thank you Lorenz.
>
> I have  *OntClass std = model.getOntClass(ns + "Student");*
>
>   for (Iterator i = model.listResourcesWithProperty(RDF.type, std);
>  i.hasNext();) {
>            model.listStatements(null,RDF.type, "Student");
>            System.out.println("Student: " + i.next());
>         }
>
> I read this on the web, here why we use:   *model.listStatements(null,
> RDF.type,
> "Student");*
>
> *Because we can get Subjects of the triple already from this
> statement: *model.listResourcesWithProperty(RDF.type,
> std);
>
>
> On Fri, Nov 11, 2016 at 11:34 AM, Lorenz B. <
> buehm...@informatik.uni-leipzig.de> wrote:
>
> > I assume that you know what resources and properties in RDF graphs are.
> >
> > Given the property p, indeed one can check for all triples (s_i, p,
> > o_j), i.e. all triples that have the property p in predicate position.
> > The methods:
> >
> > listResourcesWithProperty(Property p) returns all resources s_i
> >
> > listResourcesWithProperty(Property p, RDFNode o) returns all subjects
> > s_i that occur in triples in which o_j matches o
> >
> >
> > Lorenz
> >
> > > Thank you Chris and Soroka.
> > >
> > > I have read this and could not understand it properly, that is why I
> > asked
> > > the question here. I will be happy if some one give an example with
> > > model.listResourcesWithProperty()
> > > used in it.
> > >
> > >
> > >
> > > On Thu, Nov 10, 2016 at 5:35 PM, A. Soroka <aj...@virginia.edu> wrote:
> > >
> > >> https://jena.apache.org/documentation/javadoc/jena/
> > >> org/apache/jena/rdf/model/Model.html#listResourcesWithProperty-org.
> > >> apache.jena.rdf.model.Property-
> > >>
> > >> Please learn to read Javadocs for software you are using.
> > >>
> > >> ---
> > >> A. Soroka
> > >> The University of Virginia Library
> > >>
> > >>> On Nov 10, 2016, at 10:32 AM, kumar rohit <kumar.en...@gmail.com>
> > wrote:
> > >>>
> > >>> What is mean my model.listResourcesWithProperty()?
> > >>> What it accepts as parameters and what it returns as output?
> > >>
> > --
> > Lorenz Bühmann
> > AKSW group, University of Leipzig
> > Group: http://aksw.org - semantic web research center
> >
> >
>



-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Reply via email to