Last modified: 2007-02-13 07:12:00 UTC
SMWDatValue->newAttributeValue() sets up desiredUnits and serviceLinks (and new possibleValues if we implement enumeration). These may involve DB queries. It seems it would be better to set these to null or false and only give them values if and when their getDesiredUnits/ServiceLinks() methods are called.
I have a local patch that fixes this. Without it, I verified that a simple inline query like [[Climate:=+]] makes five GetSpecialPropertyValues queries for the attribute Climate's special properties (HAS_TYPE, MAIN_DISPLAY_UNIT, DISPLAY_UNIT, POSSIBLE_VALUES, and SERVICE_LINK). With my patch, these queries go away. However, it's a potentially destabilizing change so I'm going to run with it a while before committing it, or I can share it with interested developers. Note that each result in the inline query still makes a GetSpecialPropertyValues query for SERVICE_LINK, because newAttributeValue() winds up calling the datatype's processValue() which adds service links whether or not they're not needed. processValue() needs to be refactored.
Created attachment 3163 [details] patch to SMW_DataValue.php Patch works for me, not sure about service links.
I checked in fixed SMW_DataValue.php to SVN. I filed bug 8961 about refactoring processValue() to do less work.