Index: trunk/extensions/Wikidata/OmegaWiki/SpecialSuggest.php |
— | — | @@ -412,18 +412,18 @@ |
413 | 413 | |
414 | 414 | function getSQLForLevels($language="<ANY>") { |
415 | 415 | global |
416 | | - $definedMeaningTable, $expressionTable, $bootstrappedDefinedMeaningsTable, $classAttributeLevels; |
| 416 | + $classAttributeLevels, $dataSet; |
417 | 417 | |
418 | 418 | $o=OmegaWikiAttributes::getInstance(); |
419 | 419 | // TO DO: Add support for multiple languages here |
420 | 420 | return |
421 | 421 | selectLatest( |
422 | | - array($bootstrappedDefinedMeaningsTable->definedMeaningId, $expressionTable->spelling), |
423 | | - array($definedMeaningTable, $expressionTable, $bootstrappedDefinedMeaningsTable), |
| 422 | + array($dataSet->bootstrappedDefinedMeanings->definedMeaningId, $dataSet->expression->spelling), |
| 423 | + array($dataSet->definedMeaning, $dataSet->expression, $dataSet->bootstrappedDefinedMeanings), |
424 | 424 | array( |
425 | 425 | 'name IN (' . implodeFixed($classAttributeLevels) . ')', |
426 | | - equals($definedMeaningTable->definedMeaningId, $bootstrappedDefinedMeaningsTable->definedMeaningId), |
427 | | - equals($definedMeaningTable->expressionId, $expressionTable->expressionId) |
| 426 | + equals($dataSet->definedMeaning->definedMeaningId, $dataSet->bootstrappedDefinedMeanings->definedMeaningId), |
| 427 | + equals($dataSet->definedMeaning->expressionId, $dataSet->expression->expressionId) |
428 | 428 | ) |
429 | 429 | ); |
430 | 430 | } |
Index: trunk/extensions/Wikidata/OmegaWiki/SpecialTransaction.php |
— | — | @@ -344,11 +344,10 @@ |
345 | 345 | } |
346 | 346 | |
347 | 347 | function getTransactionRecordSet($fromTransactionId, $transactionCount, $userName) { |
348 | | - |
349 | | - $o=OmegaWikiAttributes::getInstance(); |
350 | 348 | global |
351 | | - $transactionsTable; |
| 349 | + $dataSet; |
352 | 350 | |
| 351 | + $o=OmegaWikiAttributes::getInstance(); |
353 | 352 | $dc=wdGetDataSetContext(); |
354 | 353 | $queryTransactionInformation = new QueryLatestTransactionInformation(); |
355 | 354 | |
— | — | @@ -364,7 +363,7 @@ |
365 | 364 | new TableColumnsToAttributesMapping( |
366 | 365 | new TableColumnsToAttribute(array('transaction_id'), $o->transactionId) |
367 | 366 | ), |
368 | | - $transactionsTable, |
| 367 | + $dataSet->transactions, |
369 | 368 | $restrictions, |
370 | 369 | array('transaction_id DESC'), |
371 | 370 | $transactionCount |
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataAPI.php |
— | — | @@ -1452,28 +1452,27 @@ |
1453 | 1453 | $dbr =& wfGetDB(DB_SLAVE); |
1454 | 1454 | |
1455 | 1455 | global |
1456 | | - $wgDefaultClassMids, |
1457 | | - $classAttributesTable, $bootstrappedDefinedMeaningsTable, $classMembershipsTable; |
| 1456 | + $wgDefaultClassMids, $dataSet; |
1458 | 1457 | |
1459 | 1458 | $queryResult = $dbr->query( |
1460 | 1459 | SelectLatestDistinct( |
1461 | 1460 | array( |
1462 | | - $classAttributesTable->attributeMid, |
1463 | | - $classAttributesTable->attributeType, |
1464 | | - $bootstrappedDefinedMeaningsTable->name |
| 1461 | + $dataSet->classAttributes->attributeMid, |
| 1462 | + $dataSet->classAttributes->attributeType, |
| 1463 | + $dataSet->bootstrappedDefinedMeanings->name |
1465 | 1464 | ), |
1466 | | - array($classAttributesTable, $bootstrappedDefinedMeaningsTable), |
| 1465 | + array($dataSet->classAttributes, $dataSet->bootstrappedDefinedMeanings), |
1467 | 1466 | array( |
1468 | | - equals($classAttributesTable->levelMid, $bootstrappedDefinedMeaningsTable->definedMeaningId), |
| 1467 | + equals($dataSet->classAttributes->levelMid, $dataSet->bootstrappedDefinedMeanings->definedMeaningId), |
1469 | 1468 | sqlOr( |
1470 | | - in($classAttributesTable->classMid, |
| 1469 | + in($dataSet->classAttributes->classMid, |
1471 | 1470 | selectLatest( |
1472 | | - array($classMembershipsTable->classMid), |
1473 | | - array($classMembershipsTable), |
1474 | | - array(equals($classMembershipsTable->classMemberMid, $definedMeaningId)) |
| 1471 | + array($dataSet->classMemberships->classMid), |
| 1472 | + array($dataSet->classMemberships), |
| 1473 | + array(equals($dataSet->classMemberships->classMemberMid, $definedMeaningId)) |
1475 | 1474 | ) |
1476 | 1475 | ), |
1477 | | - inArray($classAttributesTable->classMid, $wgDefaultClassMids) |
| 1476 | + inArray($dataSet->classAttributes->classMid, $wgDefaultClassMids) |
1478 | 1477 | ) |
1479 | 1478 | ) |
1480 | 1479 | ) |
Index: trunk/extensions/Wikidata/OmegaWiki/OmegaWikiRecordSets.php |
— | — | @@ -83,8 +83,6 @@ |
84 | 84 | |
85 | 85 | function fetchDefinedMeaningReferenceRecords($sql, array &$definedMeaningIds, array &$definedMeaningReferenceRecords, $usedAs='defined-meaning') { |
86 | 86 | $dc=wdGetDataSetContext(); |
87 | | - |
88 | | - |
89 | 87 | $o=OmegaWikiAttributes::getInstance(); |
90 | 88 | |
91 | 89 | $foundDefinedMeaningIds = array(); |
— | — | @@ -255,7 +253,6 @@ |
256 | 254 | } |
257 | 255 | |
258 | 256 | function getExpressionReferenceRecords($expressionIds) { |
259 | | - |
260 | 257 | $o=OmegaWikiAttributes::getInstance(); |
261 | 258 | $dc=wdGetDataSetContext(); |
262 | 259 | |
— | — | @@ -397,7 +394,6 @@ |
398 | 395 | } |
399 | 396 | |
400 | 397 | function getExpressionMeaningsRecordSet($expressionId, $exactMeaning, ViewInformation $viewInformation) { |
401 | | - |
402 | 398 | $o=OmegaWikiAttributes::getInstance(); |
403 | 399 | |
404 | 400 | $dc=wdGetDataSetContext(); |
— | — | @@ -428,7 +424,6 @@ |
429 | 425 | } |
430 | 426 | |
431 | 427 | function getExpressionMeaningsRecord($expressionId, ViewInformation $viewInformation) { |
432 | | - |
433 | 428 | $o=OmegaWikiAttributes::getInstance(); |
434 | 429 | |
435 | 430 | $record = new ArrayRecord($o->expressionMeaningsStructure); |
— | — | @@ -439,7 +434,6 @@ |
440 | 435 | } |
441 | 436 | |
442 | 437 | function getExpressionsRecordSet($spelling, ViewInformation $viewInformation, $dc=null) { |
443 | | - |
444 | 438 | $dc=wdGetDataSetContext($dc); |
445 | 439 | $o=OmegaWikiAttributes::getInstance(); |
446 | 440 | |
— | — | @@ -503,10 +497,10 @@ |
504 | 498 | |
505 | 499 | |
506 | 500 | function getClassAttributesRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
| 501 | + global |
| 502 | + $dataSet; |
507 | 503 | |
508 | 504 | $o=OmegaWikiAttributes::getInstance(); |
509 | | - global |
510 | | - $classAttributesTable; |
511 | 505 | |
512 | 506 | $recordSet = queryRecordSet( |
513 | 507 | $o->classAttributesStructure->getStructureType(), |
— | — | @@ -518,7 +512,7 @@ |
519 | 513 | new TableColumnsToAttribute(array('attribute_mid'), $o->classAttributeAttribute), |
520 | 514 | new TableColumnsToAttribute(array('attribute_type'),$o->classAttributeType) |
521 | 515 | ), |
522 | | - $classAttributesTable, |
| 516 | + $dataSet->classAttributes, |
523 | 517 | array("class_mid=$definedMeaningId") |
524 | 518 | ); |
525 | 519 | |
— | — | @@ -540,10 +534,10 @@ |
541 | 535 | } |
542 | 536 | |
543 | 537 | function getAlternativeDefinitionsRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
| 538 | + global |
| 539 | + $dataSet; |
544 | 540 | |
545 | 541 | $o=OmegaWikiAttributes::getInstance(); |
546 | | - global |
547 | | - $alternativeDefinitionsTable; |
548 | 542 | |
549 | 543 | $recordSet = queryRecordSet( |
550 | 544 | $o->alternativeDefinitionsStructure->getStructureType(), |
— | — | @@ -553,7 +547,7 @@ |
554 | 548 | new TableColumnsToAttribute(array('meaning_text_tcid'), $o->definitionId), |
555 | 549 | new TableColumnsToAttribute(array('source_id'), $o->source) |
556 | 550 | ), |
557 | | - $alternativeDefinitionsTable, |
| 551 | + $dataSet->alternativeDefinitions, |
558 | 552 | array("meaning_mid=$definedMeaningId") |
559 | 553 | ); |
560 | 554 | |
— | — | @@ -566,7 +560,6 @@ |
567 | 561 | } |
568 | 562 | |
569 | 563 | function getDefinedMeaningDefinitionRecord($definedMeaningId, ViewInformation $viewInformation) { |
570 | | - |
571 | 564 | $o=OmegaWikiAttributes::getInstance(); |
572 | 565 | |
573 | 566 | $definitionId = getDefinedMeaningDefinitionId($definedMeaningId); |
— | — | @@ -697,7 +690,7 @@ |
698 | 691 | |
699 | 692 | function getTranslatedContentRecordSet($translatedContentId, ViewInformation $viewInformation) { |
700 | 693 | global |
701 | | - $translatedContentTable; |
| 694 | + $dataSet; |
702 | 695 | |
703 | 696 | $o=OmegaWikiAttributes::getInstance(); |
704 | 697 | |
— | — | @@ -709,7 +702,7 @@ |
710 | 703 | new TableColumnsToAttribute(array('language_id'), $o->language), |
711 | 704 | new TableColumnsToAttribute(array('text_id'), $o->text) |
712 | 705 | ), |
713 | | - $translatedContentTable, |
| 706 | + $dataSet->translatedContent, |
714 | 707 | array("translated_content_id=$translatedContentId") |
715 | 708 | ); |
716 | 709 | |
— | — | @@ -720,7 +713,7 @@ |
721 | 714 | |
722 | 715 | function getFilteredTranslatedContentRecordSet($translatedContentId, ViewInformation $viewInformation) { |
723 | 716 | global |
724 | | - $translatedContentTable; |
| 717 | + $dataSet; |
725 | 718 | |
726 | 719 | $o=OmegaWikiAttributes::getInstance(); |
727 | 720 | |
— | — | @@ -732,7 +725,7 @@ |
733 | 726 | new TableColumnsToAttribute(array('language_id'), $o->language), |
734 | 727 | new TableColumnsToAttribute(array('text_id'), $o->text) |
735 | 728 | ), |
736 | | - $translatedContentTable, |
| 729 | + $dataSet->translatedContent, |
737 | 730 | array( |
738 | 731 | "translated_content_id=$translatedContentId", |
739 | 732 | "language_id=" . $viewInformation->filterLanguageId |
— | — | @@ -745,12 +738,12 @@ |
746 | 739 | } |
747 | 740 | |
748 | 741 | function getSynonymAndTranslationRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
749 | | - |
750 | | - $o=OmegaWikiAttributes::getInstance(); |
751 | 742 | global |
752 | | - $syntransTable; |
| 743 | + $dataSet; |
753 | 744 | |
| 745 | + $o=OmegaWikiAttributes::getInstance(); |
754 | 746 | $dc=wdGetDataSetContext(); |
| 747 | + |
755 | 748 | $restrictions = array("defined_meaning_id=$definedMeaningId"); |
756 | 749 | if ($viewInformation->filterLanguageId != 0) |
757 | 750 | $restrictions[] = |
— | — | @@ -771,7 +764,7 @@ |
772 | 765 | new TableColumnsToAttribute(array('expression_id'), $o->expression), |
773 | 766 | new TableColumnsToAttribute(array('identical_meaning'),$o->identicalMeaning) |
774 | 767 | ), |
775 | | - $syntransTable, |
| 768 | + $dataSet->syntrans, |
776 | 769 | $restrictions |
777 | 770 | ); |
778 | 771 | |
— | — | @@ -785,7 +778,6 @@ |
786 | 779 | } |
787 | 780 | |
788 | 781 | function expandObjectAttributesAttribute(RecordSet $recordSet, Attribute $attributeToExpand, Attribute $objectIdAttribute, ViewInformation $viewInformation) { |
789 | | - |
790 | 782 | $o=OmegaWikiAttributes::getInstance(); |
791 | 783 | |
792 | 784 | $recordSetStructure = $recordSet->getStructure(); |
— | — | @@ -904,7 +896,6 @@ |
905 | 897 | } |
906 | 898 | |
907 | 899 | function getDefinedMeaningReferenceRecord($definedMeaningId) { |
908 | | - |
909 | 900 | $o=OmegaWikiAttributes::getInstance(); |
910 | 901 | |
911 | 902 | $record = new ArrayRecord($o->definedMeaningReferenceStructure); |
— | — | @@ -917,7 +908,7 @@ |
918 | 909 | |
919 | 910 | function getDefinedMeaningAttributeValuesRecordSet(array $objectIds, ViewInformation $viewInformation) { |
920 | 911 | global |
921 | | - $meaningRelationsTable; |
| 912 | + $dataSet; |
922 | 913 | |
923 | 914 | $o=OmegaWikiAttributes::getInstance(); |
924 | 915 | |
— | — | @@ -930,7 +921,7 @@ |
931 | 922 | new TableColumnsToAttribute(array('relationtype_mid'), $o->relationType), |
932 | 923 | new TableColumnsToAttribute(array('meaning2_mid'), $o->otherDefinedMeaning) |
933 | 924 | ), |
934 | | - $meaningRelationsTable, |
| 925 | + $dataSet->meaningRelations, |
935 | 926 | array("meaning1_mid IN (" . implode(", ", $objectIds) . ")"), |
936 | 927 | array('add_transaction_id') |
937 | 928 | ); |
— | — | @@ -942,11 +933,10 @@ |
943 | 934 | } |
944 | 935 | |
945 | 936 | function getDefinedMeaningReciprocalRelationsRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
946 | | - |
947 | | - $o=OmegaWikiAttributes::getInstance(); |
948 | 937 | global |
949 | | - $meaningRelationsTable; |
| 938 | + $dataSet; |
950 | 939 | |
| 940 | + $o=OmegaWikiAttributes::getInstance(); |
951 | 941 | $recordSet = queryRecordSet( |
952 | 942 | $o->reciprocalRelations->id, |
953 | 943 | $viewInformation->queryTransactionInformation, |
— | — | @@ -956,7 +946,7 @@ |
957 | 947 | new TableColumnsToAttribute(array('relationtype_mid'), $o->relationType), |
958 | 948 | new TableColumnsToAttribute(array('meaning1_mid'), $o->otherDefinedMeaning) |
959 | 949 | ), |
960 | | - $meaningRelationsTable, |
| 950 | + $dataSet->meaningRelations, |
961 | 951 | array("meaning2_mid=$definedMeaningId"), |
962 | 952 | array('relationtype_mid') |
963 | 953 | ); |
— | — | @@ -979,7 +969,7 @@ |
980 | 970 | |
981 | 971 | function getDefinedMeaningCollectionMembershipRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
982 | 972 | global |
983 | | - $collectionMembershipsTable; |
| 973 | + $dataSet; |
984 | 974 | |
985 | 975 | $o=OmegaWikiAttributes::getInstance(); |
986 | 976 | |
— | — | @@ -991,7 +981,7 @@ |
992 | 982 | new TableColumnsToAttribute(array('collection_id'), $o->collectionId), |
993 | 983 | new TableColumnsToAttribute(array('internal_member_id'), $o->sourceIdentifier) |
994 | 984 | ), |
995 | | - $collectionMembershipsTable, |
| 985 | + $dataSet->collectionMemberships, |
996 | 986 | array("member_mid=$definedMeaningId") |
997 | 987 | ); |
998 | 988 | |
— | — | @@ -1011,10 +1001,10 @@ |
1012 | 1002 | } |
1013 | 1003 | |
1014 | 1004 | function getTextAttributesValuesRecordSet(array $objectIds, ViewInformation $viewInformation) { |
| 1005 | + global |
| 1006 | + $dataSet; |
1015 | 1007 | |
1016 | 1008 | $o=OmegaWikiAttributes::getInstance(); |
1017 | | - global |
1018 | | - $textAttributeValuesTable; |
1019 | 1009 | |
1020 | 1010 | $recordSet = queryRecordSet( |
1021 | 1011 | $o->textAttributeValuesStructure->getStructureType(), |
— | — | @@ -1026,7 +1016,7 @@ |
1027 | 1017 | new TableColumnsToAttribute(array('attribute_mid'), $o->textAttribute), |
1028 | 1018 | new TableColumnsToAttribute(array('text'), $o->text) |
1029 | 1019 | ), |
1030 | | - $textAttributeValuesTable, |
| 1020 | + $dataSet->textAttributeValues, |
1031 | 1021 | array("object_id IN (" . implode(", ", $objectIds) . ")") |
1032 | 1022 | ); |
1033 | 1023 | |
— | — | @@ -1037,11 +1027,10 @@ |
1038 | 1028 | } |
1039 | 1029 | |
1040 | 1030 | function getLinkAttributeValuesRecordSet(array $objectIds, ViewInformation $viewInformation) { |
1041 | | - |
1042 | | - $o=OmegaWikiAttributes::getInstance(); |
1043 | 1031 | global |
1044 | | - $linkAttributeValuesTable; |
| 1032 | + $dataSet; |
1045 | 1033 | |
| 1034 | + $o=OmegaWikiAttributes::getInstance(); |
1046 | 1035 | $recordSet = queryRecordSet( |
1047 | 1036 | $o->linkAttributeValuesStructure->getStructureType(), |
1048 | 1037 | $viewInformation->queryTransactionInformation, |
— | — | @@ -1052,7 +1041,7 @@ |
1053 | 1042 | new TableColumnsToAttribute(array('attribute_mid'), $o->linkAttribute), |
1054 | 1043 | new TableColumnsToAttribute(array('label', 'url'), $o->link) |
1055 | 1044 | ), |
1056 | | - $linkAttributeValuesTable, |
| 1045 | + $dataSet->linkAttributeValues, |
1057 | 1046 | array("object_id IN (" . implode(", ", $objectIds) . ")") |
1058 | 1047 | ); |
1059 | 1048 | |
— | — | @@ -1063,10 +1052,10 @@ |
1064 | 1053 | } |
1065 | 1054 | |
1066 | 1055 | function getTranslatedTextAttributeValuesRecordSet(array $objectIds, ViewInformation $viewInformation) { |
| 1056 | + global |
| 1057 | + $dataSet; |
1067 | 1058 | |
1068 | 1059 | $o=OmegaWikiAttributes::getInstance(); |
1069 | | - global |
1070 | | - $translatedContentAttributeValuesTable; |
1071 | 1060 | |
1072 | 1061 | $recordSet = queryRecordSet( |
1073 | 1062 | $o->translatedTextAttributeValuesStructure->getStructureType(), |
— | — | @@ -1078,7 +1067,7 @@ |
1079 | 1068 | new TableColumnsToAttribute(array('attribute_mid'), $o->translatedTextAttribute), |
1080 | 1069 | new TableColumnsToAttribute(array('value_tcid'), $o->translatedTextValueId) |
1081 | 1070 | ), |
1082 | | - $translatedContentAttributeValuesTable, |
| 1071 | + $dataSet->translatedContentAttributeValues, |
1083 | 1072 | array("object_id IN (" . implode(", ", $objectIds) . ")") |
1084 | 1073 | ); |
1085 | 1074 | |
— | — | @@ -1091,10 +1080,8 @@ |
1092 | 1081 | } |
1093 | 1082 | |
1094 | 1083 | function getOptionAttributeOptionsRecordSet($attributeId, ViewInformation $viewInformation) { |
1095 | | - |
1096 | | - $o=OmegaWikiAttributes::getInstance(); |
1097 | 1084 | global |
1098 | | - $optionAttributeOptionsTable; |
| 1085 | + $dataSet; |
1099 | 1086 | |
1100 | 1087 | $o=OmegaWikiAttributes::getInstance(); |
1101 | 1088 | $recordSet = queryRecordSet( |
— | — | @@ -1107,7 +1094,7 @@ |
1108 | 1095 | new TableColumnsToAttribute(array('option_mid'), $o->optionAttributeOption), |
1109 | 1096 | new TableColumnsToAttribute(array('language_id'), $o->language) |
1110 | 1097 | ), |
1111 | | - $optionAttributeOptionsTable, |
| 1098 | + $dataSet->optionAttributeOptions, |
1112 | 1099 | array('attribute_id = ' . $attributeId) |
1113 | 1100 | ); |
1114 | 1101 | |
— | — | @@ -1117,11 +1104,10 @@ |
1118 | 1105 | } |
1119 | 1106 | |
1120 | 1107 | function getOptionAttributeValuesRecordSet(array $objectIds, ViewInformation $viewInformation) { |
1121 | | - |
1122 | | - $o=OmegaWikiAttributes::getInstance(); |
1123 | 1108 | global |
1124 | | - $optionAttributeValuesTable; |
| 1109 | + $dataSet; |
1125 | 1110 | |
| 1111 | + $o=OmegaWikiAttributes::getInstance(); |
1126 | 1112 | $recordSet = queryRecordSet( |
1127 | 1113 | $o->optionAttributeValuesStructure->getStructureType(), |
1128 | 1114 | $viewInformation->queryTransactionInformation, |
— | — | @@ -1131,7 +1117,7 @@ |
1132 | 1118 | new TableColumnsToAttribute(array('object_id'), $o->optionAttributeObject), |
1133 | 1119 | new TableColumnsToAttribute(array('option_id'), $o->optionAttributeOptionId) |
1134 | 1120 | ), |
1135 | | - $optionAttributeValuesTable, |
| 1121 | + $dataSet->optionAttributeValues, |
1136 | 1122 | array("object_id IN (" . implode(", ", $objectIds) . ")") |
1137 | 1123 | ); |
1138 | 1124 | |
— | — | @@ -1144,10 +1130,10 @@ |
1145 | 1131 | |
1146 | 1132 | /* XXX: This can probably be combined with other functions. In fact, it probably should be. Do it. */ |
1147 | 1133 | function expandOptionsInRecordSet(RecordSet $recordSet, ViewInformation $viewInformation) { |
| 1134 | + global |
| 1135 | + $dataSet; |
1148 | 1136 | |
1149 | 1137 | $o=OmegaWikiAttributes::getInstance(); |
1150 | | - global |
1151 | | - $optionAttributeOptionsTable, $classAttributesTable; |
1152 | 1138 | |
1153 | 1139 | $recordSet->getStructure()->addAttribute($o->optionAttributeOption); |
1154 | 1140 | $recordSet->getStructure()->addAttribute($o->optionAttribute); |
— | — | @@ -1163,7 +1149,7 @@ |
1164 | 1150 | new TableColumnsToAttribute(array('attribute_id'), $o->optionAttributeId), |
1165 | 1151 | new TableColumnsToAttribute(array('option_mid'), $o->optionAttributeOption) |
1166 | 1152 | ), |
1167 | | - $optionAttributeOptionsTable, |
| 1153 | + $dataSet->optionAttributeOptions, |
1168 | 1154 | array('option_id = ' . $record->optionAttributeOptionId) |
1169 | 1155 | ); |
1170 | 1156 | |
— | — | @@ -1175,7 +1161,7 @@ |
1176 | 1162 | $viewInformation->queryTransactionInformation, |
1177 | 1163 | $o->optionAttributeId, |
1178 | 1164 | new TableColumnsToAttributesMapping(new TableColumnsToAttribute(array('attribute_mid'), $o->optionAttribute)), |
1179 | | - $classAttributesTable, |
| 1165 | + $dataSet->classAttributes, |
1180 | 1166 | array('object_id = ' . $optionRecord->optionAttributeId) |
1181 | 1167 | ); |
1182 | 1168 | |
— | — | @@ -1185,10 +1171,10 @@ |
1186 | 1172 | } |
1187 | 1173 | |
1188 | 1174 | function getDefinedMeaningClassMembershipRecordSet($definedMeaningId, ViewInformation $viewInformation) { |
| 1175 | + global |
| 1176 | + $dataSet; |
1189 | 1177 | |
1190 | 1178 | $o=OmegaWikiAttributes::getInstance(); |
1191 | | - global |
1192 | | - $classMembershipsTable; |
1193 | 1179 | |
1194 | 1180 | $recordSet = queryRecordSet( |
1195 | 1181 | $o->classMembershipStructure->getStructureType(), |
— | — | @@ -1198,7 +1184,7 @@ |
1199 | 1185 | new TableColumnsToAttribute(array('class_membership_id'), $o->classMembershipId), |
1200 | 1186 | new TableColumnsToAttribute(array('class_mid'), $o->class) |
1201 | 1187 | ), |
1202 | | - $classMembershipsTable, |
| 1188 | + $dataSet->classMemberships, |
1203 | 1189 | array("class_member_mid=$definedMeaningId") |
1204 | 1190 | ); |
1205 | 1191 | |
Index: trunk/extensions/Wikidata/OmegaWiki/WikiDataTables.php |
— | — | @@ -82,15 +82,13 @@ |
83 | 83 | public $columns; |
84 | 84 | |
85 | 85 | public function __construct($identifier, $isVersioned) { |
86 | | - # Without dataset prefix! |
87 | 86 | $this->identifier = $identifier; |
88 | 87 | $this->isVersioned = $isVersioned; |
89 | 88 | $this->columns = array(); |
90 | 89 | } |
91 | 90 | |
92 | 91 | public function getIdentifier() { |
93 | | - $dc = wdGetDataSetContext(); |
94 | | - return "{$dc}_" . $this->identifier; |
| 92 | + return $this->identifier; |
95 | 93 | } |
96 | 94 | |
97 | 95 | protected function createColumn($identifier) { |
— | — | @@ -397,43 +395,49 @@ |
398 | 396 | } |
399 | 397 | } |
400 | 398 | |
| 399 | +class WikiDataSet { |
| 400 | + public $alternativeDefinitions; |
| 401 | + public $bootstrappedDefinedMeanings; |
| 402 | + public $classAttributes; |
| 403 | + public $classMemberships; |
| 404 | + public $collectionMemberships; |
| 405 | + public $definedMeaning; |
| 406 | + public $expression; |
| 407 | + public $linkAttributeValues; |
| 408 | + public $meaningRelations; |
| 409 | + public $optionAttributeOptions; |
| 410 | + public $optionAttributeValues; |
| 411 | + public $syntrans; |
| 412 | + public $textAttributeValues; |
| 413 | + public $translatedContentAttributeValues; |
| 414 | + public $translatedContent; |
| 415 | + public $transactions; |
| 416 | + |
| 417 | + public function __construct($dataSetPrefix) { |
| 418 | + $this->alternativeDefinitions = new AlternativeDefinitionsTable("{$dataSetPrefix}_alt_meaningtexts"); |
| 419 | + $this->bootstrappedDefinedMeanings = new BootstrappedDefinedMeaningsTable("{$dataSetPrefix}_bootstrapped_defined_meanings"); |
| 420 | + $this->classAttributes = new ClassAttributesTable("{$dataSetPrefix}_class_attributes"); |
| 421 | + $this->classMemberships = new ClassMembershipsTable("{$dataSetPrefix}_class_membership"); |
| 422 | + $this->collectionMemberships = new CollectionMembershipsTable("{$dataSetPrefix}_collection_contents"); |
| 423 | + $this->definedMeaning = new DefinedMeaningTable("{$dataSetPrefix}_defined_meaning"); |
| 424 | + $this->expression = new ExpressionTable("{$dataSetPrefix}_expression"); |
| 425 | + $this->linkAttributeValues = new LinkAttributeValuesTable("{$dataSetPrefix}_url_attribute_values"); |
| 426 | + $this->meaningRelations = new MeaningRelationsTable("{$dataSetPrefix}_meaning_relations"); |
| 427 | + $this->syntrans = new SyntransTable("{$dataSetPrefix}_syntrans"); |
| 428 | + $this->textAttributeValues = new TextAttributeValuesTable("{$dataSetPrefix}_text_attribute_values"); |
| 429 | + $this->transactions = new Table("{$dataSetPrefix}_transactions", false, array("transaction_id")); |
| 430 | + $this->translatedContentAttributeValues = new TranslatedContentAttributeValuesTable("{$dataSetPrefix}_translated_content_attribute_values"); |
| 431 | + $this->translatedContent = new TranslatedContentTable("{$dataSetPrefix}_translated_content"); |
| 432 | + $this->optionAttributeOptions = new OptionAttributeOptionsTable("{$dataSetPrefix}_option_attribute_options"); |
| 433 | + $this->optionAttributeValues = new OptionAttributeValuesTable("{$dataSetPrefix}_option_attribute_values"); |
| 434 | + } |
| 435 | +} |
| 436 | + |
401 | 437 | global |
402 | | - $tables, |
| 438 | + $dataSet; |
403 | 439 | |
404 | | - $alternativeDefinitionsTable, |
405 | | - $bootstrappedDefinedMeaningsTable, |
406 | | - $classAttributesTable, |
407 | | - $classMembershipsTable, |
408 | | - $collectionMembershipsTable, |
409 | | - $definedMeaningTable, |
410 | | - $expressionTable, |
411 | | - $linkAttributeValuesTable, |
412 | | - $meaningRelationsTable, |
413 | | - $optionAttributeOptionsTable, |
414 | | - $optionAttributeValuesTable, |
415 | | - $syntransTable, |
416 | | - $textAttributeValuesTable, |
417 | | - $translatedContentAttributeValuesTable, |
418 | | - $translatedContentTable, |
419 | | - $transactionsTable; |
420 | | - |
421 | 440 | $dc=wdGetDataSetContext(); |
422 | | -$alternativeDefinitionsTable = new AlternativeDefinitionsTable("alt_meaningtexts"); |
423 | | -$bootstrappedDefinedMeaningsTable = new BootstrappedDefinedMeaningsTable("bootstrapped_defined_meanings"); |
424 | | -$classAttributesTable = new ClassAttributesTable("class_attributes"); |
425 | | -$classMembershipsTable = new ClassMembershipsTable("class_membership"); |
426 | | -$collectionMembershipsTable = new CollectionMembershipsTable("collection_contents"); |
427 | | -$definedMeaningTable = new DefinedMeaningTable("defined_meaning"); |
428 | | -$expressionTable = new ExpressionTable("expression"); |
429 | | -$linkAttributeValuesTable = new LinkAttributeValuesTable("url_attribute_values"); |
430 | | -$meaningRelationsTable = new MeaningRelationsTable("meaning_relations"); |
431 | | -$syntransTable = new SyntransTable("syntrans"); |
432 | | -$textAttributeValuesTable = new TextAttributeValuesTable("text_attribute_values"); |
433 | | -$transactionsTable = new Table("transactions", false, array('transaction_id')); |
434 | | -$translatedContentAttributeValuesTable = new TranslatedContentAttributeValuesTable("translated_content_attribute_values"); |
435 | | -$translatedContentTable = new TranslatedContentTable("translated_content"); |
436 | | -$optionAttributeOptionsTable = new OptionAttributeOptionsTable("option_attribute_options"); |
437 | | -$optionAttributeValuesTable = new OptionAttributeValuesTable("option_attribute_values"); |
| 441 | +$dataSet = new WikiDataSet($dc); |
438 | 442 | |
439 | 443 | function genericSelect($selectCommand, array $expressions, array $tables, array $restrictions) { |
440 | 444 | $result = $selectCommand . " " . $expressions[0]->toExpression(); |