Discussion:
listResources
kumar rohit
2016-11-10 15:32:08 UTC
Permalink
What is mean my model.listResourcesWithProperty()?
What it accepts as parameters and what it returns as output?
Chris Dollin
2016-11-10 15:35:38 UTC
Permalink
Post by kumar rohit
What is mean my model.listResourcesWithProperty()?
What it accepts as parameters and what it returns as output?
Read the javadoc.
Or look at the source.

Chris
--
"We are on the brink of a new era, if only --" /The Beiderbeck Affair/

Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)
A. Soroka
2016-11-10 15:35:00 UTC
Permalink
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
Post by kumar rohit
What is mean my model.listResourcesWithProperty()?
What it accepts as parameters and what it returns as output?
kumar rohit
2016-11-10 15:58:58 UTC
Permalink
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.
Post by A. Soroka
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
Post by kumar rohit
What is mean my model.listResourcesWithProperty()?
What it accepts as parameters and what it returns as output?
Lorenz B.
2016-11-11 09:34:41 UTC
Permalink
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
Post by kumar rohit
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.
Post by A. Soroka
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
Post by kumar rohit
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
kumar rohit
2016-11-11 19:56:21 UTC
Permalink
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. <
Post by Lorenz B.
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.
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
Post by kumar rohit
Thank you Chris and Soroka.
I have read this and could not understand it properly, that is why I
asked
Post by kumar rohit
the question here. I will be happy if some one give an example with
model.listResourcesWithProperty()
used in it.
Post by A. Soroka
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
Post by kumar rohit
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
Claude Warren
2016-11-12 14:15:42 UTC
Permalink
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
Post by kumar rohit
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. <
Post by Lorenz B.
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.
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
Post by kumar rohit
Thank you Chris and Soroka.
I have read this and could not understand it properly, that is why I
asked
Post by kumar rohit
the question here. I will be happy if some one give an example with
model.listResourcesWithProperty()
used in it.
Post by A. Soroka
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
Post by kumar rohit
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
kumar rohit
2016-11-12 15:14:45 UTC
Permalink
So it means if we have to get instances of Student, both methods can be
used.?
Post by Claude Warren
Your statement
model.listResourcesWithProperty(RDF.type, std)
will list all the studen resources in the graph
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".
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
Post by kumar rohit
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. <
Post by Lorenz B.
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.
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
Post by kumar rohit
Thank you Chris and Soroka.
I have read this and could not understand it properly, that is why I
asked
Post by kumar rohit
the question here. I will be happy if some one give an example with
model.listResourcesWithProperty()
used in it.
Post by A. Soroka
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
Post by kumar rohit
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
Claude Warren
2016-11-12 15:20:00 UTC
Permalink
in short, yes.
Post by kumar rohit
So it means if we have to get instances of Student, both methods can be
used.?
Post by Claude Warren
Your statement
model.listResourcesWithProperty(RDF.type, std)
will list all the studen resources in the graph
model.listStatements(null,RDF.type, "Student");
will probably list nothing given what I think you have in the graph as
you
Post by Claude Warren
probably don't have any statements where the type is the literal
"Student".
Post by Claude Warren
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
Post by Claude Warren
students.
Claude
Post by kumar rohit
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. <
Post by Lorenz B.
I assume that you know what resources and properties in RDF graphs
are.
Post by Claude Warren
Post by kumar rohit
Post by Lorenz B.
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.
Post by Claude Warren
Post by kumar rohit
Post by Lorenz B.
listResourcesWithProperty(Property p) returns all resources s_i
listResourcesWithProperty(Property p, RDFNode o) returns all
subjects
Post by Claude Warren
Post by kumar rohit
Post by Lorenz B.
s_i that occur in triples in which o_j matches o
Lorenz
Post by kumar rohit
Thank you Chris and Soroka.
I have read this and could not understand it properly, that is why
I
Post by Claude Warren
Post by kumar rohit
Post by Lorenz B.
asked
Post by kumar rohit
the question here. I will be happy if some one give an example with
model.listResourcesWithProperty()
used in it.
Post by A. Soroka
https://jena.apache.org/documentation/javadoc/jena/
org/apache/jena/rdf/model/Model.html#
listResourcesWithProperty-org.
Post by Claude Warren
Post by kumar rohit
Post by Lorenz B.
Post by kumar rohit
Post by A. Soroka
apache.jena.rdf.model.Property-
Please learn to read Javadocs for software you are using.
---
A. Soroka
The University of Virginia Library
Post by kumar rohit
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
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren
Lorenz B.
2016-11-12 14:52:23 UTC
Permalink
Kumar,
Post by kumar rohit
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");
Again, classes in RDF are identified by URIs, "Student" is not a URI!


And sure, there are several methods to achieve the same thing, which is
usually called convenience methods for things that are supposed to be
asked for quite often in an API.
Post by kumar rohit
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. <
Post by Lorenz B.
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.
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
Post by kumar rohit
Thank you Chris and Soroka.
I have read this and could not understand it properly, that is why I
asked
Post by kumar rohit
the question here. I will be happy if some one give an example with
model.listResourcesWithProperty()
used in it.
Post by A. Soroka
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
Post by kumar rohit
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
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center
Chris Dollin
2016-11-11 11:05:50 UTC
Permalink
Post by kumar rohit
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.
What didn't you understand?

It's hard to help if you can't be specific about the
problem you're having.

Chris
Loading...