Did not seen there was two threads, reproducing
my comments here:
On Mon, Jan 18, 2010 at 15:54, Anca Luca<ancapaula.luca(a)xwiki.com> wrote:
Hi devs,
to resume, and try to converge to an implementable version, I propose:
1/ adding only OBJECT and PROPERTY EntityTypes for the moment, referring to an
object instance and a property instance in a document (a property ref would have
an object as a parent which would have a document reference as a parent), and
limiting the implementation to references to properties of object instances
(leaving aside type definitions ftm).
here's my +1 for this.
+1
2/ using a serialization of the form
wiki:Space.Page^className[objectnumber]#property and
+1 for className[objectnumber] syntax
+0.5 for theses separator, at least i don't see any specific issue
that theses separators could cause, i think i would have done
wiki:Space.Page#className[objectnumber]^property because ^ "sounds"
nicer to me (but i don't have more detailed argument ;))
a) using indexed ('multivalued') references, adding an additional
IndexedEntityReference class, to which API caller would have to cast.
ObjectReference would be such an IndexedEntityReference and provide object
related helper functions.
b) className[objectnumber] is used as an 'object name', it would be the name of
the object reference, and it would be the caller of the generic API that would
have to parse& serialize this kind of strings to actually extract classname and
object index. However, this would again be all hidden behind the ObjectReference
API.
I'm 0.5 and 0.5 between the two, any would suit my purpose.
An additional question is what would wiki:Space.Page^className (and
wiki:Space.Page^className#property) mean:
i) nothing, we consider it as invalid reference, we'll fix that later, we keep
it simple ftm
my +1 goes for this
I think that's the safest for now until we think more about the model
et what we want for use case like that. I doubt it's really needed
yet.
ii) all objects of class className in the document
That would be a major change in the apis if we make EntityReference
able to point to several entities. I think i would prefer
EntityReference mean only one reference but not 100% sure, in any case
this need more thinking so again +1 of i)
iii) first object of that class in the document
(as
XWikiDocument#getObject(className) does)
At least this follow the current general behavior in BaseObject/Object API so
a user would not be too lost.
iv) a shortcut for wiki:Space.Page^className[0]
(which, note, does not
necessarily mean the first object in that document, since indexing of objs in a
document is not recomputed when objects are deleted).
0 could point to nothing i think, "first object" make more sense if we
want it to point to one entity.
but anything could potentially point to nothing, the class could not exist, or
the object or the property name (or a document could not exist), it's more about
the semantic that we associate with such a reference. The 0 value came rather
from the potential generic approach that an indexed reference which would have
no specified index could be considered as having the index 0.