Page MenuHomePhabricator

Properties with the same name as datatypes are taken to be Special Properties
Closed, InvalidPublic

Description

When a property has the same name as a datatype (e.g. 'code' or 'phone number') then the display etc. of that property conforms to that datatype, regardless of what type is defined on the property page.

For example, a property value defined with:

The code is [[Code::123ABC]].

and the associated property page of:

This is a [[has type::string]] property.

still displays with a preformatted box around the '123ABC'. An example of this in action can be found at http://sandbox.semantic-mediawiki.org/wiki/Code_property_test (unless that's been refreshed since now).


Version: unspecified
Severity: normal

Details

Reference
bz38465

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:47 AM
bzimport set Reference to bz38465.
bzimport added a subscriber: Unknown Object (MLST).

This happens because of the Language Aliases in SMW_Langauage.php

I think the assignment is used to store the the name of the property
'Code' => '_cod',

Is it correct behaviour then? Should properties never be named the same as datatypes? I mean, that seems sort of sensible, to avoid confusion...

Yes, this is correct behaviour. It has been introduced when changing the way in which record properties are declared. The old style only required types, while the new style requires properties. To provide some compatibility, properties that are named like the types have been introduced as a default (so the old record type declarations will still work without changing wikipages).

This does not mean that you should not name properties like that (though it might indeed be confusing); it just means that you cannot change the datatype of these properties to be different from their name (which would really be confusing). If you use these properties regularly, it would be useful to (redundantly) declare their type on their wiki page anyway, to clarify the situation for other editors and to ensure that the type stays the same in all future (the default properties can change their name if, e.g., the content language is changed).

Thanks for clear this up! Makes sense.

Is this in the wiki somewhere?

(I couldn't find it; so I asked: http://semantic-mediawiki.org/wiki/Help_talk:Properties_and_types#Properties_with_the_same_names_as_datatypes )