@@ -16,7 +16,7 @@ class BaseProperty(base.BaseObject):
16
16
def __init__ (self , name = None , value = None , parent = None , unit = None ,
17
17
uncertainty = None , reference = None , definition = None ,
18
18
dependency = None , dependency_value = None , dtype = None ,
19
- value_origin = None , id = None ):
19
+ value_origin = None , oid = None ):
20
20
"""
21
21
Create a new Property. If a value without an explicitly stated dtype
22
22
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,
45
45
if dtype is not given, the type is deduced from the values.
46
46
Check odml.DType for supported data types.
47
47
: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,
49
49
an id will be generated and assigned. An id has to be unique
50
50
within an odML Document.
51
51
"""
52
52
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 ))
55
55
else :
56
56
self ._id = str (uuid .uuid4 ())
57
57
except ValueError as e :
@@ -101,19 +101,30 @@ def __setitem__(self, key, item):
101
101
raise ValueError ("odml.Property.__setitem__: passed value cannot be "
102
102
"converted to data type \' %s\' !" % self ._dtype )
103
103
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
+
104
112
@property
105
113
def id (self ):
114
+ """
115
+ The uuid for the property.
116
+ """
106
117
return self ._id
107
118
108
- def new_id (self , id = None ):
119
+ def new_id (self , oid = None ):
109
120
"""
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.
111
122
If an id was provided, it is assigned if it is RFC 4122 UUID format compliant.
112
123
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.
114
125
"""
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 ))
117
128
else :
118
129
self ._id = str (uuid .uuid4 ())
119
130
0 commit comments