[Blueprints] Reserved identifies.

38 views
Skip to first unread message

Marko Rodriguez

unread,
Mar 15, 2011, 1:27:49 PM3/15/11
to gremlin-users
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()).

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.

http://markorodriguez.com

stephen mallette

unread,
Mar 15, 2011, 1:44:09 PM3/15/11
to gremli...@googlegroups.com
I agree...I think it all plays well with Rexster. Item 2 might even open up some options in The Dog House which likes to have expected meta data.

Marko Rodriguez

unread,
Mar 15, 2011, 2:24:24 PM3/15/11
to gremlin-users
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

Stefan Ollinger

unread,
Mar 15, 2011, 2:53:01 PM3/15/11
to gremli...@googlegroups.com
Hi,

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

Stefan Ollinger

unread,
Mar 15, 2011, 2:55:07 PM3/15/11
to gremli...@googlegroups.com
Maybe add a prefix for a) user property and b) system property.

Regards,
Stefan

Am 15.03.2011 um 19:24 schrieb Marko Rodriguez:

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()).
Reply all
Reply to author
Forward
0 new messages