Thomas Mueller wrote:
2) Should JCR support nullable properties?
I think a better question is, "does a system have a different notions
for a null value and the absence of a property?".
Some say yes, some no. Let's see what other systems do:
* XML: No (an empty string is not null)
And there's no "null" attribute value.
* Files: No (an empty file is not null)
And there's no "null" file.
* HTTP: No
* Properties files: No
* Windows registry (if I may): No
* LDAP: No? (not sure)
LDAP goes further, usually (but it depends on the attribute "syntax", ie
its content model) empty strings are disallowed. And in any case there's
no notion of null storage.
* SQL: Yes (there is no other way to say 'the property is not set')
But in SQL you have a given schema for your table, and if in that schema
you have a 'name; column then in a row its value is either a string, or
NULL. You can't say "I don't want a 'name' column on that row". So for
SQL in a given schema there's no difference between the absence of a
property and a NULL.
* Java Hash tables: Hashtable no, HashMap yes
In a HashMap there's no distinction between a null value a no value:
HashMap.get(Object key)
Returns the value to which the specified key is mapped in this
identity hash map, or null if the map contains no mapping for this key.
So in *ALL* systems above, there is no distinction (apart from
introspecting schemas -- but that's a different problem) between null
values and absent properties. They're two facets of the same thing.
And as Roy explained, that's the whole point of "null". If someone wants
additional semantics, then they have to use a different storage model.
Florent
--
Florent Guillaume, Director of R&D, Nuxeo
Open Source Enterprise Content Management (ECM)
http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87