RE: Java API

Hi Jan,

> The ability to store class definitions (for example) in an 
> RDF model is
> appealing.

Could you say a little more about what you have in mind here?

I did consider having a mapping from RDF types to Java classes
that implement those types so that whenever a resource 'got'
an object of the correct Java class would be instantiated.

I haven't done that because I don't think the RDF and Java
type models are sufficiently similar, e.g. if a resource has
two types, which one do I instantiate.

Right now I'm letting the programmer decide by passing in a
factory class.

Were you thinking of something similar, or do you have another
idea.

> The only thing I'm really unclear on thus far is this:
> 
>      Resource ora = model.createResource()
>                          .addProperty(Dc.name, "Ora Lassila");
>      model2.add(ora, Dc.creator, model2.createLiteral("Mr. 
> Lassila, Snr.");
>      model2.add(ora, Dc.creator, model2.createLiteral("Mrs. Lassila");
> 
>      ora.addProperty(anotherProptery, anotherValue);
> 
> Which model is changed by the last call? Does ora have a default
> model? Or does it carry an identity with respect to each 
> model it comes
> into contact with?

What you get back from model.createResource and model.getResource is
actually an instance of ResourceInstance which contains a pointer to
the model that was used to create it.  If you do any model manipulation
through calls to that resource, then it is the model which was used
to create it which is modified.

So the last call in your example will modify model, not model2.

I agree this is not very clear; I wonder if there is a way to make it
clearer, other than just documenting the behaviour.

Thanks for the feedback.

Brian

Received on Monday, 7 August 2000 13:24:54 UTC