How can I list all Object Properties associated to a instance in Jena?
For example:
A Person has an Object Property called “hasVehicle” which is associated with a class Vehicle
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The appropriate Jena method is
OntClass.listDeclaredProperties. There are some nuances to be aware of; the Jena RDF frames how-to explains in detail.Update
OK, I’ve looked at your code sample, and read your description, and I’m afraid I don’t understand what you want to do. What I’ve done is re-write your code sample so that it does something that I guess you might want, based on your description in the comment:
This gives the following output, by first listing all resources of
rdf:type#Equipe, then for each of those it lists the resources in the model that link to that Equipe, then for of those linked resources it lists all of the RDF the properties. I don’t think that’s a particularly useful thing to do, but hopefully it will show you some patterns for traversing RDF graphs in Jena.Some general suggestions, particularly if you have any follow-up questions: