On 06/09/16 14:45, neha gupta wrote:
So it means there is no method which check if an individual exists or not?
No, it does not mean that.
An Individual with URI u "exists" if a Resource with that URI has
a property rdf:type of some (Ont)Class. So if you really wanted
to know, you can use createResource to get a suitable Resource and
look for a type property.
With this statement, suppose a student Neha is created with her
information in the file. Next time, she login, again a new instance will be
created when the application executes *Student.createIndividual(ns,
stdName);?*
That depends what you mean by a "new instance". If you cann
createIndividual(URI) twice, there will still only be one individual
in the OntModel even if you have two different Java objects representing
it. So I don't think you need to worry about whether the individual
"already exists" or not.
Also: (A) createIndividual's has one [1] argument which is the URI for
this individual, doesn't it? Not two as you've shown? Unless Student
isn't an OntClass. Is it?
(B) You might want to consider using a database/triple store like
TDB rather than repeatedly loading and saving a file.
Chris
[1] Or none, in which case it's going to make a blank node and there
/will/ be multiple "different" individuals.
--
"He could not weigh up which was worse and so tried not to think about either."
/The Spellgrinder's Apprentice/
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)