Last modified: 2012-11-01 18:12:24 UTC
I define the property "Property:Married To" like this: [[has type::Record]] [[has fields::Has Husband;Has Child;Has Child]] As far as I know it is allowed to have the same property (e.g. Has Child) several times in a record, however, the order of annotations is not guaranteed. Now an annotation in article "Mary": [[Married To::Paul; Peter; John]] This is rendered as: Paul (Peter, Peter) However, the expected value is: Paul (Peter, John) The fact box shows the property "Married to" but no values at all. Furthermore, there seems to be a bug in the API of SMW. I try to retrieve all properties of a record like this: $relationTitle = Title::newFromText($relationName, SMW_NS_PROPERTY); $relationDI = SMWDIWikiPage::newFromTitle($relationTitle); $fieldsProp = SMWDIProperty::newFromUserLabel("_LIST"); $fields = smwfGetStore()->getPropertyValues($relationDI, $fieldsProp); $fields should now be an array with all properties of the record. This works well if there are no duplicate properties in the record. In the above example it returns only "Has Husband" and "Has Child". The second occurrence of "Has Child" is missing. Best, Thomas
Please forget my comment about the API. $fields is a string that contains all properties i.e. "Has_Husband;Has_Child;Has_Child". So this is correct. However, the first bug that I described is still valid. Best, Thomas
What version of SMW? 1.6.1? trunk? Markus, seems like a bug for you :)
Yes, the duplicate values are clearly a problem that needs to be addressed. A possible temporal workaround for now is to use subobjects or to have two child properties. (The issue that "The fact box shows the property "Married to" but no values at all." has already been fixed as Bug 31605)
I think it is fair to say that duplicate properties are not supported by Records, and that this is not expected to change any time soon. #subobjects should provide a better alternative in this case. *** This bug has been marked as a duplicate of bug 30482 ***