@@ -16,7 +16,7 @@ class BaseProperty(base.BaseObject):
1616 def __init__ (self , name = None , value = None , parent = None , unit = None ,
1717 uncertainty = None , reference = None , definition = None ,
1818 dependency = None , dependency_value = None , dtype = None ,
19- value_origin = None , id = None ):
19+ value_origin = None , oid = None ):
2020 """
2121 Create a new Property. If a value without an explicitly stated dtype
2222 has been provided, the method will try to infer the value's dtype.
@@ -45,13 +45,13 @@ def __init__(self, name=None, value=None, parent=None, unit=None,
4545 if dtype is not given, the type is deduced from the values.
4646 Check odml.DType for supported data types.
4747 :param value_origin: Reference where the value originated from e.g. a file name.
48- :param id: UUID string as specified in RFC 4122. If no id is provided,
48+ :param oid: object id, UUID string as specified in RFC 4122. If no id is provided,
4949 an id will be generated and assigned. An id has to be unique
5050 within an odML Document.
5151 """
5252 try :
53- if id is not None :
54- self ._id = str (uuid .UUID (id ))
53+ if oid is not None :
54+ self ._id = str (uuid .UUID (oid ))
5555 else :
5656 self ._id = str (uuid .uuid4 ())
5757 except ValueError as e :
@@ -101,19 +101,30 @@ def __setitem__(self, key, item):
101101 raise ValueError ("odml.Property.__setitem__: passed value cannot be "
102102 "converted to data type \' %s\' !" % self ._dtype )
103103
104+ @property
105+ def oid (self ):
106+ """
107+ The uuid for the property. Required for entity creation and comparison,
108+ saving and loading.
109+ """
110+ return self .id
111+
104112 @property
105113 def id (self ):
114+ """
115+ The uuid for the property.
116+ """
106117 return self ._id
107118
108- def new_id (self , id = None ):
119+ def new_id (self , oid = None ):
109120 """
110- new_id sets the id of the current object to an RFC 4122 compliant UUID.
121+ new_id sets the object id of the current object to an RFC 4122 compliant UUID.
111122 If an id was provided, it is assigned if it is RFC 4122 UUID format compliant.
112123 If no id was provided, a new UUID is generated and assigned.
113- :param id : UUID string as specified in RFC 4122.
124+ :param oid : UUID string as specified in RFC 4122.
114125 """
115- if id is not None :
116- self ._id = str (uuid .UUID (id ))
126+ if oid is not None :
127+ self ._id = str (uuid .UUID (oid ))
117128 else :
118129 self ._id = str (uuid .uuid4 ())
119130
0 commit comments