On Wed, Oct 23, 2013 at 7:28 AM, Dibyanshu Jaiswal <djthequ...@gmail.com> wrote:
> I am facing problem in adding Individuals of a given class using jena.
>
> Say for example we have a give hierarchy of classes:
As an aside, this would have been easier to read as Turtle than as a
table whose formatting didn't really survive being transmitted in
email.

> Now I want to add an individual of Customer Is there any easy way to do
> that, instead of driiling down to the range classes and creating
> individuals of FirstName, LastName, BuildinInfo, StrretInfo, and then
> adding these individuals as values to Name and Address and hence add these
> Name and Address individuals to Customer??
To create an individual of class Customer takes only one triple:

yourNamespace:customer1234 rdf:type :Customer.

That's it. This may sound flippant, but in RDF you're not required to
add any information to create a valid resource, because of the open
world assumption. It's not like creating a row in a database, which
will fail your data integrity checks if some columns are missing.
Missing triples in RDF are perfectly OK. One upshot of which is that
no, there's no generic mechanism in Jena for creating individuals with
a certain collection of properties, because which properties those
would be is basically an application decision.

> This is just an example where the object property hierarchy goes only two
> level deep, but in my web application the hierarchies are much deeper and
> hence i am in a search of some generic method to deal with this problem.
> Can Jena API deal/help me with this??

You may find this helpful:
http://jena.apache.org/documentation/notes/rdf-frames.html

Ian

Reply via email to