Index: trunk/extensions/Wikidata/OmegaWiki/SpecialDatasearch.php |
— | — | @@ -35,7 +35,9 @@ |
36 | 36 | |
37 | 37 | function SpecialDatasearch() { |
38 | 38 | SpecialPage::SpecialPage('Datasearch'); |
39 | | - |
| 39 | + } |
| 40 | + |
| 41 | + function execute($parameter) { |
40 | 42 | require_once("WikiDataGlobals.php"); |
41 | 43 | require_once("forms.php"); |
42 | 44 | require_once("type.php"); |
— | — | @@ -71,9 +73,7 @@ |
72 | 74 | $this->collectionAttribute, |
73 | 75 | $this->collectionMemberAttribute |
74 | 76 | ); |
75 | | - } |
76 | | - |
77 | | - function execute($parameter) { |
| 77 | + |
78 | 78 | global |
79 | 79 | $wgOut, $wgTitle; |
80 | 80 | |
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataGlobals.php |
— | — | @@ -123,16 +123,16 @@ |
124 | 124 | $wgRelationsAttributeId, |
125 | 125 | $wgSynonymsAndTranslationsAttributeId; |
126 | 126 | |
127 | | -$wgAlternativeDefinitionsAttributeId = "alternative-definitions"; |
128 | | -$wgClassAttributesAttributeId = "class-attributes"; |
129 | | -$wgClassMembershipAttributeId = "class-membership"; |
130 | | -$wgCollectionMembershipAttributeId = "collection-membership"; |
131 | | -$wgDefinedMeaningAttributesAttributeId = "defined-meaning-attributes"; |
| 127 | +$wgAlternativeDefinitionsAttributeId = "alternativeDefinitions"; |
| 128 | +$wgClassAttributesAttributeId = "classAttributes"; |
| 129 | +$wgClassMembershipAttributeId = "classMembership"; |
| 130 | +$wgCollectionMembershipAttributeId = "collectionMembership"; |
| 131 | +$wgDefinedMeaningAttributesAttributeId = "definedMeaningAttributes"; |
132 | 132 | $wgDefinitionAttributeId = "definition"; |
133 | | -$wgIncomingRelationsAttributeId = "reciprocal-relations"; |
134 | | -$wgPossiblySynonymousAttributeId = "possibly-synonymous"; |
| 133 | +$wgIncomingRelationsAttributeId = "reciprocalRelations"; |
| 134 | +$wgPossiblySynonymousAttributeId = "possiblySynonymous"; |
135 | 135 | $wgRelationsAttributeId = "relations"; |
136 | | -$wgSynonymsAndTranslationsAttributeId = "synonyms-translations"; |
| 136 | +$wgSynonymsAndTranslationsAttributeId = "synonymsTranslations"; |
137 | 137 | |
138 | 138 | // Defined meaning editor |
139 | 139 | |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiAttributes.php |
— | — | @@ -31,12 +31,10 @@ |
32 | 32 | * -this is what RecordHelpers are for. |
33 | 33 | */ |
34 | 34 | function initializeOmegaWikiAttributes(ViewInformation $viewInformation){ |
35 | | - $init_and_discard_this= OmegaWikiAttributes::getInstance($viewInformation); |
36 | | - |
37 | 35 | initializeOmegaWikiAttributesOld($viewInformation); //backward compatibility, will be removed! |
| 36 | + $init_and_discard_this = OmegaWikiAttributes::getInstance($viewInformation); |
38 | 37 | } |
39 | 38 | |
40 | | - |
41 | 39 | /** |
42 | 40 | * Original initializeOmegaWikiAttributes, Do not call. |
43 | 41 | * @deprecated use/update OmegaWikiAttributes->hardValues instead for now. |
— | — | @@ -55,14 +53,14 @@ |
56 | 54 | $wgDefinedMeaningAttributesAttributeName, |
57 | 55 | $wgDefinedMeaningAttributesAttributeName, $wgDefinedMeaningAttributesAttributeId, $wgAnnotationAttributeName; |
58 | 56 | |
59 | | - $definedMeaningAttributesAttribute = new Attribute("defined-meaning-attributes", $wgDefinedMeaningAttributesAttributeName, "will-be-specified-below"); |
60 | | - $objectAttributesAttribute = new Attribute("object-attributes", $wgAnnotationAttributeName, "will-be-specified-below"); |
| 57 | + $definedMeaningAttributesAttribute = new Attribute("definedMeaningAttributes", $wgDefinedMeaningAttributesAttributeName, "will-be-specified-below"); |
| 58 | + $objectAttributesAttribute = new Attribute("objectAttributes", $wgAnnotationAttributeName, "will-be-specified-below"); |
61 | 59 | |
62 | 60 | global |
63 | 61 | $expressionIdAttribute, $identicalMeaningAttribute, $wgIdenticalMeaningAttributeName; |
64 | 62 | |
65 | | - $expressionIdAttribute = new Attribute("expression-id", "Expression Id", "expression-id"); |
66 | | - $identicalMeaningAttribute = new Attribute("indentical-meaning", $wgIdenticalMeaningAttributeName, "boolean"); |
| 63 | + $expressionIdAttribute = new Attribute("expressionId", "Expression Id", "expression-id"); |
| 64 | + $identicalMeaningAttribute = new Attribute("indenticalMeaning", $wgIdenticalMeaningAttributeName, "boolean"); |
67 | 65 | |
68 | 66 | global |
69 | 67 | $expressionStructure, $expressionAttribute, $wgExpressionAttributeName; |
— | — | @@ -79,26 +77,24 @@ |
80 | 78 | $definedMeaningCompleteDefiningExpressionStructure, |
81 | 79 | $definedMeaningCompleteDefiningExpressionAttribute; |
82 | 80 | |
83 | | - $definedMeaningIdAttribute = new Attribute("defined-meaning-id", "Defined meaning identifier", "defined-meaning-id"); |
84 | | - $definedMeaningDefiningExpressionAttribute = new Attribute("defined-meaning-defining-expression", "Defined meaning defining expression", "short-text"); |
| 81 | + $definedMeaningIdAttribute = new Attribute("definedMeaningId", "Defined meaning identifier", "defined-meaning-id"); |
| 82 | + $definedMeaningDefiningExpressionAttribute = new Attribute("definedMeaningDefiningExpression", "Defined meaning defining expression", "short-text"); |
85 | 83 | |
86 | 84 | $definedMeaningCompleteDefiningExpressionStructure = |
87 | | - new Structure("defined-meaning-full-defining-expression", |
| 85 | + new Structure("definedMeaningFullDefiningExpression", |
88 | 86 | $definedMeaningDefiningExpressionAttribute, |
89 | 87 | $expressionIdAttribute, |
90 | 88 | $languageAttribute |
91 | | - ); |
| 89 | + ); |
92 | 90 | |
93 | 91 | # ====== refactored up to this point, do not make changes above this line ==== |
94 | | - $definedMeaningCompleteDefiningExpressionAttribute=new Attribute(null, "Defining expression", $definedMeaningCompleteDefiningExpressionStructure); |
| 92 | + $definedMeaningCompleteDefiningExpressionAttribute = new Attribute("definedMeaningCompleteDefiningExpression", "Defining expression", $definedMeaningCompleteDefiningExpressionStructure); |
95 | 93 | |
96 | | - |
97 | | - |
98 | 94 | global |
99 | 95 | $definedMeaningReferenceStructure, $definedMeaningLabelAttribute, $definedMeaningReferenceType, |
100 | 96 | $definedMeaningReferenceAttribute, $wgDefinedMeaningReferenceAttributeName; |
101 | 97 | |
102 | | - $definedMeaningLabelAttribute = new Attribute("defined-meaning-label", "Defined meaning label", "short-text"); |
| 98 | + $definedMeaningLabelAttribute = new Attribute("definedMeaningLabel", "Defined meaning label", "short-text"); |
103 | 99 | $definedMeaningReferenceStructure = new Structure("defined-meaning", $definedMeaningIdAttribute, $definedMeaningLabelAttribute, $definedMeaningDefiningExpressionAttribute); |
104 | 100 | |
105 | 101 | $definedMeaningReferenceType = $definedMeaningReferenceStructure; |
— | — | @@ -110,29 +106,29 @@ |
111 | 107 | $wgCollectionAttributeName, $wgSourceIdentifierAttributeName, $wgGotoSourceAttributeName; |
112 | 108 | |
113 | 109 | $collectionIdAttribute = new Attribute("collection", "Collection", "collection-id"); |
114 | | - $collectionMeaningAttribute = new Attribute("collection-meaning", $wgCollectionAttributeName, $definedMeaningReferenceStructure); |
115 | | - $sourceIdentifierAttribute = new Attribute("source-identifier", $wgSourceIdentifierAttributeName, "short-text"); |
| 110 | + $collectionMeaningAttribute = new Attribute("collectionMeaning", $wgCollectionAttributeName, $definedMeaningReferenceStructure); |
| 111 | + $sourceIdentifierAttribute = new Attribute("sourceIdentifier", $wgSourceIdentifierAttributeName, "short-text"); |
116 | 112 | $gotoSourceStructure = new Structure("goto-source",$collectionIdAttribute, $sourceIdentifierAttribute); |
117 | | - $gotoSourceAttribute = new Attribute(null, $wgGotoSourceAttributeName, $gotoSourceStructure); |
| 113 | + $gotoSourceAttribute = new Attribute("gotoSource", $wgGotoSourceAttributeName, $gotoSourceStructure); |
118 | 114 | |
119 | 115 | global |
120 | 116 | $collectionMembershipAttribute, $wgCollectionMembershipAttributeName, $wgCollectionMembershipAttributeId, |
121 | 117 | $collectionMembershipStructure; |
122 | 118 | |
123 | | - $collectionMembershipStructure = new Structure("collection-membership",$collectionIdAttribute, $collectionMeaningAttribute, $sourceIdentifierAttribute); |
124 | | - $collectionMembershipAttribute = new Attribute(null, $wgCollectionMembershipAttributeName, $collectionMembershipStructure); |
| 119 | + $collectionMembershipStructure = new Structure("collection-membership",$collectionIdAttribute, $collectionMeaningAttribute, $sourceIdentifierAttribute, $gotoSourceAttribute); |
| 120 | + $collectionMembershipAttribute = new Attribute("collectionMembership", $wgCollectionMembershipAttributeName, $collectionMembershipStructure); |
125 | 121 | |
126 | 122 | global |
127 | 123 | $classMembershipIdAttribute, $classAttribute; |
128 | 124 | |
129 | | - $classMembershipIdAttribute = new Attribute("class-membership-id", "Class membership id", "integer"); |
| 125 | + $classMembershipIdAttribute = new Attribute("classMembershipId", "Class membership id", "integer"); |
130 | 126 | $classAttribute = new Attribute("class", "Class", $definedMeaningReferenceStructure); |
131 | 127 | |
132 | 128 | global |
133 | 129 | $classMembershipStructure, $classMembershipKeyStructure, $classMembershipAttribute, |
134 | 130 | $wgClassMembershipAttributeName, $wgClassMembershipAttributeId; |
135 | 131 | |
136 | | - $classMembershipStructure = new Structure("class-membership", $classMembershipIdAttribute, $classAttribute); |
| 132 | + $classMembershipStructure = new Structure("classMembership", $classMembershipIdAttribute, $classAttribute); |
137 | 133 | $classMembershipAttribute = new Attribute(null, $wgClassMembershipAttributeName, $classMembershipStructure); |
138 | 134 | |
139 | 135 | global |
— | — | @@ -141,18 +137,18 @@ |
142 | 138 | $wgPossibleSynonymAttributeName, $possiblySynonymousStructure, $possiblySynonymousAttribute, |
143 | 139 | $wgPossiblySynonymousAttributeName, $wgPossiblySynonymousAttributeId; |
144 | 140 | |
145 | | - $possiblySynonymousIdAttribute = new Attribute("possibly-synonymous-id", "Possibly synonymous id", "integer"); |
146 | | - $possibleSynonymAttribute = new Attribute("possible-synonym", $wgPossibleSynonymAttributeName, $definedMeaningReferenceStructure); |
147 | | - $possiblySynonymousStructure = new Structure("possibly-synonymous", $possiblySynonymousIdAttribute, $possiblySynonymousAttribute); |
148 | | - $possiblySynonymousAttribute = new Attribute(null, $wgPossiblySynonymousAttributeName, $possiblySynonymousStructure); |
| 141 | + $possiblySynonymousIdAttribute = new Attribute("possiblySynonymousId", "Possibly synonymous id", "integer"); |
| 142 | + $possibleSynonymAttribute = new Attribute("possibleSynonym", $wgPossibleSynonymAttributeName, $definedMeaningReferenceStructure); |
| 143 | + $possiblySynonymousStructure = new Structure("possibly-synonymous", $possiblySynonymousIdAttribute, $possibleSynonymAttribute); |
| 144 | + $possiblySynonymousAttribute = new Attribute("possiblySynonymous", $wgPossiblySynonymousAttributeName, $possiblySynonymousStructure); |
149 | 145 | |
150 | 146 | global |
151 | 147 | $relationIdAttribute, $relationTypeAttribute, $relationTypeType, $otherDefinedMeaningAttribute, |
152 | 148 | $wgRelationTypeAttributeName, $wgOtherDefinedMeaningAttributeName; |
153 | 149 | |
154 | | - $relationIdAttribute = new Attribute("relation-id", "Relation identifier", "object-id"); |
155 | | - $relationTypeAttribute = new Attribute("relation-type", $wgRelationTypeAttributeName, $definedMeaningReferenceStructure); |
156 | | - $otherDefinedMeaningAttribute = new Attribute("other-defined-meaning", $wgOtherDefinedMeaningAttributeName, $definedMeaningReferenceType); |
| 150 | + $relationIdAttribute = new Attribute("relationId", "Relation identifier", "object-id"); |
| 151 | + $relationTypeAttribute = new Attribute("relationType", $wgRelationTypeAttributeName, $definedMeaningReferenceStructure); |
| 152 | + $otherDefinedMeaningAttribute = new Attribute("otherDefinedMeaning", $wgOtherDefinedMeaningAttributeName, $definedMeaningReferenceType); |
157 | 153 | |
158 | 154 | global |
159 | 155 | $relationsAttribute, $relationStructure, $reciprocalRelationsAttribute, $objectAttributesAttribute, $wgRelationsAttributeName, $wgIncomingRelationsAttributeName, $wgRelationsAttributeId, $wgIncomingRelationsAttributeId, |
— | — | @@ -160,34 +156,33 @@ |
161 | 157 | |
162 | 158 | $relationStructure = new Structure("relations", $relationIdAttribute, $relationTypeAttribute, $otherDefinedMeaningAttribute, $objectAttributesAttribute); |
163 | 159 | $relationsAttribute = new Attribute(null, $wgRelationsAttributeName, $relationStructure); |
164 | | - $reciprocalRelationsAttribute = new Attribute("reciprocal-relations", $wgIncomingRelationsAttributeName, $relationStructure); |
| 160 | + $reciprocalRelationsAttribute = new Attribute("reciprocalRelations", $wgIncomingRelationsAttributeName, $relationStructure); |
165 | 161 | |
166 | 162 | global |
167 | 163 | $translatedTextIdAttribute, $translatedTextStructure; |
168 | 164 | |
169 | | - $translatedTextIdAttribute = new Attribute("translated-text-id", "Translated text ID", "integer"); |
| 165 | + $translatedTextIdAttribute = new Attribute("translatedTextId", "Translated text ID", "integer"); |
170 | 166 | $translatedTextStructure = new Structure("translated-text", $languageAttribute, $textAttribute); |
171 | 167 | |
172 | 168 | global |
173 | 169 | $definitionIdAttribute, $alternativeDefinitionAttribute, $sourceAttribute, |
174 | 170 | $wgAlternativeDefinitionAttributeName, $wgSourceAttributeName; |
175 | 171 | |
176 | | - $definitionIdAttribute = new Attribute("definition-id", "Definition identifier", "integer"); |
| 172 | + $definitionIdAttribute = new Attribute("definitionId", "Definition identifier", "integer"); |
177 | 173 | |
178 | 174 | if ($viewInformation->filterOnLanguage() && !$viewInformation->hasMetaDataAttributes()) |
179 | | - $alternativeDefinitionAttribute = new Attribute("alternative-definition", $wgAlternativeDefinitionAttributeName, "text"); |
| 175 | + $alternativeDefinitionAttribute = new Attribute("alternativeDefinition", $wgAlternativeDefinitionAttributeName, "text"); |
180 | 176 | else |
181 | | - $alternativeDefinitionAttribute = new Attribute("alternative-definition", $wgAlternativeDefinitionAttributeName, $translatedTextStructure); |
| 177 | + $alternativeDefinitionAttribute = new Attribute("alternativeDefinition", $wgAlternativeDefinitionAttributeName, $translatedTextStructure); |
182 | 178 | |
183 | | - $sourceAttribute = new Attribute("source-id", $wgSourceAttributeName, $definedMeaningReferenceType); |
| 179 | + $sourceAttribute = new Attribute("sourceId", $wgSourceAttributeName, $definedMeaningReferenceType); |
184 | 180 | |
185 | 181 | global |
186 | 182 | $alternativeDefinitionsAttribute, $wgAlternativeDefinitionsAttributeName, $wgAlternativeDefinitionsAttributeId, |
187 | 183 | $alternativeDefinitionsStructure; |
188 | 184 | |
189 | 185 | $alternativeDefinitionsStructure = new Structure("alternative-definitions", $definitionIdAttribute, $alternativeDefinitionAttribute, $sourceAttribute); |
190 | | - |
191 | | - $alternativeDefinitionsAttribute = new Attribute(null, $wgAlternativeDefinitionsAttributeName, $alternativeDefinitionsStructure); |
| 186 | + $alternativeDefinitionsAttribute = new Attribute("alternativeDefinitions", $wgAlternativeDefinitionsAttributeName, $alternativeDefinitionsStructure); |
192 | 187 | |
193 | 188 | global |
194 | 189 | $synonymsAndTranslationsAttribute, $syntransIdAttribute, |
— | — | @@ -199,23 +194,23 @@ |
200 | 195 | else |
201 | 196 | $synonymsAndTranslationsCaption = $wgSynonymsAndTranslationsAttributeName; |
202 | 197 | |
203 | | - $syntransIdAttribute = new Attribute("syntrans-id", "$synonymsAndTranslationsCaption identifier", "integer"); |
| 198 | + $syntransIdAttribute = new Attribute("syntransId", "$synonymsAndTranslationsCaption identifier", "integer"); |
204 | 199 | $synonymsTranslationsStructure = new Structure("synonyms-translations", $syntransIdAttribute, $expressionAttribute, $identicalMeaningAttribute, $objectAttributesAttribute); |
205 | | - $synonymsAndTranslationsAttribute = new Attribute(null, "$synonymsAndTranslationsCaption", $synonymsTranslationsStructure); |
| 200 | + $synonymsAndTranslationsAttribute = new Attribute("synonymsAndTranslations", "$synonymsAndTranslationsCaption", $synonymsTranslationsStructure); |
206 | 201 | |
207 | 202 | global |
208 | 203 | $attributeObjectAttribute; |
209 | 204 | |
210 | | - $attributeObjectAttribute = new Attribute("attribute-object-id", "Attribute object", "object-id"); |
| 205 | + $attributeObjectAttribute = new Attribute("attributeObject", "Attribute object", "object-id"); |
211 | 206 | |
212 | 207 | global |
213 | 208 | $translatedTextAttributeIdAttribute, $translatedTextValueIdAttribute, |
214 | 209 | $translatedTextAttributeAttribute, $translatedTextValueAttribute, $translatedTextAttributeValuesAttribute, |
215 | 210 | $translatedTextAttributeValuesStructure, $wgTranslatedTextAttributeValuesAttributeName, $wgTranslatedTextAttributeAttributeName, $wgTranslatedTextAttributeValueAttributeName; |
216 | 211 | |
217 | | - $translatedTextAttributeIdAttribute = new Attribute("translated-text-attribute-id", "Attribute identifier", "object-id"); |
218 | | - $translatedTextAttributeAttribute = new Attribute("translated-text-attribute", $wgTranslatedTextAttributeAttributeName, $definedMeaningReferenceType); |
219 | | - $translatedTextValueIdAttribute = new Attribute("translated-text-value-id", "Translated text value identifier", "translated-text-value-id"); |
| 212 | + $translatedTextAttributeIdAttribute = new Attribute("translatedTextAttributeId", "Attribute identifier", "object-id"); |
| 213 | + $translatedTextAttributeAttribute = new Attribute("translatedTextAttribute", $wgTranslatedTextAttributeAttributeName, $definedMeaningReferenceType); |
| 214 | + $translatedTextValueIdAttribute = new Attribute("translatedTextValueId", "Translated text value identifier", "translated-text-value-id"); |
220 | 215 | |
221 | 216 | if ($viewInformation->filterOnLanguage() && !$viewInformation->hasMetaDataAttributes()) |
222 | 217 | $translatedTextValueAttribute = new Attribute("translated-text-value", $wgTranslatedTextAttributeValueAttributeName, "text"); |
— | — | @@ -223,62 +218,62 @@ |
224 | 219 | $translatedTextValueAttribute = new Attribute("translated-text", $wgTranslatedTextAttributeValueAttributeName, $translatedTextStructure); |
225 | 220 | |
226 | 221 | $translatedTextAttributeValuesStructure = new Structure("translated-text-attribute-values",$translatedTextAttributeIdAttribute, $attributeObjectAttribute, $translatedTextAttributeAttribute, $translatedTextValueIdAttribute, $translatedTextValueAttribute, $objectAttributesAttribute); |
227 | | - $translatedTextAttributeValuesAttribute = new Attribute(null, $wgTranslatedTextAttributeValuesAttributeName, $translatedTextAttributeValuesStructure); |
| 222 | + $translatedTextAttributeValuesAttribute = new Attribute("translatedTextAttributeValues", $wgTranslatedTextAttributeValuesAttributeName, $translatedTextAttributeValuesStructure); |
228 | 223 | |
229 | 224 | global |
230 | 225 | $textAttributeIdAttribute, $textAttributeObjectAttribute, $textAttributeAttribute, $textAttributeValuesStructure, |
231 | 226 | $textAttributeValuesAttribute, |
232 | 227 | $wgTextAttributeValuesAttributeName, $wgTextAttributeAttributeName; |
233 | 228 | |
234 | | - $textAttributeIdAttribute = new Attribute("text-attribute-id", "Attribute identifier", "object-id"); |
235 | | - $textAttributeObjectAttribute = new Attribute("text-attribute-object-id", "Attribute object", "object-id"); |
236 | | - $textAttributeAttribute = new Attribute("text-attribute", $wgTextAttributeAttributeName, $definedMeaningReferenceStructure); |
| 229 | + $textAttributeIdAttribute = new Attribute("textAttributeId", "Attribute identifier", "object-id"); |
| 230 | + $textAttributeObjectAttribute = new Attribute("textAttributeObject", "Attribute object", "object-id"); |
| 231 | + $textAttributeAttribute = new Attribute("textAttribute", $wgTextAttributeAttributeName, $definedMeaningReferenceStructure); |
237 | 232 | $textAttributeValuesStructure = new Structure("text-attribute-values", $textAttributeIdAttribute, $textAttributeObjectAttribute, $textAttributeAttribute, $textAttribute, $objectAttributesAttribute); |
238 | | - $textAttributeValuesAttribute = new Attribute(null, $wgTextAttributeValuesAttributeName, $textAttributeValuesStructure); |
| 233 | + $textAttributeValuesAttribute = new Attribute("textAttributeValues", $wgTextAttributeValuesAttributeName, $textAttributeValuesStructure); |
239 | 234 | |
240 | 235 | global |
241 | 236 | $linkAttributeIdAttribute, $linkAttributeObjectAttribute, $linkAttributeAttribute, $linkAttributeValuesStructure, $linkAttributeValuesAttribute, |
242 | 237 | $wgLinkAttributeValuesAttributeName, $wgLinkAttributeAttributeName, |
243 | 238 | $linkAttribute, $linkLabelAttribute, $linkURLAttribute; |
244 | 239 | |
245 | | - $linkLabelAttribute = new Attribute("label", "Label", "short-text"); |
246 | | - $linkURLAttribute = new Attribute("url", "URL", "url"); |
| 240 | + $linkLabelAttribute = new Attribute("linkLabel", "Label", "short-text"); |
| 241 | + $linkURLAttribute = new Attribute("linkURL", "URL", "url"); |
247 | 242 | $linkAttribute = new Attribute("link", "Link", new Structure($linkLabelAttribute, $linkURLAttribute)); |
248 | 243 | |
249 | | - $linkAttributeIdAttribute = new Attribute("link-attribute-id", "Attribute identifier", "object-id"); |
250 | | - $linkAttributeObjectAttribute = new Attribute("link-attribute-object-id", "Attribute object", "object-id"); |
251 | | - $linkAttributeAttribute = new Attribute("link-attribute", $wgLinkAttributeAttributeName, $definedMeaningReferenceStructure); |
| 244 | + $linkAttributeIdAttribute = new Attribute("linkAttributeId", "Attribute identifier", "object-id"); |
| 245 | + $linkAttributeObjectAttribute = new Attribute("linkAttributeObject", "Attribute object", "object-id"); |
| 246 | + $linkAttributeAttribute = new Attribute("linkAttribute", $wgLinkAttributeAttributeName, $definedMeaningReferenceStructure); |
252 | 247 | $linkAttributeValuesStructure = new Structure("link-attribute-values", $linkAttributeIdAttribute, $linkAttributeObjectAttribute, $linkAttributeAttribute, $linkAttribute, $objectAttributesAttribute); |
253 | | - $linkAttributeValuesAttribute = new Attribute(null, $wgLinkAttributeValuesAttributeName, $linkAttributeValuesStructure); |
| 248 | + $linkAttributeValuesAttribute = new Attribute("linkAttributeValues", $wgLinkAttributeValuesAttributeName, $linkAttributeValuesStructure); |
254 | 249 | |
255 | 250 | global |
256 | 251 | $optionAttributeIdAttribute, $optionAttributeAttribute, $optionAttributeObjectAttribute, $optionAttributeOptionAttribute, $optionAttributeValuesAttribute, |
257 | 252 | $wgOptionAttributeAttributeName, $wgOptionAttributeOptionAttributeName, $wgOptionAttributeValuesAttributeName, $optionAttributeValuesStructure; |
258 | 253 | |
259 | | - $optionAttributeIdAttribute = new Attribute('option-attribute-id', 'Attribute identifier', 'object-id'); |
260 | | - $optionAttributeObjectAttribute = new Attribute('option-attribute-object-id', 'Attribute object', 'object-id'); |
261 | | - $optionAttributeAttribute = new Attribute('option-attribute', $wgOptionAttributeAttributeName, $definedMeaningReferenceType); |
262 | | - $optionAttributeOptionAttribute = new Attribute('option-attribute-option', $wgOptionAttributeOptionAttributeName, $definedMeaningReferenceType); |
| 254 | + $optionAttributeIdAttribute = new Attribute("optionAttributeId", "Attribute identifier", "object-id"); |
| 255 | + $optionAttributeObjectAttribute = new Attribute("optionAttributeObject", "Attribute object", "object-id"); |
| 256 | + $optionAttributeAttribute = new Attribute("optionAttribute", $wgOptionAttributeAttributeName, $definedMeaningReferenceType); |
| 257 | + $optionAttributeOptionAttribute = new Attribute("optionAttributeOption", $wgOptionAttributeOptionAttributeName, $definedMeaningReferenceType); |
263 | 258 | $optionAttributeValuesStructure = new Structure('option-attribute-values', $optionAttributeIdAttribute, $optionAttributeAttribute, $optionAttributeObjectAttribute, $optionAttributeOptionAttribute, $objectAttributesAttribute); |
264 | | - $optionAttributeValuesAttribute = new Attribute(null, $wgOptionAttributeValuesAttributeName, $optionAttributeValuesStructure); |
| 259 | + $optionAttributeValuesAttribute = new Attribute("optionAttributeValues", $wgOptionAttributeValuesAttributeName, $optionAttributeValuesStructure); |
265 | 260 | |
266 | 261 | global |
267 | 262 | $optionAttributeOptionIdAttribute, $optionAttributeOptionsAttribute, $wgOptionAttributeOptionsAttributeName; |
268 | 263 | |
269 | | - $optionAttributeOptionIdAttribute = new Attribute('option-attribute-option-id', 'Option identifier', 'object-id'); |
270 | | - $optionAttributeOptionsStructure = new Structure('option-attribute-options', $optionAttributeOptionIdAttribute, $optionAttributeAttribute, $optionAttributeOptionAttribute, $languageAttribute); |
271 | | - $optionAttributeOptionsAttribute = new Attribute(null, $wgOptionAttributeOptionsAttributeName, $optionAttributeOptionsStructure); |
| 264 | + $optionAttributeOptionIdAttribute = new Attribute("optionAttributeOptionId", "Option identifier", "object-id"); |
| 265 | + $optionAttributeOptionsStructure = new Structure("option-attribute-options", $optionAttributeOptionIdAttribute, $optionAttributeAttribute, $optionAttributeOptionAttribute, $languageAttribute); |
| 266 | + $optionAttributeOptionsAttribute = new Attribute("optionAttributeOptions", $wgOptionAttributeOptionsAttributeName, $optionAttributeOptionsStructure); |
272 | 267 | |
273 | 268 | global |
274 | 269 | $definitionAttribute, $translatedTextAttribute, $classAttributesAttribute, |
275 | 270 | $wgDefinitionAttributeName, $wgTranslatedTextAttributeName; |
276 | 271 | |
277 | 272 | if ($viewInformation->filterOnLanguage() && !$viewInformation->hasMetaDataAttributes()) |
278 | | - $translatedTextAttribute = new Attribute("translated-text", $wgTextAttributeName, "text"); |
| 273 | + $translatedTextAttribute = new Attribute("translatedText", $wgTextAttributeName, "text"); |
279 | 274 | else |
280 | | - $translatedTextAttribute = new Attribute(null, $wgTranslatedTextAttributeName, $translatedTextStructure); |
| 275 | + $translatedTextAttribute = new Attribute("translatedText", $wgTranslatedTextAttributeName, $translatedTextStructure); |
281 | 276 | |
282 | | - $definitionAttribute = new Attribute(null, $wgDefinitionAttributeName, new Structure("definition", $translatedTextAttribute, $objectAttributesAttribute)); |
| 277 | + $definitionAttribute = new Attribute("definition", $wgDefinitionAttributeName, new Structure("definition", $translatedTextAttribute, $objectAttributesAttribute)); |
283 | 278 | |
284 | 279 | global |
285 | 280 | $classAttributesStructure, |
— | — | @@ -287,19 +282,20 @@ |
288 | 283 | $wgClassAttributeAttributeAttributeName, $wgClassAttributeLevelAttributeName, |
289 | 284 | $wgClassAttributeTypeAttributeName, $wgClassAttributesAttributeName, $wgClassAttributesAttributeId; |
290 | 285 | |
291 | | - $classAttributeIdAttribute = new Attribute("class-attribute-id", "Class attribute identifier", "object-id"); |
292 | | - $classAttributeAttributeAttribute = new Attribute("class-attribute-attribute", $wgClassAttributeAttributeAttributeName, $definedMeaningReferenceStructure); |
293 | | - $classAttributeLevelAttribute = new Attribute("class-attribute-level", $wgClassAttributeLevelAttributeName, $definedMeaningReferenceStructure); |
294 | | - $classAttributeTypeAttribute = new Attribute("class-attribute-type", $wgClassAttributeTypeAttributeName, "short-text"); |
| 286 | + $classAttributeIdAttribute = new Attribute("classAttributeId", "Class attribute identifier", "object-id"); |
| 287 | + $classAttributeAttributeAttribute = new Attribute("classAttributeAttribute", $wgClassAttributeAttributeAttributeName, $definedMeaningReferenceStructure); |
| 288 | + $classAttributeLevelAttribute = new Attribute("classAttributeLevel", $wgClassAttributeLevelAttributeName, $definedMeaningReferenceStructure); |
| 289 | + $classAttributeTypeAttribute = new Attribute("classAttributeType", $wgClassAttributeTypeAttributeName, "short-text"); |
295 | 290 | $classAttributesStructure = new Structure("class-attributes", $classAttributeIdAttribute, $classAttributeAttributeAttribute, $classAttributeLevelAttribute, $classAttributeTypeAttribute, $optionAttributeOptionsAttribute); |
296 | | - $classAttributesAttribute = new Attribute(null, $wgClassAttributesAttributeName, $classAttributesStructure); |
| 291 | + $classAttributesAttribute = new Attribute("classAttributes", $wgClassAttributesAttributeName, $classAttributesStructure); |
297 | 292 | |
298 | 293 | global |
299 | 294 | $definedMeaningAttribute, $wgDefinedMeaningAttributeName; |
300 | 295 | |
301 | | - $definedMeaningAttribute = new Attribute(null, $wgDefinedMeaningAttributeName, |
| 296 | + $definedMeaningAttribute = new Attribute("definedMeaning", $wgDefinedMeaningAttributeName, |
302 | 297 | new Structure( |
303 | 298 | "defined-meaning", |
| 299 | + $definedMeaningCompleteDefiningExpressionAttribute, |
304 | 300 | $definitionAttribute, |
305 | 301 | $classAttributesAttribute, |
306 | 302 | $alternativeDefinitionsAttribute, |
— | — | @@ -308,7 +304,8 @@ |
309 | 305 | $reciprocalRelationsAttribute, |
310 | 306 | $classMembershipAttribute, |
311 | 307 | $collectionMembershipAttribute, |
312 | | - $definedMeaningAttributesAttribute) |
| 308 | + $definedMeaningAttributesAttribute |
| 309 | + ) |
313 | 310 | ); |
314 | 311 | |
315 | 312 | global |
— | — | @@ -316,25 +313,25 @@ |
317 | 314 | $wgExactMeaningsAttributeName, $wgApproximateMeaningsAttributeName; |
318 | 315 | |
319 | 316 | $expressionMeaningStructure = new Structure("expression-exact-meanings", $definedMeaningIdAttribute, $textAttribute, $definedMeaningAttribute); |
320 | | - $expressionExactMeaningsAttribute = new Attribute(null, $wgExactMeaningsAttributeName, $expressionMeaningStructure); |
321 | | - $expressionApproximateMeaningsAttribute = new Attribute("expression-approximate-meanings", $wgApproximateMeaningsAttributeName, $expressionMeaningStructure); |
| 317 | + $expressionExactMeaningsAttribute = new Attribute("expressionExactMeanings", $wgExactMeaningsAttributeName, $expressionMeaningStructure); |
| 318 | + $expressionApproximateMeaningsAttribute = new Attribute("expressionApproximateMeanings", $wgApproximateMeaningsAttributeName, $expressionMeaningStructure); |
322 | 319 | |
323 | 320 | global |
324 | | - $expressionMeaningsAttribute, $expressionMeaningsStructure, $expressionApproximateMeaningAttribute, |
| 321 | + $expressionMeaningsAttribute, $expressionMeaningsStructure, |
325 | 322 | $wgExpressionMeaningsAttributeName, $wgExpressionsAttributeName, |
326 | 323 | $expressionsStructure; |
327 | 324 | |
328 | | - $expressionMeaningsStructure = new Structure("expression-meanings", $expressionExactMeaningsAttribute, $expressionApproximateMeaningAttribute); |
329 | | - $expressionMeaningsAttribute = new Attribute(null, $wgExpressionMeaningsAttributeName, $expressionMeaningsStructure); |
| 325 | + $expressionMeaningsStructure = new Structure("expression-meanings", $expressionExactMeaningsAttribute, $expressionApproximateMeaningsAttribute); |
| 326 | + $expressionMeaningsAttribute = new Attribute("expressionMeanings", $wgExpressionMeaningsAttributeName, $expressionMeaningsStructure); |
330 | 327 | |
331 | 328 | $expressionsStructure = new Structure("expressions", $expressionIdAttribute, $expressionAttribute, $expressionMeaningsAttribute); |
332 | | - $expressionsAttribute = new Attribute(null, $wgExpressionsAttributeName, $expressionsStructure); |
| 329 | + $expressionsAttribute = new Attribute("expressions", $wgExpressionsAttributeName, $expressionsStructure); |
333 | 330 | |
334 | 331 | global |
335 | 332 | $objectIdAttribute, $objectAttributesStructure, $wgAnnotationAttributeName; |
336 | 333 | |
337 | | - $objectIdAttribute = new Attribute("object-id", "Object identifier", "object-id"); |
338 | | - $objectAttributesStructure = new Structure("object-attributes", $objectIdAttribute, $textAttributeValuesAttribute, $translatedTextAttributeValuesAttribute, $optionAttributeValuesAttribute); |
| 334 | + $objectIdAttribute = new Attribute("objectId", "Object identifier", "object-id"); |
| 335 | + $objectAttributesStructure = new Structure("object-attributes", $objectIdAttribute, $textAttributeValuesAttribute, $translatedTextAttributeValuesAttribute, $linkAttributeValuesAttribute, $optionAttributeValuesAttribute); |
339 | 336 | $objectAttributesAttribute->setAttributeType($objectAttributesStructure); |
340 | 337 | $definedMeaningAttributesAttribute->setAttributeType($objectAttributesStructure); |
341 | 338 | |
— | — | @@ -342,14 +339,20 @@ |
343 | 340 | $definitionAttribute, |
344 | 341 | $synonymsAndTranslationsAttribute, |
345 | 342 | $relationsAttribute, |
346 | | - $reciprocalRelationsAttribute |
| 343 | + $reciprocalRelationsAttribute, |
| 344 | + $objectAttributesAttribute, |
| 345 | + $textAttributeValuesAttribute, |
| 346 | + $linkAttributeValuesAttribute, |
| 347 | + $translatedTextAttributeValuesAttribute, |
| 348 | + $optionAttributeValuesAttribute, |
| 349 | + $definedMeaningAttribute |
347 | 350 | ); |
348 | 351 | |
349 | 352 | foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) { |
350 | 353 | $attribute = $propertyToColumnFilter->getAttribute(); |
351 | 354 | $attribute->setAttributeType($objectAttributesStructure); |
352 | 355 | |
353 | | - foreach ($annotatedAttributes as $annotatedAttribute) |
| 356 | + foreach ($annotatedAttributes as $annotatedAttribute) |
354 | 357 | $annotatedAttribute->type->addAttribute($attribute); |
355 | 358 | } |
356 | 359 | |
— | — | @@ -389,16 +392,16 @@ |
390 | 393 | $t->language = new Attribute("language", wfMsg("Language"), "language"); |
391 | 394 | $t->spelling = new Attribute("spelling", wfMsg("Spelling"), "spelling"); |
392 | 395 | $t->text = new Attribute("text", wfMsg("Text"), "text"); |
393 | | - $t->definedMeaningAttributes = new Attribute("defined-meaning-attributes", wfMsg("DefinedMeaningAttributes"), "will-be-specified-below"); |
394 | | - $t->objectAttributes = new Attribute("object-attributes", wfMsg("Annotation"), "will-be-specified-below"); |
395 | | - $t->expressionId = new Attribute("expression-id", "Expression Id", "expression-id"); |
396 | | - $t->identicalMeaning = new Attribute("indentical-meaning", wfMsg("IdenticalMeaning"), "boolean"); |
| 396 | + $t->definedMeaningAttributes = new Attribute("definedMeaningAttributes", wfMsg("DefinedMeaningAttributes"), "will-be-specified-below"); |
| 397 | + $t->objectAttributes = new Attribute("objectAttributes", wfMsg("Annotation"), "will-be-specified-below"); |
| 398 | + $t->expressionId = new Attribute("expressionId", "Expression Id", "expression-id"); |
| 399 | + $t->identicalMeaning = new Attribute("indenticalMeaning", wfMsg("IdenticalMeaning"), "boolean"); |
397 | 400 | |
398 | 401 | if ($viewInformation->filterOnLanguage()) |
399 | 402 | $t->expression = new Attribute("expression", wfMsg("Spelling"), "spelling"); |
400 | 403 | else { |
401 | 404 | $t->expressionStructure = new Structure("expression", $t->language, $t->spelling); |
402 | | - $t->expression = new Attribute(null, wfMsg("Expression"), $t->expressionStructure); |
| 405 | + $t->expression = new Attribute("expression", wfMsg("Expression"), $t->expressionStructure); |
403 | 406 | } |
404 | 407 | |
405 | 408 | $t->definedMeaningId = new Attribute("defined-meaning-id", "Defined meaning identifier", "defined-meaning-id"); |
— | — | @@ -411,67 +414,66 @@ |
412 | 415 | ); |
413 | 416 | #try this |
414 | 417 | $t->definedMeaningCompleteDefiningExpressionStructure->setStructureType("expression"); |
415 | | - $t->definedMeaningCompleteDefiningExpression=new Attribute(null, "Defining expression", $t->definedMeaningCompleteDefiningExpressionStructure); |
| 418 | + $t->definedMeaningCompleteDefiningExpression =new Attribute("definedMeaningCompleteDefiningExpression", "Defining expression", $t->definedMeaningCompleteDefiningExpressionStructure); |
416 | 419 | global |
417 | 420 | $definedMeaningReferenceType; |
418 | 421 | |
419 | 422 | $t->definedMeaningLabel = new Attribute("defined-meaning-label", "Defined meaning label", "short-text"); |
420 | 423 | $t->definedMeaningReferenceStructure = new Structure("defined-meaning", $t->definedMeaningId, $t->definedMeaningLabel, $t->definedMeaningDefiningExpression); |
421 | 424 | $definedMeaningReferenceType = $t->definedMeaningReferenceStructure; |
422 | | - $t->definedMeaningReference = new Attribute(null, wfMsg("DefinedMeaningReference"), $definedMeaningReferenceType); |
423 | | - $t->collectionId = new Attribute("collection", "Collection", "collection-id"); |
424 | | - $t->collectionMeaning = new Attribute("collection-meaning", wfMsg("Collection"), $t->definedMeaningReferenceStructure); |
425 | | - $t->sourceIdentifier = new Attribute("source-identifier", wfMsg("SourceIdentifier"), "short-text"); |
| 425 | + $t->definedMeaningReference = new Attribute("definedMeaningReference", wfMsg("DefinedMeaningReference"), $definedMeaningReferenceType); |
| 426 | + $t->collectionId = new Attribute("collectionId", "Collection", "collection-id"); |
| 427 | + $t->collectionMeaning = new Attribute("collectionMeaning", wfMsg("Collection"), $t->definedMeaningReferenceStructure); |
| 428 | + $t->sourceIdentifier = new Attribute("sourceIdentifier", wfMsg("SourceIdentifier"), "short-text"); |
426 | 429 | $t->gotoSourceStructure = new Structure("goto-source",$t->collectionId, $t->sourceIdentifier); |
427 | | - $t->gotoSource = new Attribute(null, wfMsg("GotoSource"), $t->gotoSourceStructure); |
| 430 | + $t->gotoSource = new Attribute("gotoSource", wfMsg("GotoSource"), $t->gotoSourceStructure); |
428 | 431 | $t->collectionMembershipStructure = new Structure("collection-membership",$t->collectionId, $t->collectionMeaning, $t->sourceIdentifier); |
429 | | - $t->collectionMembership = new Attribute(null, wfMsg("CollectionMembership"), $t->collectionMembershipStructure); |
430 | | - $t->classMembershipId = new Attribute("class-membership-id", "Class membership id", "integer"); |
| 432 | + $t->collectionMembership = new Attribute("collectionMembership", wfMsg("CollectionMembership"), $t->collectionMembershipStructure); |
| 433 | + $t->classMembershipId = new Attribute("classMembershipId", "Class membership id", "integer"); |
431 | 434 | $t->class = new Attribute("class", "Class", $t->definedMeaningReferenceStructure); |
432 | 435 | $t->classMembershipStructure = new Structure("class-membership", $t->classMembershipId, $t->class); |
433 | | - $t->classMembership = new Attribute(null, wfMsg("ClassMembership"), $t->classMembershipStructure); |
| 436 | + $t->classMembership = new Attribute("classMembership", wfMsg("ClassMembership"), $t->classMembershipStructure); |
434 | 437 | |
435 | 438 | global |
436 | 439 | $wgPossiblySynonymousAttributeId; |
437 | 440 | |
438 | | - $t->possiblySynonymousId = new Attribute("possibly-synonymous-id", "Possibly synonymous id", "integer"); |
439 | | - $t->possibleSynonym = new Attribute("possible-synonym", wfMsg("PossibleSynonym"), $t->definedMeaningReferenceStructure); |
| 441 | + $t->possiblySynonymousId = new Attribute("possiblySynonymousId", "Possibly synonymous id", "integer"); |
| 442 | + $t->possibleSynonym = new Attribute("possibleSynonym", wfMsg("PossibleSynonym"), $t->definedMeaningReferenceStructure); |
440 | 443 | # Bug found ... This never worked before: (!) |
441 | 444 | #$t->possiblySynonymousStructure = new Structure("possibly-synonymous", $t->possiblySynonymousId, $t->possiblySynonymous); |
442 | 445 | $t->possiblySynonymousStructure = new Structure("possibly-synonymous", $t->possiblySynonymousId, $t->possibleSynonym); |
443 | | - $t->possiblySynonymous = new Attribute(null, wfMsg("PossiblySynonymous"), $t->possiblySynonymousStructure); |
| 446 | + $t->possiblySynonymous = new Attribute("possiblySynonymous", wfMsg("PossiblySynonymous"), $t->possiblySynonymousStructure); |
444 | 447 | |
445 | 448 | global |
446 | 449 | $relationTypeType; |
447 | 450 | |
448 | | - $t->relationId = new Attribute("relation-id", "Relation identifier", "object-id"); |
449 | | - $t->relationType = new Attribute("relation-type", wfMsg("RelationType"), $t->definedMeaningReferenceStructure); |
450 | | - $t->otherDefinedMeaning = new Attribute("other-defined-meaning", wfMsg("OtherDefinedMeaning"), $definedMeaningReferenceType); |
| 451 | + $t->relationId = new Attribute("relationId", "Relation identifier", "object-id"); |
| 452 | + $t->relationType = new Attribute("relationType", wfMsg("RelationType"), $t->definedMeaningReferenceStructure); |
| 453 | + $t->otherDefinedMeaning = new Attribute("otherDefinedMeaning", wfMsg("OtherDefinedMeaning"), $definedMeaningReferenceType); |
451 | 454 | |
452 | 455 | global |
453 | 456 | $wgRelationsAttributeId, $wgIncomingRelationsAttributeId ; |
454 | 457 | |
455 | 458 | $t->relationStructure = new Structure("relations", $t->relationId, $t->relationType, $t->otherDefinedMeaning, $t->objectAttributes); |
456 | | - $t->relations = new Attribute(null, wfMsg("Relations"), $t->relationStructure); |
457 | | - $t->reciprocalRelations = new Attribute("reciprocal-relations", wfMsg("IncomingRelations"), $t->relationStructure); |
458 | | - $t->translatedTextId = new Attribute("translated-text-id", "Translated text ID", "integer"); |
| 459 | + $t->relations = new Attribute("relations", wfMsg("Relations"), $t->relationStructure); |
| 460 | + $t->reciprocalRelations = new Attribute("reciprocalRelations", wfMsg("IncomingRelations"), $t->relationStructure); |
| 461 | + $t->translatedTextId = new Attribute("translatedTextId", "Translated text ID", "integer"); |
459 | 462 | $t->translatedTextStructure = new Structure("translated-text", $t->language, $t->text); |
460 | 463 | |
461 | | - $t->definitionId = new Attribute("definition-id", "Definition identifier", "integer"); |
| 464 | + $t->definitionId = new Attribute("definitionId", "Definition identifier", "integer"); |
462 | 465 | |
463 | 466 | if ($viewInformation->filterOnLanguage() && !$viewInformation->hasMetaDataAttributes()) |
464 | | - $t->alternativeDefinition = new Attribute("alternative-definition", wfMsg("AlternativeDefinition"), "text"); |
| 467 | + $t->alternativeDefinition = new Attribute("alternativeDefinition", wfMsg("AlternativeDefinition"), "text"); |
465 | 468 | else |
466 | | - $t->alternativeDefinition = new Attribute("alternative-definition", wfMsg("AlternativeDefinition"), $t->translatedTextStructure); |
| 469 | + $t->alternativeDefinition = new Attribute("alternativeDefinition", wfMsg("AlternativeDefinition"), $t->translatedTextStructure); |
467 | 470 | |
468 | | - $t->source = new Attribute("source-id", wfMsg("Source"), $definedMeaningReferenceType); |
| 471 | + $t->source = new Attribute("sourceId", wfMsg("Source"), $definedMeaningReferenceType); |
469 | 472 | |
470 | 473 | global |
471 | 474 | $wgAlternativeDefinitionsAttributeId; |
472 | 475 | |
473 | 476 | $t->alternativeDefinitionsStructure = new Structure("alternative-definitions", $t->definitionId, $t->alternativeDefinition, $t->source); |
474 | | - |
475 | | - $t->alternativeDefinitions = new Attribute(null, wfMsg("AlternativeDefinitions"), $t->alternativeDefinitionsStructure); |
| 477 | + $t->alternativeDefinitions = new Attribute("alternativeDefinitions", wfMsg("AlternativeDefinitions"), $t->alternativeDefinitionsStructure); |
476 | 478 | |
477 | 479 | global |
478 | 480 | $wgSynonymsAndTranslationsAttributeId; |
— | — | @@ -481,66 +483,67 @@ |
482 | 484 | else |
483 | 485 | $synonymsAndTranslationsCaption = wfMsg("SynonymsAndTranslations"); |
484 | 486 | |
485 | | - $t->attributeObjectId = new Attribute("attributeObjectId", "Attribute object", "object-id"); |
| 487 | + $t->attributeObject = new Attribute("attributeObject", "Attribute object", "object-id"); |
486 | 488 | |
487 | | - $t->syntransId = new Attribute("syntrans-id", "$synonymsAndTranslationsCaption identifier", "integer"); |
| 489 | + $t->syntransId = new Attribute("syntransId", "$synonymsAndTranslationsCaption identifier", "integer"); |
488 | 490 | $t->synonymsTranslationsStructure = new Structure("synonyms-translations", $t->syntransId, $t->expression, $t->identicalMeaning, $t->objectAttributes); |
489 | | - $t->synonymsAndTranslations = new Attribute(null, "$synonymsAndTranslationsCaption", $t->synonymsTranslationsStructure); |
490 | | - $t->translatedTextAttributeId = new Attribute("translated-text-attribute-id", "Attribute identifier", "object-id"); |
491 | | - $t->translatedTextAttribute = new Attribute("translated-text-attribute", wfMsg("TranslatedTextAttribute"), $definedMeaningReferenceType); |
492 | | - $t->translatedTextValueId = new Attribute("translated-text-value-id", "Translated text value identifier", "translated-text-value-id"); |
| 491 | + $t->synonymsAndTranslations = new Attribute("synonymsAndTranslations", "$synonymsAndTranslationsCaption", $t->synonymsTranslationsStructure); |
| 492 | + $t->translatedTextAttributeId = new Attribute("translatedTextAttributeId", "Attribute identifier", "object-id"); |
| 493 | + $t->translatedTextAttribute = new Attribute("translatedTextAttribute", wfMsg("TranslatedTextAttribute"), $definedMeaningReferenceType); |
| 494 | + $t->translatedTextValueId = new Attribute("translatedTextValueId", "Translated text value identifier", "translated-text-value-id"); |
493 | 495 | |
494 | 496 | if ($viewInformation->filterOnLanguage() && !$viewInformation->hasMetaDataAttributes()) |
495 | | - $t->translatedTextValue = new Attribute("translated-text-value", wfMsg("TranslatedTextAttributeValue"), "text"); |
| 497 | + $t->translatedTextValue = new Attribute("translatedTextValue", wfMsg("TranslatedTextAttributeValue"), "text"); |
496 | 498 | else |
497 | | - $t->translatedTextValue = new Attribute("translated-text", wfMsg("TranslatedTextAttributeValue"), $t->translatedTextStructure); |
| 499 | + $t->translatedTextValue = new Attribute("translatedTextValue", wfMsg("TranslatedTextAttributeValue"), $t->translatedTextStructure); |
498 | 500 | |
499 | | - $t->translatedTextAttributeValuesStructure = new Structure("translated-text-attribute-values",$t->translatedTextAttributeId, $t->attributeObjectId, $t->translatedTextAttribute, $t->translatedTextValueId, $t->translatedTextValue, $t->objectAttributes); |
500 | | - $t->translatedTextAttributeValues = new Attribute(null, wfMsg("TranslatedTextAttributeValues"), $t->translatedTextAttributeValuesStructure); |
501 | | - $t->textAttributeId = new Attribute("text-attribute-id", "Attribute identifier", "object-id"); |
502 | | - $t->textAttributeObject = new Attribute("text-attribute-object-id", "Attribute object", "object-id"); |
503 | | - $t->textAttribute = new Attribute("text-attribute", wfMsg("TextAttribute"), $t->definedMeaningReferenceStructure); |
| 501 | + $t->translatedTextAttributeValuesStructure = new Structure("translated-text-attribute-values",$t->translatedTextAttributeId, $t->attributeObject, $t->translatedTextAttribute, $t->translatedTextValueId, $t->translatedTextValue, $t->objectAttributes); |
| 502 | + $t->translatedTextAttributeValues = new Attribute("translatedTextAttributeValues", wfMsg("TranslatedTextAttributeValues"), $t->translatedTextAttributeValuesStructure); |
| 503 | + $t->textAttributeId = new Attribute("textAttributeId", "Attribute identifier", "object-id"); |
| 504 | + $t->textAttributeObject = new Attribute("textAttributeObject", "Attribute object", "object-id"); |
| 505 | + $t->textAttribute = new Attribute("textAttribute", wfMsg("TextAttribute"), $t->definedMeaningReferenceStructure); |
504 | 506 | $t->textAttributeValuesStructure = new Structure("text-attribute-values", $t->textAttributeId, $t->textAttributeObject, $t->textAttribute, $t->text, $t->objectAttributes); |
505 | | - $t->textAttributeValues = new Attribute(null, wfMsg("TextAttributeValues"), $t->textAttributeValuesStructure); |
506 | | - $t->linkLabel = new Attribute("label", "Label", "short-text"); |
507 | | - $t->linkURL = new Attribute("url", "URL", "url"); |
| 507 | + $t->textAttributeValues = new Attribute("textAttributeValues", wfMsg("TextAttributeValues"), $t->textAttributeValuesStructure); |
| 508 | + $t->linkLabel = new Attribute("linkLabel", "Label", "short-text"); |
| 509 | + $t->linkURL = new Attribute("linkURL", "URL", "url"); |
508 | 510 | $t->link = new Attribute("link", "Link", new Structure($t->linkLabel, $t->linkURL)); |
509 | 511 | |
510 | | - $t->linkAttributeId = new Attribute("link-attribute-id", "Attribute identifier", "object-id"); |
511 | | - $t->linkAttributeObject = new Attribute("link-attribute-object-id", "Attribute object", "object-id"); |
512 | | - $t->linkAttribute = new Attribute("link-attribute", wfMsg("LinkAttribute"), $t->definedMeaningReferenceStructure); |
| 512 | + $t->linkAttributeId = new Attribute("linkAttributeId", "Attribute identifier", "object-id"); |
| 513 | + $t->linkAttributeObject = new Attribute("linkAttributeObject", "Attribute object", "object-id"); |
| 514 | + $t->linkAttribute = new Attribute("linkAttribute", wfMsg("LinkAttribute"), $t->definedMeaningReferenceStructure); |
513 | 515 | $t->linkAttributeValuesStructure = new Structure("link-attribute-values", $t->linkAttributeId, $t->linkAttributeObject, $t->linkAttribute, $t->link, $t->objectAttributes); |
514 | | - $t->linkAttributeValues = new Attribute(null, wfMsg("LinkAttributeValues"), $t->linkAttributeValuesStructure); |
515 | | - $t->optionAttributeId = new Attribute('option-attribute-id', 'Attribute identifier', 'object-id'); |
516 | | - $t->optionAttributeObject = new Attribute('option-attribute-object-id', 'Attribute object', 'object-id'); |
517 | | - $t->optionAttribute = new Attribute('option-attribute', wfMsg("OptionAttribute"), $definedMeaningReferenceType); |
518 | | - $t->optionAttributeOption = new Attribute('option-attribute-option', wfMsg("OptionAttributeOption"), $definedMeaningReferenceType); |
519 | | - $t->optionAttributeValuesStructure = new Structure('option-attribute-values', $t->optionAttributeId, $t->optionAttribute, $t->optionAttributeObject, $t->optionAttributeOption, $t->objectAttributes); |
520 | | - $t->optionAttributeValues = new Attribute(null, wfMsg("OptionAttributeValues"), $t->optionAttributeValuesStructure); |
521 | | - $t->optionAttributeOptionId = new Attribute('option-attribute-option-id', 'Option identifier', 'object-id'); |
522 | | - $t->optionAttributeOptionsStructure = new Structure('option-attribute-options', $t->optionAttributeOptionId, $t->optionAttribute, $t->optionAttributeOption, $t->language); |
523 | | - $t->optionAttributeOptions = new Attribute(null, wfMsg("OptionAttributeOptions"), $t->optionAttributeOptionsStructure); |
| 516 | + $t->linkAttributeValues = new Attribute("linkAttributeValues", wfMsg("LinkAttributeValues"), $t->linkAttributeValuesStructure); |
| 517 | + $t->optionAttributeId = new Attribute("optionAttributeId", "Attribute identifier", "object-id"); |
| 518 | + $t->optionAttributeObject = new Attribute("optionAttributeObject", "Attribute object", "object-id"); |
| 519 | + $t->optionAttribute = new Attribute("optionAttribute", wfMsg("OptionAttribute"), $definedMeaningReferenceType); |
| 520 | + $t->optionAttributeOption = new Attribute("optionAttributeOption", wfMsg("OptionAttributeOption"), $definedMeaningReferenceType); |
| 521 | + $t->optionAttributeValuesStructure = new Structure("optionAttributeValues", $t->optionAttributeId, $t->optionAttribute, $t->optionAttributeObject, $t->optionAttributeOption, $t->objectAttributes); |
| 522 | + $t->optionAttributeValues = new Attribute("optionAttributeValues", wfMsg("OptionAttributeValues"), $t->optionAttributeValuesStructure); |
| 523 | + $t->optionAttributeOptionId = new Attribute("optionAttributeOptionId", "Option identifier", "object-id"); |
| 524 | + $t->optionAttributeOptionsStructure = new Structure("option-attribute-options", $t->optionAttributeOptionId, $t->optionAttribute, $t->optionAttributeOption, $t->language); |
| 525 | + $t->optionAttributeOptions = new Attribute("optionAttributeOptions", wfMsg("OptionAttributeOptions"), $t->optionAttributeOptionsStructure); |
524 | 526 | |
525 | 527 | if ($viewInformation->filterOnLanguage() && !$viewInformation->hasMetaDataAttributes()) |
526 | | - $t->translatedText = new Attribute("translated-text", wfMsg("Text"), "text"); |
| 528 | + $t->translatedText = new Attribute("translatedText", wfMsg("Text"), "text"); |
527 | 529 | else |
528 | | - $t->translatedText = new Attribute(null, wfMsg("TranslatedText"), $t->translatedTextStructure); |
| 530 | + $t->translatedText = new Attribute("translatedText", wfMsg("TranslatedText"), $t->translatedTextStructure); |
529 | 531 | |
530 | | - $t->definition = new Attribute(null, wfMsg("Definition"), new Structure("definition", $t->translatedText, $t->objectAttributes)); |
| 532 | + $t->definition = new Attribute("definition", wfMsg("Definition"), new Structure("definition", $t->translatedText, $t->objectAttributes)); |
531 | 533 | |
532 | 534 | global |
533 | 535 | $wgClassAttributesAttributeId; |
534 | 536 | |
535 | | - $t->classAttributeId = new Attribute("class-attribute-id", "Class attribute identifier", "object-id"); |
536 | | - $t->classAttributeAttribute = new Attribute("class-attribute-attribute", wfMsg("ClassAttributeAttribute"), $t->definedMeaningReferenceStructure); |
537 | | - $t->classAttributeLevel = new Attribute("class-attribute-level", wfMsg("ClassAttributeLevel"), $t->definedMeaningReferenceStructure); |
538 | | - $t->classAttributeType = new Attribute("class-attribute-type", wfMsg("ClassAttributeType"), "short-text"); |
| 537 | + $t->classAttributeId = new Attribute("classAttributeId", "Class attribute identifier", "object-id"); |
| 538 | + $t->classAttributeAttribute = new Attribute("classAttributeAttribute", wfMsg("ClassAttributeAttribute"), $t->definedMeaningReferenceStructure); |
| 539 | + $t->classAttributeLevel = new Attribute("classAttributeLevel", wfMsg("ClassAttributeLevel"), $t->definedMeaningReferenceStructure); |
| 540 | + $t->classAttributeType = new Attribute("classAttributeType", wfMsg("ClassAttributeType"), "short-text"); |
539 | 541 | $t->classAttributesStructure = new Structure("class-attributes", $t->classAttributeId, $t->classAttributeAttribute, $t->classAttributeLevel, $t->classAttributeType, $t->optionAttributeOptions); |
540 | | - $t->classAttributes = new Attribute(null, wfMsg("ClassAttributes"), $t->classAttributesStructure); |
| 542 | + $t->classAttributes = new Attribute("classAttributes", wfMsg("ClassAttributes"), $t->classAttributesStructure); |
541 | 543 | |
542 | | - $t->definedMeaning = new Attribute(null, wfMsg("DefinedMeaning"), |
| 544 | + $t->definedMeaning = new Attribute("definedMeaning", wfMsg("DefinedMeaning"), |
543 | 545 | new Structure( |
544 | 546 | "defined-meaning", |
| 547 | + $t->definedMeaningCompleteDefiningExpression, |
545 | 548 | $t->definition, |
546 | 549 | $t->classAttributes, |
547 | 550 | $t->alternativeDefinitions, |
— | — | @@ -549,27 +552,33 @@ |
550 | 553 | $t->reciprocalRelations, |
551 | 554 | $t->classMembership, |
552 | 555 | $t->collectionMembership, |
553 | | - $t->definedMeaningAttributes) |
| 556 | + $t->definedMeaningAttributes |
| 557 | + ) |
554 | 558 | ); |
555 | 559 | |
556 | 560 | $t->expressionMeaningStructure = new Structure("expression-exact-meanings", $t->definedMeaningId, $t->text, $t->definedMeaning); |
557 | | - $t->expressionExactMeanings = new Attribute(null, wfMsg("ExactMeanings"), $t->expressionMeaningStructure); |
558 | | - $t->expressionApproximateMeanings = new Attribute("expression-approximate-meanings", wfMsg("ApproximateMeanings"), $t->expressionMeaningStructure); |
| 561 | + $t->expressionExactMeanings = new Attribute("expressionExactMeanings", wfMsg("ExactMeanings"), $t->expressionMeaningStructure); |
| 562 | + $t->expressionApproximateMeanings = new Attribute("expressionApproximateMeanings", wfMsg("ApproximateMeanings"), $t->expressionMeaningStructure); |
559 | 563 | # bug found here also: $t->expressionAoproximateMeaning_S_ |
560 | 564 | $t->expressionMeaningsStructure = new Structure("expression-meanings", $t->expressionExactMeanings, $t->expressionApproximateMeanings); |
561 | | - $t->expressionMeanings = new Attribute(null, wfMsg("ExpressionMeanings"), $t->expressionMeaningsStructure); |
| 565 | + $t->expressionMeanings = new Attribute("expressionMeanings", wfMsg("ExpressionMeanings"), $t->expressionMeaningsStructure); |
562 | 566 | $t->expressionsStructure = new Structure("expressions", $t->expressionId, $t->expression, $t->expressionMeanings); |
563 | | - $t->expressions = new Attribute(null, wfMsg("Expressions"), $t->expressionsStructure); |
564 | | - $t->objectId = new Attribute("object-id", "Object identifier", "object-id"); |
| 567 | + $t->expressions = new Attribute("expressions", wfMsg("Expressions"), $t->expressionsStructure); |
| 568 | + $t->objectId = new Attribute("objectId", "Object identifier", "object-id"); |
565 | 569 | $t->objectAttributesStructure = new Structure("object-attributes", $t->objectId, $t->textAttributeValues, $t->translatedTextAttributeValues, $t->optionAttributeValues); |
566 | 570 | $t->objectAttributes->setAttributeType($t->objectAttributesStructure); |
567 | 571 | $t->definedMeaningAttributes->setAttributeType($t->objectAttributesStructure); |
568 | 572 | |
569 | 573 | $t->annotatedAttributes = array( |
| 574 | + $t->definedMeaning, |
570 | 575 | $t->definition, |
571 | 576 | $t->synonymsAndTranslations, |
572 | 577 | $t->relations, |
573 | | - $t->reciprocalRelations |
| 578 | + $t->reciprocalRelations, |
| 579 | + $t->objectAttributes, |
| 580 | + $t->textAttributeValues, |
| 581 | + $t->translatedTextAttributeValues, |
| 582 | + $t->optionAttributeValues |
574 | 583 | ); |
575 | 584 | |
576 | 585 | foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) { |
— | — | @@ -581,9 +590,12 @@ |
582 | 591 | } |
583 | 592 | } |
584 | 593 | |
585 | | - protected function __set($key,$value) { |
| 594 | + protected function __set($key, $value) { |
586 | 595 | $attributes=&$this->attributes; |
587 | | - $attributes[$key]=$value; |
| 596 | + $attributes[$key] = $value; |
| 597 | + |
| 598 | + if ($value instanceof Attribute && !isset($GLOBALS[$key . "Attribute"])) |
| 599 | + throw new Exception("Could not find attribute global with key: " . $key); |
588 | 600 | } |
589 | 601 | |
590 | 602 | public function __get($key) { |
— | — | @@ -593,7 +605,4 @@ |
594 | 606 | } |
595 | 607 | return $attributes[$key]; |
596 | 608 | } |
597 | | -} |
598 | | - |
599 | | - |
600 | | - |
| 609 | +} |
\ No newline at end of file |
Index: trunk/extensions/Wikidata/OmegaWiki/Attribute.php |
— | — | @@ -42,9 +42,9 @@ |
43 | 43 | } |
44 | 44 | |
45 | 45 | class Structure { |
46 | | - |
47 | 46 | private $structure; |
48 | 47 | private $type; |
| 48 | + private $attributeIds; |
49 | 49 | |
50 | 50 | public function getAttributes() { |
51 | 51 | return $this->structure; |
— | — | @@ -52,6 +52,7 @@ |
53 | 53 | |
54 | 54 | public function addAttribute($attribute) { |
55 | 55 | $this->structure[]=$attribute; |
| 56 | + $this->attributeIds[] = $attribute->id; |
56 | 57 | } |
57 | 58 | |
58 | 59 | public function getStructureType() { |
— | — | @@ -75,7 +76,6 @@ |
76 | 77 | * |
77 | 78 | */ |
78 | 79 | public function __construct($argumentList) { |
79 | | - |
80 | 80 | # We're trying to be clever. |
81 | 81 | $args=func_get_args(); |
82 | 82 | $this->structure=null; |
— | — | @@ -111,7 +111,21 @@ |
112 | 112 | # WTF? |
113 | 113 | throw new Exception("Invalid structure constructor: ".print_r($args,true)); |
114 | 114 | } |
| 115 | + |
| 116 | + $this->attributeIds = array(); |
| 117 | + |
| 118 | + foreach ($this->structure as $attribute) |
| 119 | + $this->attributeIds[] = $attribute->id; |
115 | 120 | } |
| 121 | + |
| 122 | + public function __toString() { |
| 123 | + return "Structure(" . implode(", ", $this->attributeIds) . ")"; |
| 124 | + } |
| 125 | + |
| 126 | + public function supportsAttributeId($attributeId) { |
| 127 | + return true; |
| 128 | +// return in_array($attributeId, $this->attributeIds); |
| 129 | + } |
116 | 130 | } |
117 | 131 | |
118 | 132 | |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php |
— | — | @@ -524,10 +524,10 @@ |
525 | 525 | $definitionAttribute, $translatedTextAttribute, $objectAttributesAttribute; |
526 | 526 | |
527 | 527 | $definitionId = getDefinedMeaningDefinitionId($definedMeaningId); |
528 | | - $record = new ArrayRecord(new Structure($definitionAttribute)); |
| 528 | + $record = new ArrayRecord($definitionAttribute->type); |
529 | 529 | $record->setAttributeValue($translatedTextAttribute, getTranslatedContentValue($definitionId, $viewInformation)); |
530 | 530 | |
531 | | - $objectAttributesRecord = getObjectAttributesRecord($definitionId, $viewInformation, $objectAttributesAttribute->id); |
| 531 | + $objectAttributesRecord = getObjectAttributesRecord($definitionId, $viewInformation); |
532 | 532 | $record->setAttributeValue($objectAttributesAttribute, $objectAttributesRecord); |
533 | 533 | |
534 | 534 | applyPropertyToColumnFiltersToRecord($record, $objectAttributesRecord, $viewInformation); |
— | — | @@ -553,18 +553,14 @@ |
554 | 554 | } |
555 | 555 | } |
556 | 556 | |
557 | | -function getObjectAttributesRecord($objectId, ViewInformation $viewInformation, $structuralOverride = null) { |
| 557 | +function getObjectAttributesRecord($objectId, ViewInformation $viewInformation) { |
558 | 558 | global |
559 | 559 | $objectIdAttribute, |
560 | 560 | $linkAttributeValuesAttribute, $textAttributeValuesAttribute, |
561 | 561 | $translatedTextAttributeValuesAttribute, $optionAttributeValuesAttribute, |
562 | | - $definedMeaningAttributesAttribute; |
| 562 | + $objectAttributesStructure; |
563 | 563 | |
564 | | - if ($structuralOverride) |
565 | | - $record = new ArrayRecord(new Structure($structuralOverride, $definedMeaningAttributesAttribute)); |
566 | | - else |
567 | | - $record = new ArrayRecord(new Structure($definedMeaningAttributesAttribute)); |
568 | | - |
| 564 | + $record = new ArrayRecord($objectAttributesStructure); |
569 | 565 | $record->setAttributeValue($objectIdAttribute, $objectId); |
570 | 566 | $record->setAttributeValue($textAttributeValuesAttribute, getTextAttributesValuesRecordSet(array($objectId), $viewInformation)); |
571 | 567 | $record->setAttributeValue($translatedTextAttributeValuesAttribute, getTranslatedTextAttributeValuesRecordSet(array($objectId), $viewInformation)); |
— | — | @@ -739,21 +735,26 @@ |
740 | 736 | expandExpressionSpellingsInRecordSet($recordSet, array($expressionAttribute)); |
741 | 737 | |
742 | 738 | expandObjectAttributesAttribute($recordSet, $objectAttributesAttribute, $syntransIdAttribute, $viewInformation); |
| 739 | + |
743 | 740 | return $recordSet; |
744 | 741 | } |
745 | 742 | |
746 | | -function expandObjectAttributesAttribute(RecordSet $recordSet, Attribute $attributeToExpand, Attribute $objectIdAttribute, ViewInformation $viewInformation) { |
| 743 | +function expandObjectAttributesAttribute(RecordSet $recordSet, Attribute $attributeToExpand, Attribute $objectIdAttributeInRecordSet, ViewInformation $viewInformation) { |
747 | 744 | global |
748 | 745 | $textAttributeObjectAttribute, $textAttributeValuesAttribute, |
749 | 746 | $attributeObjectAttribute, $translatedTextAttributeValuesAttribute, |
750 | 747 | $linkAttributeObjectAttribute, $linkAttributeValuesAttribute, |
751 | | - $optionAttributeObjectAttribute, $optionAttributeValuesAttribute; |
| 748 | + $optionAttributeObjectAttribute, $optionAttributeValuesAttribute, |
| 749 | + $objectIdAttribute; |
752 | 750 | |
753 | 751 | $recordSetStructure = $recordSet->getStructure(); |
754 | 752 | $recordSetStructure->addAttribute($attributeToExpand); |
| 753 | + |
| 754 | + foreach ($viewInformation->getPropertyToColumnFilters() as $propertyToColumnFilter) |
| 755 | + $recordSetStructure->addAttribute($propertyToColumnFilter->getAttribute()); |
755 | 756 | |
756 | 757 | $objectAttributesRecordStructure = $attributeToExpand->type; |
757 | | - $objectIds = getUniqueIdsInRecordSet($recordSet, array($objectIdAttribute)); |
| 758 | + $objectIds = getUniqueIdsInRecordSet($recordSet, array($objectIdAttributeInRecordSet)); |
758 | 759 | |
759 | 760 | if (count($objectIds) > 0) { |
760 | 761 | for ($i = 0; $i < count($objectIds); $i++) |
— | — | @@ -805,7 +806,7 @@ |
806 | 807 | |
807 | 808 | for ($i = 0; $i < $recordSet->getRecordCount(); $i++) { |
808 | 809 | $record = $recordSet->getRecord($i); |
809 | | - $objectId = $record->getAttributeValue($objectIdAttribute); |
| 810 | + $objectId = $record->getAttributeValue($objectIdAttributeInRecordSet); |
810 | 811 | |
811 | 812 | // Text attributes |
812 | 813 | if (isset($textAttributeValuesRecordSets[$objectId])) |
— | — | @@ -970,6 +971,7 @@ |
971 | 972 | ); |
972 | 973 | |
973 | 974 | $recordSet->getStructure()->addAttribute($collectionMeaningAttribute); |
| 975 | + $recordSet->getStructure()->addAttribute($gotoSourceAttribute); |
974 | 976 | |
975 | 977 | for ($i = 0; $i < $recordSet->getRecordCount(); $i++) { |
976 | 978 | $record = $recordSet->getRecord($i); |
— | — | @@ -1088,7 +1090,7 @@ |
1089 | 1091 | |
1090 | 1092 | function getOptionAttributeValuesRecordSet(array $objectIds, ViewInformation $viewInformation) { |
1091 | 1093 | global |
1092 | | - $optionAttributeIdAttribute, $optionAttributeObjectAttribute, $optionAttributeOptionIdAttribute, $optionAttributeAttribute,$optionAttributeOptionAttribute, $optionAttributeValuesTable, $objectAttributesAttribute, |
| 1094 | + $optionAttributeIdAttribute, $optionAttributeObjectAttribute, $optionAttributeOptionIdAttribute, $optionAttributeAttribute, $optionAttributeOptionAttribute, $optionAttributeValuesTable, $objectAttributesAttribute, |
1093 | 1095 | $optionAttributeValuesStructure; |
1094 | 1096 | |
1095 | 1097 | $recordSet = queryRecordSet( |
— | — | @@ -1104,6 +1106,9 @@ |
1105 | 1107 | array("object_id IN (" . implode(", ", $objectIds) . ")") |
1106 | 1108 | ); |
1107 | 1109 | |
| 1110 | + $recordSet->getStructure()->addAttribute($optionAttributeAttribute); |
| 1111 | + $recordSet->getStructure()->addAttribute($optionAttributeOptionAttribute); |
| 1112 | + |
1108 | 1113 | expandOptionsInRecordSet($recordSet, $viewInformation); |
1109 | 1114 | expandDefinedMeaningReferencesInRecordSet($recordSet, array($optionAttributeAttribute, $optionAttributeOptionAttribute)); |
1110 | 1115 | expandObjectAttributesAttribute($recordSet, $objectAttributesAttribute, $optionAttributeIdAttribute, $viewInformation); |
— | — | @@ -1177,7 +1182,6 @@ |
1178 | 1183 | } |
1179 | 1184 | |
1180 | 1185 | function getDefiningExpressionRecord($definedMeaningId) { |
1181 | | - |
1182 | 1186 | global |
1183 | 1187 | $definedMeaningCompleteDefiningExpressionAttribute, |
1184 | 1188 | $definedMeaningDefiningExpressionAttribute, |
— | — | @@ -1185,7 +1189,7 @@ |
1186 | 1190 | |
1187 | 1191 | $o=OmegaWikiAttributes::getInstance(); |
1188 | 1192 | |
1189 | | - $definingExpression=definingExpressionRow($definedMeaningId); |
| 1193 | + $definingExpression = definingExpressionRow($definedMeaningId); |
1190 | 1194 | $definingExpressionRecord = new ArrayRecord($definedMeaningCompleteDefiningExpressionAttribute->type); |
1191 | 1195 | $definingExpressionRecord->setAttributeValue($expressionIdAttribute, $definingExpression[0]); |
1192 | 1196 | $definingExpressionRecord->setAttributeValue($definedMeaningDefiningExpressionAttribute, $definingExpression[1]); |
Index: trunk/extensions/Wikidata/OmegaWiki/Record.php |
— | — | @@ -25,9 +25,23 @@ |
26 | 26 | return $this->structure; |
27 | 27 | } |
28 | 28 | |
| 29 | + protected function getValueForAttributeId($attributeId) { |
| 30 | + if ($this->structure->supportsAttributeId($attributeId)) { |
| 31 | + if (isset($this->values[$attributeId])) |
| 32 | + return $this->values[$attributeId]; |
| 33 | + else |
| 34 | + return null; |
| 35 | + } |
| 36 | + else |
| 37 | + throw new Exception( |
| 38 | + "Record does not support attribute!\n" . |
| 39 | + " Attribute id: " . $attributeId . "\n" . |
| 40 | + " Structure: " . $this->structure |
| 41 | + ); |
| 42 | + } |
| 43 | + |
29 | 44 | public function getAttributeValue(Attribute $attribute) { |
30 | | - #FIXME: check if valid |
31 | | - return @$this->values[$attribute->id]; |
| 45 | + return $this->getValueForAttributeId($attribute->id); |
32 | 46 | } |
33 | 47 | |
34 | 48 | /** |
— | — | @@ -63,9 +77,19 @@ |
64 | 78 | return $result; |
65 | 79 | } |
66 | 80 | |
| 81 | + protected function setValueForAttributeId($attributeId, $value) { |
| 82 | + if ($this->structure->supportsAttributeId($attributeId)) |
| 83 | + $this->values[$attributeId] = $value; |
| 84 | + else |
| 85 | + throw new Exception( |
| 86 | + "Record does not support attribute!\n" . |
| 87 | + " Attribute id: " . $attributeId . "\n" . |
| 88 | + " Structure: " .$this->structure |
| 89 | + ); |
| 90 | + } |
| 91 | + |
67 | 92 | public function setAttributeValue(Attribute $attribute, $value) { |
68 | | - #FIXME: check if valid |
69 | | - @$this->values[$attribute->id] = $value; |
| 93 | + $this->setValueForAttributeId($attribute->id, $value); |
70 | 94 | } |
71 | 95 | |
72 | 96 | /** |
— | — | @@ -75,8 +99,9 @@ |
76 | 100 | */ |
77 | 101 | public function setAttributeValuesByOrder($values) { |
78 | 102 | $atts=$this->structure->getAttributes(); |
| 103 | + |
79 | 104 | for ($i = 0; $i < count($atts); $i++) |
80 | | - $this->values[$atts[$i]->id] = $values[$i]; |
| 105 | + $this->setValueForAttributeId($atts[$i]->id, $values[$i]); |
81 | 106 | } |
82 | 107 | |
83 | 108 | /* |
— | — | @@ -86,7 +111,7 @@ |
87 | 112 | */ |
88 | 113 | public function setSubRecord(Record $record) { |
89 | 114 | foreach($record->getStructure()->getAttributes() as $attribute) |
90 | | - $this->values[$attribute->id] = $record->getAttributeValue($attribute); |
| 115 | + $this->setValueForAttributeId($attribute->id, $record->getAttributeValue($attribute)); |
91 | 116 | } |
92 | 117 | |
93 | 118 | /** |
Index: trunk/extensions/Wikidata/OmegaWiki/DefinedMeaningModel.php |
— | — | @@ -144,7 +144,7 @@ |
145 | 145 | $o=OmegaWikiAttributes::getInstance(); |
146 | 146 | |
147 | 147 | $record = new ArrayRecord($o->definedMeaning->type); |
148 | | - $record->definedMeaningCompleteDefiningExpression = getDefiningExpressionRecord($id); |
| 148 | + $record->definedMeaningCompleteDefiningExpression = getDefiningExpressionRecord($id); |
149 | 149 | $record->definition = getDefinedMeaningDefinitionRecord($id, $view); |
150 | 150 | $record->classAttributes = getClassAttributesRecordSet($id, $view); |
151 | 151 | $record->alternativeDefinitions = getAlternativeDefinitionsRecordSet($id, $view); |
— | — | @@ -167,6 +167,7 @@ |
168 | 168 | |
169 | 169 | $this->record=$record; |
170 | 170 | $this->recordIsLoaded=true; |
| 171 | + |
171 | 172 | return true; |
172 | 173 | } |
173 | 174 | |
Index: trunk/extensions/Wikidata/OmegaWiki/Editor.php |
— | — | @@ -1288,15 +1288,13 @@ |
1289 | 1289 | |
1290 | 1290 | public function add(IdStack $idPath) { |
1291 | 1291 | if ($this->isAddField) { |
1292 | | - global |
1293 | | - $syntransIdAttribute; |
1294 | | - |
1295 | | - $syntransId = $idPath->getKeyStack()->peek(0)->getAttributeValue($syntransIdAttribute); |
| 1292 | + $objectId = $this->objectIdFetcher->fetch($idPath->getKeyStack()); |
1296 | 1293 | $parameters = array( |
1297 | 1294 | 'attributesLevel' => $this->attributesLevelName, |
1298 | | - 'attributesObjectId' => $this->objectIdFetcher->fetch($idPath->getKeyStack()), |
1299 | | - 'onUpdate' => 'updateSelectOptions(\'' . $this->addId($idPath->getId()) . '-option\',' . $syntransId |
| 1295 | + 'attributesObjectId' => $objectId, |
| 1296 | + 'onUpdate' => 'updateSelectOptions(\'' . $this->addId($idPath->getId()) . '-option\',' . $objectId |
1300 | 1297 | ); |
| 1298 | + |
1301 | 1299 | return getSuggest($this->addId($idPath->getId()), $this->suggestType(), $parameters); |
1302 | 1300 | } |
1303 | 1301 | else |