ghillairet / emftriple

EMF Binding for RDF
25 stars 8 forks source link

BNode handling #6

Closed antiguru closed 13 years ago

antiguru commented 13 years ago

Hi, I implemented an idea how bnodes could be handled. I'm not too certain if this is the right way to go, so I would like to ask you to comment on it!

The idea is as discussed in #5. Additionally, objects referenced via a bnode are loaded not via proxies, but as a whole. This avoids the need to create a proxy URI. This proxy URI would be rather complex, as it would be the parent's URI plus the predicate.

What I didn't look at yet is how the objects could be saved. This seems to be a challenge...

Moritz

ghillairet commented 13 years ago

Thanks Moritz, I will look at it.

To save objects as blank nodes, I think we will have to use annotations on the model. For example, in emfatic syntax, it will be something like that:

class Person {
  ref Book[*] books;
}
@BlankNode
class Book { ... }

or on the reference:

class Person {
  @BlankNode
  ref Book[*] books;
}

Then it is easy to know when to create or load a blank node.

ghillairet commented 13 years ago

I push your modifications, but bnodes support should be supported in a more sound way. I think blank nodes should be accessible only if an annotation like @BlankNode is set on the model. Also, in your proposal, you assume that blank nodes are always hold by a containment. This can be a limitation that simplifies a lot of things. And at the end, support for blank nodes will only be partial, considering issues there is with those.

antiguru commented 13 years ago

Hi there, I realized that supporting BNodes creates a whole bunch of problems. What do you think, is it OK to support BNodes for reading but not for writing? Writing BNodes is quite hard, as it cannot be figured out in a reliable way where the data came from.

I was able to convince the data designer to use named nodes instead of BNodes - a different way to solve the problem ;-)

Regarding the containment assumption, I added it as a blank node always is a unique object which cannot be contained anywhere else. As it is found in the model, it really needs to be a containment reference, otherwise it would not be possible to serialize the object again - assuming that this could be done in theory...

BNodes seem to be much more problematic than I thought they would be.