I plan to do two things that are related. I would like any objections:
1. I plan to make the properties "id" reserved for all Elements.
Moreover, for Edges, I plan to make "label" reserved.
To this effect, I plan to assert that element.getProperty("id").equals
(element.getId()) AND edge.getProperty("label").equals(edge.getLabel()).
2. Next -- talking with Luca and some folks on the OrientDB mailing
list, I plan to make all underscore (_) prefixed properties reserved.
That is, element.setProperty("_XYZ" , "blah") will throw a new
Exception("can not write to the reserved property namespace.").
--------
Josh: What do you think of _ as the reserved "namespace"?
Stephen: _ plays well with Rexster and its use of _ as a way of
communicating metadata about an element.
** I will do 1 now as its been in plan for some time now, and wait for
comments with respect to 2.
Thoughts?,
Marko.
I did this:
element.setProperty("id", 123) throws RuntimeException
edge.setProperty("label", "blah") throws RuntimeException
element.getProperty("id") returns null (it was never set)
element.removeProperty("id") returns null (it was never set)
I didn't make "id" a property because then getPropertyKeys() should
return "id" (respectively, for "label" and edges). Thus, only when
trying to set them do you get an exception with a message that says:
"id is a reserved property key"
It says "reserved property key", not "reserved property."
Sorta sketchy semantics------ :( ... Thoughts?
Marko.
you could move the node's properties inside a wrapper property. With
that there wont exist any "magic" names.
As a negative sideeffect that will increase the lookup times.
Regards,
Stefan
Hi,
I did this:
element.setProperty("id", 123) throws RuntimeException
edge.setProperty("label", "blah") throws RuntimeException
element.getProperty("id") returns null (it was never set)
element.removeProperty("id") returns null (it was never set)
I didn't make "id" a property because then getPropertyKeys() should return "id" (respectively, for "label" and edges). Thus, only when trying to set them do you get an exception with a message that says:
"id is a reserved property key"
It says "reserved property key", not "reserved property."
Sorta sketchy semantics------ :( ... Thoughts?
Marko.
http://markorodriguez.com
On Mar 15, 2011, at 11:27 AM, Marko Rodriguez wrote:Hello,I plan to do two things that are related. I would like any objections:1. I plan to make the properties "id" reserved for all Elements. Moreover, for Edges, I plan to make "label" reserved.
To this effect, I plan to assert that element.getProperty("id").equals(element.getId()) AND edge.getProperty("label").equals(edge.getLabel()).