On Saturday, September 22, 2012 01:57:59 PM Paul Taylor wrote:
> Hello there again,
> 
> I have a Jena model that is stored in an SDBStore backed by MySQL.
> I would like to know whether a particular Resource exists in the Model. 
> I cannot use the model.getResource("uri") because according to javadoc 
> this will always return a Resource since it will create a new one if it does 
> not exist.

The only way a Resource "exists" in a model is to appear as the
subject, predicate, or object of some statement. getResource() will
create a new Jena resource object, but it doesn't tinker with the
statements in the model. Having got a Resource, call it R, you
can then see if it has any properties or whether it appears as the
object of any statement.

[Also model.containsResource(RDFNode n) should work, assuming that
SDB doesn't pessimise it.]

Chris

-- 
"It does not need to take events in their correct order."             /Hexwood/

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)

Reply via email to