Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | * A class to encapsulate the special page that allows browsing through |
25 | 25 | * the knowledge structure of a Semantic MediaWiki. |
26 | 26 | */ |
27 | | -class SMW_SpecialBrowse { |
| 27 | +class SMW_SpecialBrowse { |
28 | 28 | |
29 | 29 | static function execute($query = '') { |
30 | 30 | global $wgRequest, $wgOut, $wgUser,$wgContLang; |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | $articletext = $wgRequest->getVal( 'article' ); |
35 | 35 | // no GET parameters? Then try the URL |
36 | 36 | if ('' == $articletext) { $articletext = $query; } |
37 | | - $article = Title::newFromText( $articletext ); |
| 37 | + $article = SMWDataValueFactory::newTypeIDValue('_wpg', $articletext); |
38 | 38 | $limit = $wgRequest->getVal( 'limit' ); |
39 | 39 | if ('' == $limit) $limit = 10; |
40 | 40 | $offset = $wgRequest->getVal( 'offset' ); |
— | — | @@ -44,22 +44,21 @@ |
45 | 45 | |
46 | 46 | $vsep = '<div class="smwhr"><hr /></div>'; |
47 | 47 | |
48 | | - if ((NULL !== $article) && ('' !== $articletext)) { // legal article given |
| 48 | + if (($article->isValid()) && ('' !== $articletext)) { // legal article given |
49 | 49 | $options = new SMWRequestOptions(); |
50 | | - $outrel = &smwfGetStore()->getOutRelations($article, $options); |
51 | | - $atts = &smwfGetStore()->getAttributes($article, $options); |
52 | | - $cats = &smwfGetStore()->getSpecialValues($article, SMW_SP_HAS_CATEGORY, $options); |
53 | | - $redout = &smwfGetStore()->getSpecialValues($article, SMW_SP_REDIRECTS_TO, $options); |
54 | | - $redin = &smwfGetStore()->getSpecialSubjects(SMW_SP_REDIRECTS_TO, $article, $options); |
| 50 | + $atts = &smwfGetStore()->getProperties($article->getTitle(), $options); |
| 51 | + $cats = &smwfGetStore()->getSpecialValues($article->getTitle(), SMW_SP_HAS_CATEGORY, $options); |
| 52 | + $redout = &smwfGetStore()->getSpecialValues($article->getTitle(), SMW_SP_REDIRECTS_TO, $options); |
| 53 | + $redin = &smwfGetStore()->getSpecialSubjects(SMW_SP_REDIRECTS_TO, $article->getTitle(), $options); |
55 | 54 | $options->limit = $innerlimit; |
56 | | - $instances = &smwfGetStore()->getSpecialSubjects(SMW_SP_HAS_CATEGORY, $article, $options); |
| 55 | + $instances = &smwfGetStore()->getSpecialSubjects(SMW_SP_HAS_CATEGORY, $article->getTitle(), $options); |
57 | 56 | $options->limit = $limit+1; |
58 | 57 | $options->offset = $offset; |
59 | 58 | $options->sort = TRUE; |
60 | 59 | // get results (get one more, to see if we have to add a link to more) |
61 | | - $inrel = &smwfGetStore()->getInRelations($article, $options); |
| 60 | + $inprop = &smwfGetStore()->getInProperties($article, $options); |
62 | 61 | |
63 | | - $wgOut->setPagetitle($article->getFullText()); |
| 62 | + $wgOut->setPagetitle($article->getLongHTMLText(NULL)); |
64 | 63 | |
65 | 64 | $html .= '<table width="100%"><tr>'; |
66 | 65 | // left column (incoming links) |
— | — | @@ -73,18 +72,18 @@ |
74 | 73 | |
75 | 74 | $navigation .= ' '; // The following shows the numbers of the result. |
76 | 75 | // Is this better, or not? TODO |
77 | | - // <b>' . wfMsg('smw_result_results') . ' ' . ($offset+1) . '– ' . ($offset + min(count($inrel), $limit)) . '</b> '; |
| 76 | + // <b>' . wfMsg('smw_result_results') . ' ' . ($offset+1) . '– ' . ($offset + min(count($inprop), $limit)) . '</b> '; |
78 | 77 | |
79 | | - if (count($inrel)==($limit+1)) |
| 78 | + if (count($inprop)==($limit+1)) |
80 | 79 | $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Browse', 'offset=' . ($offset+$limit) . '&article=' . urlencode($articletext) )) . '">' . wfMsg('smw_result_next') . '</a>'; |
81 | 80 | else |
82 | 81 | $navigation .= wfMsg('smw_result_next'); |
83 | 82 | |
84 | | - if ((count($inrel) == 0) && (count($instances) == 0) && (count($redin)==0)) { |
| 83 | + if ((count($inprop) == 0) && (count($instances) == 0) && (count($redin)==0)) { |
85 | 84 | $html .= ' '; |
86 | 85 | } else { |
87 | 86 | // no need to show the navigation bars when there is not enough to navigate |
88 | | - if (($offset>0) || (count($inrel)>$limit)) $html .= $navigation; |
| 87 | + if (($offset>0) || (count($inprop)>$limit)) $html .= $navigation; |
89 | 88 | $html .= $vsep . "\n"; |
90 | 89 | if ((0==$offset) && (count($instances) > 0)) { |
91 | 90 | $count = 0; |
— | — | @@ -95,7 +94,7 @@ |
96 | 95 | $html .= $skin->makeKnownLinkObj( $instance ) . ' ' . $browselink->getHTML($skin); |
97 | 96 | if ($count < count( $instances )) $html .= ', '; |
98 | 97 | } else { |
99 | | - $html .= $skin->makeKnownLinkObj( $article, wfMsg('smw_browse_more') ); |
| 98 | + $html .= $skin->makeKnownLinkObj( $article->getTitle(), wfMsg('smw_browse_more') ); |
100 | 99 | } |
101 | 100 | } |
102 | 101 | $html .= ' <strong>' . $skin->specialLink( 'Categories' ) . '</strong>'; |
— | — | @@ -112,21 +111,21 @@ |
113 | 112 | $html .= ' <strong>' . $skin->specialLink( 'Listredirects', 'isredirect' ) . '</strong>'; |
114 | 113 | $html .= $vsep . "\n"; |
115 | 114 | } |
116 | | - foreach ($inrel as $result) { |
| 115 | + foreach ($inprop as $result) { |
117 | 116 | $subjectoptions = new SMWRequestOptions(); |
118 | 117 | $subjectoptions->limit = $innerlimit; |
119 | | - $subjects = &smwfGetStore()->getRelationSubjects($result, $article, $subjectoptions); |
| 118 | + $subjects = &smwfGetStore()->getPropertySubjects($result, $article, $subjectoptions); |
120 | 119 | $subjectcount = count($subjects); |
121 | 120 | $more = ($subjectcount == $innerlimit); |
122 | 121 | $innercount = 0; |
123 | 122 | foreach ($subjects as $subject) { |
124 | 123 | $innercount += 1; |
125 | 124 | if (($innercount < $innerlimit) || !$more) { |
126 | | - $subjectlink = SMWInfolink::newBrowsingLink('+',$subject->getFullText()); |
| 125 | + $subjectlink = SMWInfolink::newBrowsingLink('+',$subject->getPrefixedText()); |
127 | 126 | $html .= $skin->makeKnownLinkObj($subject, smwfT($subject, TRUE)) . ' ' . $subjectlink->getHTML($skin); |
128 | 127 | if ($innercount<$subjectcount) $html .= ", \n"; |
129 | 128 | } else { |
130 | | - $html .= '<a href="' . $skin->makeSpecialUrl('SearchByRelation', 'type=' . urlencode($result->getFullText()) . '&target=' . urlencode($article->getFullText())) . '">' . wfMsg("smw_browse_more") . "</a>\n"; |
| 129 | + $html .= '<a href="' . $skin->makeSpecialUrl('SearchByRelation', 'type=' . urlencode($result->getPrefixedText()) . '&target=' . urlencode($article->getPrefixedText())) . '">' . wfMsg("smw_browse_more") . "</a>\n"; |
131 | 130 | } |
132 | 131 | } |
133 | 132 | // replace the last two whitespaces in the relation name with |
— | — | @@ -135,44 +134,48 @@ |
136 | 135 | // That's why nbsp is written backward. |
137 | 136 | $html .= ' <strong>' . $skin->makeKnownLinkObj($result, strrev(preg_replace('/[\s]/', ';psbn&', strrev(smwfT($result)), 2) )) . '</strong>' . $vsep . "\n"; // TODO makeLinkObj or makeKnownLinkObj? |
138 | 137 | } |
139 | | - if (($offset>0) || (count($inrel)>$limit)) $html .= $navigation; |
| 138 | + if (($offset>0) || (count($inprop)>$limit)) $html .= $navigation; |
140 | 139 | } |
141 | 140 | |
142 | | - $html .= '</td><td style="vertical-align:middle; text-align:center;" width="18%">' . $skin->makeLinkObj($article, smwfT($article, TRUE)) . '</td><td style="vertical-align:middle; text-align:left;" width="40%">'; |
| 141 | + $html .= '</td><td style="vertical-align:middle; text-align:center;" width="18%">' . $skin->makeLinkObj($article->getTitle(), smwfT($article->getTitle(), TRUE)) . '</td><td style="vertical-align:middle; text-align:left;" width="40%">'; |
143 | 142 | |
144 | | - if ((count($outrel) == 0) && (count($atts) == 0) && (count($cats) == 0) && (count($redout) == 0)) { |
| 143 | + if ((count($atts) == 0) && (count($cats) == 0) && (count($redout) == 0)) { |
145 | 144 | $html .= ' '; |
146 | 145 | } else { |
147 | 146 | $html .= $vsep . "\n"; |
148 | | - foreach ($outrel as $result) { |
149 | | - $objectoptions = new SMWRequestOptions(); |
150 | | - $objectoptions->limit = $innerlimit; |
151 | | - $html .= '<strong>' . $skin->makeKnownLinkObj($result, preg_replace('/[\s]/', ' ', smwfT($result), 2)) . "</strong> \n";// TODO makeLinkObj or makeKnownLinkObj? |
152 | | - $objects = &smwfGetStore()->getRelationObjects($article, $result, $objectoptions); |
153 | | - $objectcount = count($objects); |
154 | | - $count = 0; |
155 | | - foreach ($objects as $object) { |
156 | | - $count += 1; |
157 | | - if ($count == 4) { |
158 | | - $querylink = SMWInfolink::newInverseRelationSearchLink( wfMsg("smw_browse_more"), $article->getPrefixedText(), $result->getText() ); |
159 | | - $html .= $querylink->getHTML($skin); |
160 | | - } else { |
161 | | - $searchlink = SMWInfolink::newBrowsingLink('+',$object->getFullText()); |
162 | | - $html .= $skin->makeLinkObj($object, smwfT($object, TRUE)) . ' ' . $searchlink->getHTML($skin); |
163 | | - } |
164 | | - if ($count<$objectcount) $html .= ", "; |
165 | | - } |
166 | | - $html .= $vsep."\n"; |
167 | | - } |
| 147 | +// foreach ($outrel as $result) { |
| 148 | +// $objectoptions = new SMWRequestOptions(); |
| 149 | +// $objectoptions->limit = $innerlimit; |
| 150 | +// $html .= '<strong>' . $skin->makeKnownLinkObj($result, preg_replace('/[\s]/', ' ', smwfT($result), 2)) . "</strong> \n";// TODO makeLinkObj or makeKnownLinkObj? |
| 151 | +// $objects = &smwfGetStore()->getRelationObjects($article, $result, $objectoptions); |
| 152 | +// $objectcount = count($objects); |
| 153 | +// $count = 0; |
| 154 | +// foreach ($objects as $object) { |
| 155 | +// $count += 1; |
| 156 | +// if ($count == 4) { |
| 157 | +// $querylink = SMWInfolink::newInverseRelationSearchLink( wfMsg("smw_browse_more"), $article->getPrefixedText(), $result->getText() ); |
| 158 | +// $html .= $querylink->getHTML($skin); |
| 159 | +// } else { |
| 160 | +// $searchlink = SMWInfolink::newBrowsingLink('+',$object->getFullText()); |
| 161 | +// $html .= $skin->makeLinkObj($object, smwfT($object, TRUE)) . ' ' . $searchlink->getHTML($skin); |
| 162 | +// } |
| 163 | +// if ($count<$objectcount) $html .= ", "; |
| 164 | +// } |
| 165 | +// $html .= $vsep."\n"; |
| 166 | +// } |
168 | 167 | foreach ($atts as $att) { |
169 | 168 | $objectoptions = new SMWRequestOptions(); |
170 | 169 | $html .= '<strong>' . $skin->makeKnownLinkObj($att, preg_replace('/[\s]/', ' ', smwfT($att), 2)) . "</strong> \n"; |
171 | | - $objects = &smwfGetStore()->getAttributeValues($article, $att, $objectoptions); |
| 170 | + $objects = &smwfGetStore()->getPropertyValues($article->getTitle(), $att, $objectoptions); |
172 | 171 | $objectcount = count($objects); |
173 | 172 | $count = 0; |
174 | 173 | foreach ($objects as $object) { |
175 | 174 | $count += 1; |
176 | 175 | $html .= $object->getLongHTMLText($skin); |
| 176 | + if ($object->getTypeID() == '_wpg') { |
| 177 | + $searchlink = SMWInfolink::newBrowsingLink('+',$object->getPrefixedText()); |
| 178 | + $html .= ' ' . $searchlink->getHTML($skin); |
| 179 | + } |
177 | 180 | if ($count<$objectcount) $html .= ", "; |
178 | 181 | } |
179 | 182 | $html .= $vsep."\n"; |
— | — | @@ -209,7 +212,7 @@ |
210 | 213 | $html .= '<form name="smwbrowse" action="' . $spectitle->escapeLocalURL() . '" method="get">' . "\n"; |
211 | 214 | $html .= '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>' ; |
212 | 215 | $html .= wfMsg('smw_browse_article') . "<br />\n"; |
213 | | - if (NULL == $article) { $boxtext = $articletext; } else { $boxtext = $article->getFullText(); } |
| 216 | + if (!$article->isValid()) { $boxtext = $articletext; } else { $boxtext = $article->getWikiValue(); } |
214 | 217 | $html .= '<input type="text" name="article" value="' . htmlspecialchars($boxtext) . '" />' . "\n"; |
215 | 218 | $html .= '<input type="submit" value="' . wfMsg('smw_browse_go') . "\"/>\n</form>\n"; |
216 | 219 | |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByAttribute.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | $html .= wfMsg('smw_sbv_docu') . "\n"; |
55 | 55 | } else { |
56 | 56 | // Now that we have an attribute, let's figure out the datavalue |
57 | | - $value = SMWDataValueFactory::newAttributeObjectValue( $attribute, $valuestring ); |
| 57 | + $value = SMWDataValueFactory::newPropertyObjectValue( $attribute, $valuestring ); |
58 | 58 | if ( $value->isValid() == FALSE ) { // no value understood |
59 | 59 | $html .= wfMSG('smw_sbv_novalue', $skin->makeLinkObj($attribute, $attribute->getText())); |
60 | 60 | $valuestring = ''; |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | $options->limit = $limit+1; |
67 | 67 | $options->offset = $offset; |
68 | 68 | |
69 | | - $res = &smwfGetStore()->getAttributeSubjects( $attribute, $value, $options ); |
| 69 | + $res = &smwfGetStore()->getPropertySubjects( $attribute, $value, $options ); |
70 | 70 | $count = count($res); |
71 | 71 | |
72 | 72 | |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php |
— | — | @@ -72,26 +72,20 @@ |
73 | 73 | smwfInitStore(); |
74 | 74 | smwfInitMessages(); |
75 | 75 | |
76 | | - /**********************************************/ |
77 | | - /***** register specials *****/ |
78 | | - /**********************************************/ |
| 76 | + ///// register specials ///// |
79 | 77 | |
80 | | - //require_once($smwgIP . '/specials/SearchSemantic/SMW_SpecialSearchSemantic.php'); //really not longer functional! |
81 | 78 | require_once($smwgIP . '/specials/SearchTriple/SMW_SpecialSearchTriple.php'); |
82 | | - require_once($smwgIP . '/specials/SearchTriple/SMW_SpecialSearchByAttribute.php'); |
83 | | - require_once($smwgIP . '/specials/SearchTriple/SMW_SpecialSearchByRelation.php'); |
| 79 | + require_once($smwgIP . '/specials/SearchTriple/SMW_SpecialSearchByProperty.php'); |
84 | 80 | require_once($smwgIP . '/specials/SearchTriple/SMW_SpecialPageProperty.php'); |
85 | 81 | require_once($smwgIP . '/specials/SearchTriple/SMW_SpecialBrowse.php'); |
86 | 82 | |
87 | 83 | require_once($smwgIP . '/specials/URIResolver/SMW_SpecialURIResolver.php'); |
88 | | - require_once($smwgIP . '/specials/ExportRDF/SMW_SpecialExportRDF.php'); // coming soon |
| 84 | + require_once($smwgIP . '/specials/ExportRDF/SMW_SpecialExportRDF.php'); |
89 | 85 | require_once($smwgIP . '/specials/SMWAdmin/SMW_SpecialSMWAdmin.php'); |
90 | 86 | //require_once($smwgIP . '/specials/OntologyImport/SMW_SpecialOntologyImport.php'); // broken, TODO: fix or delete |
91 | 87 | require_once($smwgIP . '/specials/AskSpecial/SMW_SpecialAsk.php'); |
92 | 88 | require_once($smwgIP . '/specials/ExtendedStatistics/SMW_SpecialExtendedStatistics.php'); |
93 | 89 | |
94 | | - include_once($smwgIP . '/includes/SMW_QueryProcessor.php'); |
95 | | - |
96 | 90 | require_once($smwgIP . '/specials/Relations/SMW_SpecialRelations.php'); |
97 | 91 | require_once($smwgIP . '/specials/Relations/SMW_SpecialUnusedRelations.php'); |
98 | 92 | require_once($smwgIP . '/specials/Relations/SMW_SpecialWantedRelations.php'); |
— | — | @@ -99,12 +93,11 @@ |
100 | 94 | require_once($smwgIP . '/specials/Relations/SMW_SpecialUnusedAttributes.php'); |
101 | 95 | require_once($smwgIP . '/specials/Relations/SMW_SpecialTypes.php'); |
102 | 96 | |
103 | | - /**********************************************/ |
104 | | - /***** register hooks *****/ |
105 | | - /**********************************************/ |
| 97 | + ///// register hooks ///// |
106 | 98 | |
107 | 99 | require_once($smwgIP . '/includes/SMW_Hooks.php'); |
108 | 100 | require_once($smwgIP . '/includes/SMW_RefreshTab.php'); |
| 101 | + require_once($smwgIP . '/includes/SMW_QueryProcessor.php'); |
109 | 102 | |
110 | 103 | if ($smwgEnableTemplateSupport===true) { |
111 | 104 | $wgHooks['InternalParseBeforeLinks'][] = 'smwfParserHook'; //patch required; |
— | — | @@ -119,9 +112,7 @@ |
120 | 113 | $wgHooks['ParserBeforeStrip'][] = 'smwfRegisterInlineQueries'; // a hook for registering the <ask> parser hook |
121 | 114 | $wgHooks['ArticleFromTitle'][] = 'smwfShowListPage'; |
122 | 115 | |
123 | | - /**********************************************/ |
124 | | - /***** credits (see "Special:Version") *****/ |
125 | | - /**********************************************/ |
| 116 | + ///// credits (see "Special:Version") ///// |
126 | 117 | $wgExtensionCredits['parserhook'][]= array('name'=>'Semantic MediaWiki', 'version'=>SMW_VERSION, 'author'=>"Klaus Lassleben, Markus Krötzsch, Denny Vrandecic, S Page, and others. Maintained by [http://www.aifb.uni-karlsruhe.de/Forschungsgruppen/WBS/english AIFB Karlsruhe].", 'url'=>'http://ontoworld.org/wiki/Semantic_MediaWiki', 'description' => 'Making your wiki more accessible – for machines \'\'and\'\' humans. [http://ontoworld.org/wiki/Help:Semantics View online documentation.]'); |
127 | 118 | |
128 | 119 | return true; |
— | — | @@ -219,13 +210,17 @@ |
220 | 211 | |
221 | 212 | smwfInitContentLanguage($wgLanguageCode); |
222 | 213 | |
223 | | - define('SMW_NS_RELATION', $smwgNamespaceIndex); |
224 | | - define('SMW_NS_RELATION_TALK', $smwgNamespaceIndex+1); |
225 | | - define('SMW_NS_ATTRIBUTE', $smwgNamespaceIndex+2); |
226 | | - define('SMW_NS_ATTRIBUTE_TALK', $smwgNamespaceIndex+3); |
| 214 | + define('SMW_NS_PROPERTY', $smwgNamespaceIndex+2); |
| 215 | + define('SMW_NS_PROPERTY_TALK', $smwgNamespaceIndex+3); |
227 | 216 | define('SMW_NS_TYPE', $smwgNamespaceIndex+4); |
228 | 217 | define('SMW_NS_TYPE_TALK', $smwgNamespaceIndex+5); |
229 | 218 | |
| 219 | + /// @DEPRECATED |
| 220 | + define('SMW_NS_ATTRIBUTE', $smwgNamespaceIndex+2); |
| 221 | + define('SMW_NS_ATTRIBUTE_TALK', $smwgNamespaceIndex+3); |
| 222 | + define('SMW_NS_RELATION', $smwgNamespaceIndex); |
| 223 | + define('SMW_NS_RELATION_TALK', $smwgNamespaceIndex+1); |
| 224 | + |
230 | 225 | // Register namespace identifiers |
231 | 226 | if (!is_array($wgExtraNamespaces)) { $wgExtraNamespaces=array(); } |
232 | 227 | $wgExtraNamespaces = $wgExtraNamespaces + $smwgContLang->getNamespaceArray(); |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php |
— | — | @@ -45,147 +45,62 @@ |
46 | 46 | $specprops = Array(); |
47 | 47 | } |
48 | 48 | |
49 | | -//// Attributes |
| 49 | +//// Properties |
50 | 50 | |
51 | 51 | /** |
52 | | - * Get the array of all attributes that have stored values. |
| 52 | + * Get the array of all properties that have stored values. |
53 | 53 | */ |
54 | | - public function getAttributes() { |
| 54 | + public function getProperties() { |
55 | 55 | ksort($this->attribtitles,SORT_STRING); |
56 | 56 | return $this->attribtitles; |
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | | - * Get the array of all stored values for some attribute. |
| 60 | + * Get the array of all stored values for some property. |
61 | 61 | */ |
62 | | - public function getAttributeValues(Title $attribute) { |
63 | | - if (array_key_exists($attribute->getText(), $this->attribvals)) { |
64 | | - return $this->attribvals[$attribute->getText()]; |
| 62 | + public function getPropertyValues(Title $property) { |
| 63 | + if (array_key_exists($property->getText(), $this->attribvals)) { |
| 64 | + return $this->attribvals[$property->getText()]; |
65 | 65 | } else { |
66 | | - return Array(); |
| 66 | + return array(); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | | - * Return true if there are any attributes. |
| 71 | + * Return true if there are any properties. |
72 | 72 | */ |
73 | | - public function hasAttributes() { |
| 73 | + public function hasProperties() { |
74 | 74 | return (count($this->attribtitles) != 0); |
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | | - * Store a value for an attribute identified by its title object. Duplicate |
| 78 | + * Store a value for an property identified by its title object. Duplicate |
79 | 79 | * value entries are ignored. |
80 | 80 | */ |
81 | | - public function addAttributeValue(Title $attribute, SMWDataValue $value) { |
82 | | - if (!array_key_exists($attribute->getText(), $this->attribvals)) { |
83 | | - $this->attribvals[$attribute->getText()] = Array(); |
84 | | - $this->attribtitles[$attribute->getText()] = $attribute; |
| 81 | + public function addPropertyObjectValue(Title $property, SMWDataValue $value) { |
| 82 | + if (!array_key_exists($property->getText(), $this->attribvals)) { |
| 83 | + $this->attribvals[$property->getText()] = Array(); |
| 84 | + $this->attribtitles[$property->getText()] = $property; |
85 | 85 | } |
86 | | - $this->attribvals[$attribute->getText()][$value->getHash()] = $value; |
| 86 | + $this->attribvals[$property->getText()][$value->getHash()] = $value; |
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | | - * Store a value for a given attribute identified by its text label (without |
| 90 | + * Store a value for a given property identified by its text label (without |
91 | 91 | * namespace prefix). Duplicate value entries are ignored. |
92 | 92 | */ |
93 | | - public function addAttributeTextValue($attributetext, SMWDataValue $value) { |
94 | | - if (array_key_exists($attributetext, $this->attribtitles)) { |
95 | | - $attribute = $this->attribtitles[$attributetext]; |
| 93 | + public function addPropertyValue($propertyname, SMWDataValue $value) { |
| 94 | + if (array_key_exists($propertyname, $this->attribtitles)) { |
| 95 | + $property = $this->attribtitles[$propertyname]; |
96 | 96 | } else { |
97 | | - $attribute = Title::newFromText($attributetext, SMW_NS_ATTRIBUTE); |
98 | | - if ($attribute === NULL) { // error, maybe illegal title text |
| 97 | + $property = Title::newFromText($propertyname, SMW_NS_PROPERTY); |
| 98 | + if ($property === NULL) { // error, maybe illegal title text |
99 | 99 | return; |
100 | 100 | } |
101 | 101 | } |
102 | | - $this->addAttributeValue($attribute, $value); |
| 102 | + $this->addPropertyObjectValue($property, $value); |
103 | 103 | } |
104 | 104 | |
105 | | -//// Relations |
106 | | - |
107 | | - /** |
108 | | - * Get the array of all relations that have stored values. |
109 | | - */ |
110 | | - public function getRelations() { |
111 | | - ksort($this->reltitles,SORT_STRING); |
112 | | - return $this->reltitles; |
113 | | - } |
114 | | - |
115 | | - /** |
116 | | - * Get the array of all stored objects for some relation. |
117 | | - */ |
118 | | - public function getRelationValues(Title $relation) { |
119 | | - if (array_key_exists($relation->getText(), $this->relobjs)) { |
120 | | - return $this->relobjs[$relation->getText()]; |
121 | | - } else { |
122 | | - return array(); |
123 | | - } |
124 | | - } |
125 | | - |
126 | | - /** |
127 | | - * Return true if there are any relations. |
128 | | - */ |
129 | | - public function hasRelations() { |
130 | | - return (count($this->reltitles) != 0); |
131 | | - } |
132 | | - |
133 | | - /** |
134 | | - * Store a value for a relation identified by its title. Duplicate |
135 | | - * object entries are ignored. |
136 | | - */ |
137 | | - public function addRelationValue(Title $relation, SMWDataValue $value) { |
138 | | - if (!array_key_exists($relation->getText(), $this->relobjs)) { |
139 | | - $this->relobjs[$relation->getText()] = Array(); |
140 | | - $this->reltitles[$relation->getText()] = $relation; |
141 | | - } |
142 | | - $this->relobjs[$relation->getText()][$value->getHash()] = $value; |
143 | | - } |
144 | | - |
145 | | - /** |
146 | | - * Store a value for a given relation identified by its text label (without |
147 | | - * namespace prefix). Duplicate value entries are ignored. |
148 | | - */ |
149 | | - public function addRelationTextvalue($relationtext, SMWDataValue $value) { |
150 | | - if (array_key_exists($relationtext, $this->reltitles)) { |
151 | | - $relation = $this->reltitles[$relationtext]; |
152 | | - } else { |
153 | | - $relation = Title::newFromText($relationtext, SMW_NS_RELATION); |
154 | | - if ($relation === NULL) { // error, maybe illegal title text |
155 | | - return; |
156 | | - } |
157 | | - } |
158 | | - $this->addRelationValue($relation, $value); |
159 | | - } |
160 | | - |
161 | | - |
162 | | - /** |
163 | | - * Store an object for a relation identified by its title. Duplicate |
164 | | - * object entries are ignored. |
165 | | - */ |
166 | | - public function addRelationObject(Title $relation, Title $object) { |
167 | | - if (!array_key_exists($relation->getText(), $this->relobjs)) { |
168 | | - $this->relobjs[$relation->getText()] = Array(); |
169 | | - $this->reltitles[$relation->getText()] = $relation; |
170 | | - } |
171 | | - $this->relobjs[$relation->getText()][$object->getPrefixedText()] = $object; |
172 | | - } |
173 | | - |
174 | | - /** |
175 | | - * Store an object for a given relation identified by its text label (without |
176 | | - * namespace prefix). Duplicate value entries are ignored. |
177 | | - */ |
178 | | - public function addRelationTextObject($relationtext, Title $object) { |
179 | | - if (array_key_exists($relationtext, $this->reltitles)) { |
180 | | - $relation = $this->reltitles[$relationtext]; |
181 | | - } else { |
182 | | - $relation = Title::newFromText($relationtext, SMW_NS_RELATION); |
183 | | - if ($relation === NULL) { // error, maybe illegal title text |
184 | | - return; |
185 | | - } |
186 | | - } |
187 | | - $this->addRelationObject($relation, $object); |
188 | | - } |
189 | | - |
190 | 105 | //// Special properties |
191 | 106 | |
192 | 107 | /** |
— | — | @@ -233,5 +148,58 @@ |
234 | 149 | } |
235 | 150 | } |
236 | 151 | |
| 152 | + |
| 153 | +//// Attributes (deprecated) |
| 154 | + |
| 155 | + /** |
| 156 | + * Get the array of all attributes that have stored values. |
| 157 | + */ |
| 158 | + public function getAttributes() { |
| 159 | + trigger_error("Function getAttributes is deprecated. Use new property methods.", E_USER_NOTICE); |
| 160 | + return $this->getProperties(); |
| 161 | + } |
| 162 | + |
| 163 | + /** |
| 164 | + * Get the array of all stored values for some attribute. |
| 165 | + */ |
| 166 | + public function getAttributeValues(Title $attribute) { |
| 167 | + trigger_error("Function getAttributeValues is deprecated. Use new property methods.", E_USER_NOTICE); |
| 168 | + return $this->getAttributeValues($attribute); |
| 169 | + } |
| 170 | + |
| 171 | + /** |
| 172 | + * Return true if there are any attributes. |
| 173 | + */ |
| 174 | + public function hasAttributes() { |
| 175 | + trigger_error("Function hasAttributes is deprecated. Use new property methods.", E_USER_NOTICE); |
| 176 | + return $this->hasProperties(); |
| 177 | + } |
| 178 | + |
| 179 | +//// Relations (deprecated) |
| 180 | + |
| 181 | + /** |
| 182 | + * Get the array of all relations that have stored values. |
| 183 | + */ |
| 184 | + public function getRelations() { |
| 185 | + trigger_error("Function getRelations is deprecated. Use new property methods.", E_USER_NOTICE); |
| 186 | + return array(); |
| 187 | + } |
| 188 | + |
| 189 | + /** |
| 190 | + * Get the array of all stored objects for some relation. |
| 191 | + */ |
| 192 | + public function getRelationValues(Title $relation) { |
| 193 | + trigger_error("Function getRelationValues is deprecated. Use new property methods.", E_USER_NOTICE); |
| 194 | + return array(); |
| 195 | + } |
| 196 | + |
| 197 | + /** |
| 198 | + * Return true if there are any relations. |
| 199 | + */ |
| 200 | + public function hasRelations() { |
| 201 | + trigger_error("Function hasRelations is deprecated. Use new property methods.", E_USER_NOTICE); |
| 202 | + return false; |
| 203 | + } |
| 204 | + |
237 | 205 | } |
238 | 206 | |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php |
— | — | @@ -6,16 +6,16 @@ |
7 | 7 | require_once($smwgIP . '/includes/SMW_OldDataValue.php'); |
8 | 8 | |
9 | 9 | /** |
10 | | - * Factory class for creating SMWDataValue objects for supplied types or attributes |
| 10 | + * Factory class for creating SMWDataValue objects for supplied types or properties |
11 | 11 | * and data values. |
12 | 12 | * |
13 | 13 | * The class has two main entry points: |
14 | 14 | * - newTypeObjectValue |
15 | 15 | * - newTypeIDValue |
16 | | - * These create new DV objects, possibly with preset user values, captions and attribute names. |
17 | | - * Further methods are used to conveniently create DVs for attributes and special properties: |
18 | | - * - newAttributeValue |
19 | | - * - newAttributeObjectValue |
| 16 | + * These create new DV objects, possibly with preset user values, captions and property names. |
| 17 | + * Further methods are used to conveniently create DVs for properties and special properties: |
| 18 | + * - newPropertyValue |
| 19 | + * - newPropertyObjectValue |
20 | 20 | * - newSpecialValue |
21 | 21 | */ |
22 | 22 | class SMWDataValueFactory { |
— | — | @@ -29,52 +29,52 @@ |
30 | 30 | static private $m_valueclasses = array(); |
31 | 31 | |
32 | 32 | /** |
33 | | - * Cache for type specifications (type datavalues), indexed by attribute name (both without namespace prefix). |
| 33 | + * Cache for type specifications (type datavalues), indexed by property name (both without namespace prefix). |
34 | 34 | */ |
35 | 35 | static private $m_typelabels = array(); |
36 | 36 | |
37 | 37 | /** |
38 | | - * Create a value from a string supplied by a user for a given attribute. |
| 38 | + * Create a value from a string supplied by a user for a given property. |
39 | 39 | * If no value is given, an empty container is created, the value of which |
40 | 40 | * can be set later on. |
41 | 41 | */ |
42 | | - static public function newAttributeValue($attstring, $value=false, $caption=false) { |
43 | | - if(array_key_exists($attstring,SMWDataValueFactory::$m_typelabels)) { // use cache |
44 | | - return SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typelabels[$attstring], $value, $caption, $attstring); |
45 | | - } // else: find type for attribute: |
| 42 | + static public function newPropertyValue($propertyname, $value=false, $caption=false) { |
| 43 | + if(array_key_exists($propertyname,SMWDataValueFactory::$m_typelabels)) { // use cache |
| 44 | + return SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typelabels[$propertyname], $value, $caption, $propertyname); |
| 45 | + } // else: find type for property: |
46 | 46 | |
47 | | - $atitle = Title::newFromText($attstring, SMW_NS_ATTRIBUTE); |
48 | | - if ($atitle !== NULL) { |
49 | | - return SMWDataValueFactory::newAttributeObjectValue($atitle,$value,$caption); |
| 47 | + $ptitle = Title::newFromText($propertyname, SMW_NS_PROPERTY); |
| 48 | + if ($ptitle !== NULL) { |
| 49 | + return SMWDataValueFactory::newPropertyObjectValue($ptitle,$value,$caption); |
50 | 50 | } else { |
51 | 51 | $type = SMWDataValueFactory::newTypeIDValue('__typ'); |
52 | 52 | $type->setXSDValue('_wpg'); |
53 | | - SMWDataValueFactory::$m_typelabels[$attstring] = $type; |
54 | | - return SMWDataValueFactory::newTypeIDValue('_wpg',$value,$caption,$attstring); |
| 53 | + SMWDataValueFactory::$m_typelabels[$propertyname] = $type; |
| 54 | + return SMWDataValueFactory::newTypeIDValue('_wpg',$value,$caption,$propertyname); |
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | | - * Create a value from a string supplied by a user for a given attribute title. |
| 59 | + * Create a value from a string supplied by a user for a given property title. |
60 | 60 | * If no value is given, an empty container is created, the value of which |
61 | 61 | * can be set later on. |
62 | 62 | */ |
63 | | - static public function newAttributeObjectValue(Title $att, $value=false, $caption=false) { |
64 | | - $attstring = $att->getText(); |
65 | | - if(array_key_exists($attstring,SMWDataValueFactory::$m_typelabels)) { // use cache |
66 | | - return SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typelabels[$attstring], $value, $caption, $attstring); |
67 | | - } // else: find type for attribute: |
| 63 | + static public function newPropertyObjectValue(Title $property, $value=false, $caption=false) { |
| 64 | + $propertyname = $property->getText(); |
| 65 | + if(array_key_exists($propertyname,SMWDataValueFactory::$m_typelabels)) { // use cache |
| 66 | + return SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typelabels[$propertyname], $value, $caption, $propertyname); |
| 67 | + } // else: find type for property: |
68 | 68 | |
69 | | - $typearray = smwfGetStore()->getSpecialValues($att,SMW_SP_HAS_TYPE); |
| 69 | + $typearray = smwfGetStore()->getSpecialValues($property,SMW_SP_HAS_TYPE); |
70 | 70 | if (count($typearray)==1) { |
71 | | - SMWDataValueFactory::$m_typelabels[$attstring] = $typearray[0]; |
72 | | - $result = SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typelabels[$attstring], $value, $caption, $attstring); |
| 71 | + SMWDataValueFactory::$m_typelabels[$propertyname] = $typearray[0]; |
| 72 | + $result = SMWDataValueFactory::newTypeObjectValue(SMWDataValueFactory::$m_typelabels[$propertyname], $value, $caption, $propertyname); |
73 | 73 | return $result; |
74 | 74 | } elseif (count($typearray)==0) { |
75 | 75 | $type = SMWDataValueFactory::newTypeIDValue('__typ'); |
76 | 76 | $type->setXSDValue('_wpg'); |
77 | | - SMWDataValueFactory::$m_typelabels[$attstring] = $type; |
78 | | - return SMWDataValueFactory::newTypeIDValue('_wpg',$value,$caption,$attstring); |
| 77 | + SMWDataValueFactory::$m_typelabels[$propertyname] = $type; |
| 78 | + return SMWDataValueFactory::newTypeIDValue('_wpg',$value,$caption,$propertyname); |
79 | 79 | } else { |
80 | 80 | return new SMWErrorValue(wfMsgForContent('smw_manytypes'), $value, $caption); |
81 | 81 | } |
— | — | @@ -118,11 +118,11 @@ |
119 | 119 | * @param $typevalue datavalue representing the type of the object |
120 | 120 | * @param $value user value string, or false if unknown |
121 | 121 | * @param $caption user-defined caption or false if none given |
122 | | - * @param $attstring text name of according attribute, or false (may be relevant for getting further parameters) |
| 122 | + * @param $propertyname text name of according property, or false (may be relevant for getting further parameters) |
123 | 123 | */ |
124 | | - static public function newTypeObjectValue(SMWDataValue $typevalue, $value=false, $caption=false, $attstring=false) { |
| 124 | + static public function newTypeObjectValue(SMWDataValue $typevalue, $value=false, $caption=false, $propertyname=false) { |
125 | 125 | if (array_key_exists($typevalue->getXSDValue(), SMWDataValueFactory::$m_valueclasses)) { |
126 | | - return SMWDataValueFactory::newTypeIDValue($typevalue->getXSDValue(), $value, $caption, $attstring); |
| 126 | + return SMWDataValueFactory::newTypeIDValue($typevalue->getXSDValue(), $value, $caption, $propertyname); |
127 | 127 | } else { |
128 | 128 | if (!$typevalue->isUnary()) { // n-ary type? |
129 | 129 | $result = SMWDataValueFactory::newTypeIDValue('__nry'); |
— | — | @@ -133,8 +133,8 @@ |
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | | - if ($attstring != false) { |
138 | | - $result->setAttribute($attstring); |
| 137 | + if ($propertyname != false) { |
| 138 | + $result->setProperty($propertyname); |
139 | 139 | } |
140 | 140 | if ($value !== false) { |
141 | 141 | $result->setUserValue($value,$caption); |
— | — | @@ -149,9 +149,9 @@ |
150 | 150 | * @param $typeid id string for the given type |
151 | 151 | * @param $value user value string, or false if unknown |
152 | 152 | * @param $caption user-defined caption or false if none given |
153 | | - * @param $attstring text name of according attribute, or false (may be relevant for getting further parameters) |
| 153 | + * @param $propertyname text name of according property, or false (may be relevant for getting further parameters) |
154 | 154 | */ |
155 | | - static public function newTypeIDValue($typeid, $value=false, $caption=false, $attstring=false) { |
| 155 | + static public function newTypeIDValue($typeid, $value=false, $caption=false, $propertyname=false) { |
156 | 156 | if (array_key_exists($typeid, SMWDataValueFactory::$m_valueclasses)) { |
157 | 157 | $vc = SMWDataValueFactory::$m_valueclasses[$typeid]; |
158 | 158 | // check if class file was already included for this class |
— | — | @@ -168,11 +168,11 @@ |
169 | 169 | } else { |
170 | 170 | $typevalue = SMWDataValueFactory::newTypeIDValue('__typ'); |
171 | 171 | $typevalue->setXSDValue($typeid); |
172 | | - return SMWDataValueFactory::newTypeObjectValue($typevalue, $value, $caption, $attstring); |
| 172 | + return SMWDataValueFactory::newTypeObjectValue($typevalue, $value, $caption, $propertyname); |
173 | 173 | } |
174 | 174 | |
175 | | - if ($attstring != false) { |
176 | | - $result->setAttribute($attstring); |
| 175 | + if ($propertyname != false) { |
| 176 | + $result->setProperty($propertyname); |
177 | 177 | } |
178 | 178 | if ($value !== false) { |
179 | 179 | $result->setUserValue($value,$caption); |
— | — | @@ -181,14 +181,14 @@ |
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | | - * Quickly get the type id of some attribute without necessarily making another datavalue. |
| 185 | + * Quickly get the type id of some property without necessarily making another datavalue. |
186 | 186 | */ |
187 | | - static public function getAttributeObjectTypeID(Title $att) { |
188 | | - $attstring = $att->getText(); |
189 | | - if (array_key_exists($attstring, SMWDataValueFactory::$m_typelabels)) { |
190 | | - return SMWDataValueFactory::$m_typelabels[$attstring]->getXSDValue(); |
| 187 | + static public function getPropertyObjectTypeID(Title $property) { |
| 188 | + $propertyname = $property->getText(); |
| 189 | + if (array_key_exists($propertyname, SMWDataValueFactory::$m_typelabels)) { |
| 190 | + return SMWDataValueFactory::$m_typelabels[$propertyname]->getXSDValue(); |
191 | 191 | } else { |
192 | | - return SMWDataValueFactory::newAttributeObjectValue($att)->getTypeID(); // this also triggers caching |
| 192 | + return SMWDataValueFactory::newPropertyObjectValue($property)->getTypeID(); // this also triggers caching |
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
— | — | @@ -208,6 +208,22 @@ |
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
| 212 | + * @DEPRECATED |
| 213 | + */ |
| 214 | + static public function newAttributeValue($property, $value=false, $caption=false) { |
| 215 | + trigger_error("Function newAttributeValue is deprecated. Use new property methods.", E_USER_NOTICE); |
| 216 | + return SMWDataValueFactory::newPropertyValue($property, $value, $caption); |
| 217 | + } |
| 218 | + |
| 219 | + /** |
| 220 | + * @DEPRECATED |
| 221 | + */ |
| 222 | + static public function newAttributeObjectValue(Title $property, $value=false, $caption=false) { |
| 223 | + trigger_error("Function newAttributeObjectValue is deprecated. Use new property methods.", E_USER_NOTICE); |
| 224 | + return SMWDataValueFactory::newPropertyObjectValue($property, $value, $caption); |
| 225 | + } |
| 226 | + |
| 227 | + /** |
212 | 228 | * Register a new SMWDataValue class for dealing with some type. Will be included and |
213 | 229 | * instantiated dynamically if needed. |
214 | 230 | */ |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_String.php |
— | — | @@ -23,7 +23,6 @@ |
24 | 24 | $this->m_value = $this->m_xsdvalue; |
25 | 25 | } else { |
26 | 26 | $this->m_value = $this->m_xsdvalue; |
27 | | - //$this->m_infolinks[] = SMWInfolink::newAttributeSearchLink('+', $this->m_attribute, $this->m_value); |
28 | 27 | } |
29 | 28 | } else { |
30 | 29 | $this->addError(wfMsgForContent('smw_emptystring')); |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_NAry.php |
— | — | @@ -69,7 +69,6 @@ |
70 | 70 | $this->m_values[$i] = SMWDataValueFactory::newTypeObjectValue($types[$i], false); |
71 | 71 | } |
72 | 72 | } |
73 | | - //$this->m_infolinks[] = SMWInfolink::newAttributeSearchLink('+', $this->m_attribute, $value); |
74 | 73 | } |
75 | 74 | |
76 | 75 | protected function parseXSDValue($value, $unit) { |
— | — | @@ -102,6 +101,7 @@ |
103 | 102 | } else { |
104 | 103 | // everything specified and passed correctly - set XSDValue of DV containers. |
105 | 104 | for ($i = 0; $i < sizeof($types); $i++) { |
| 105 | + $this->m_values[$i] = SMWDataValueFactory::newTypeObjectValue($types[$i]); |
106 | 106 | $this->m_values[$i]->setXSDValue($values[$i], (is_array($unit)? $units[$i] : null)); |
107 | 107 | } |
108 | 108 | } |
— | — | @@ -228,10 +228,6 @@ |
229 | 229 | return $hash; |
230 | 230 | } |
231 | 231 | |
232 | | - public function isValid() { |
233 | | - return $this->isValid; |
234 | | - } |
235 | | - |
236 | 232 | public function isNumeric() { |
237 | 233 | return false; // the n-ary is clearly non numeric (n-ary values cannot be ordered by numbers) |
238 | 234 | } |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_OldDataValue.php |
— | — | @@ -108,8 +108,6 @@ |
109 | 109 | // additional information about the value and the context in which it was given |
110 | 110 | var $type_handler; //type handler for this object |
111 | 111 | var $infolinks; // an array of additional links provided in long descriptions of the value |
112 | | - var $attribute; // wiki name (without namespace) of the attribute that this value was |
113 | | - // assigned to, or FALSE if no attribute was given. |
114 | 112 | /**#@-*/ |
115 | 113 | |
116 | 114 | /** |
— | — | @@ -121,7 +119,6 @@ |
122 | 120 | $this->clear(); |
123 | 121 | |
124 | 122 | $this->type_handler = $type; |
125 | | - $this->attribute = false; |
126 | 123 | $this->desiredUnits = $desiredUnits; |
127 | 124 | $this->serviceLinks = false; |
128 | 125 | } |
— | — | @@ -196,7 +193,7 @@ |
197 | 194 | * E.g. it is not very user-friendly. -- mak |
198 | 195 | */ |
199 | 196 | function addQuicksearchLink() { |
200 | | - $this->infolinks[] = SMWInfolink::newAttributeSearchLink('+', $this->attribute, $this->vuser); |
| 197 | + $this->infolinks[] = SMWInfolink::newPropertySearchLink('+', $this->m_property, $this->vuser); |
201 | 198 | } |
202 | 199 | |
203 | 200 | /** |
— | — | @@ -242,14 +239,6 @@ |
243 | 240 | } |
244 | 241 | |
245 | 242 | /** |
246 | | - * Set the attribute to which this value refers. Used to generate search links. |
247 | | - * The atriubte is given as a simple wiki text title, without namespace prefix. |
248 | | - */ |
249 | | - function setAttribute($attribute) { |
250 | | - $this->attribute = $attribute; |
251 | | - } |
252 | | - |
253 | | - /** |
254 | 243 | * Set an error message for the current datavalue. The message should be plain |
255 | 244 | * text, possibly with light wiki/html markup. Global styling, especially spans |
256 | 245 | * enclosing the whole message, are not needed. |
— | — | @@ -506,8 +495,8 @@ |
507 | 496 | */ |
508 | 497 | function getDesiredUnits() { |
509 | 498 | // If we don't have a value for this, get it from the attribute. |
510 | | - if ($this->desiredUnits === false && $this->attribute != false) { |
511 | | - $this->desiredUnits = SMWTypeHandlerFactory::getUnitsList($this->attribute); |
| 499 | + if ($this->desiredUnits === false && $this->m_property != false) { |
| 500 | + $this->desiredUnits = SMWTypeHandlerFactory::getUnitsList($this->m_property); |
512 | 501 | } |
513 | 502 | if ($this->desiredUnits === false) { |
514 | 503 | return Array(); |
— | — | @@ -521,8 +510,8 @@ |
522 | 511 | */ |
523 | 512 | function getServiceLinks() { |
524 | 513 | // If we don't have a value for this, get it from the attribute. |
525 | | - if ($this->serviceLinks === false && $this->attribute != false) { |
526 | | - $this->serviceLinks = SMWTypeHandlerFactory::getServiceLinks($this->attribute); |
| 514 | + if ($this->serviceLinks === false && $this->m_property != false) { |
| 515 | + $this->serviceLinks = SMWTypeHandlerFactory::getServiceLinks($this->m_property); |
527 | 516 | } |
528 | 517 | if ($this->serviceLinks === false) { |
529 | 518 | return Array(); |
— | — | @@ -537,8 +526,8 @@ |
538 | 527 | */ |
539 | 528 | function getPossibleValues() { |
540 | 529 | // If we don't have a value for this, get it from the attribute. |
541 | | - if ( $this->attribute != false) { |
542 | | - return SMWTypeHandlerFactory::getPossibleValues($this->attribute); |
| 530 | + if ( $this->m_property != false) { |
| 531 | + return SMWTypeHandlerFactory::getPossibleValues($this->m_property); |
543 | 532 | } else { |
544 | 533 | return Array(); |
545 | 534 | } |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php |
— | — | @@ -603,7 +603,7 @@ |
604 | 604 | } |
605 | 605 | break; |
606 | 606 | case '+': // wildcard |
607 | | - $vd = new SMWValueDescription(SMWDataValueFactory::newAttributeObjectValue($att), SMW_CMP_ANY); |
| 607 | + $vd = new SMWValueDescription(SMWDataValueFactory::newPropertyObjectValue($att), SMW_CMP_ANY); |
608 | 608 | break; |
609 | 609 | default: // fixed value, possibly with comparator addons |
610 | 610 | // for now, treat comparators only if placed before whole value: |
— | — | @@ -627,7 +627,7 @@ |
628 | 628 | } |
629 | 629 | } |
630 | 630 | // TODO: needs extension for n-ary values |
631 | | - $dv = SMWDataValueFactory::newAttributeObjectValue($att, $value); |
| 631 | + $dv = SMWDataValueFactory::newPropertyObjectValue($att, $value); |
632 | 632 | if (!$dv->isValid()) { |
633 | 633 | $this->m_errors = $this->m_errors + $dv->getErrors(); |
634 | 634 | $vd = new SMWValueDescription($dv, SMW_CMP_ANY); |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | */ |
11 | 11 | abstract class SMWDataValue { |
12 | 12 | |
13 | | - protected $m_attribute = false; /// The text label of the respective attribute or false if none given |
| 13 | + protected $m_property = false; /// The text label of the respective property or false if none given |
14 | 14 | protected $m_caption = false; /// The text label to be used for output or false if none given |
15 | 15 | protected $m_errors = array(); /// Array of error text messages |
16 | 16 | protected $m_isset = false; /// True if a value was set. |
— | — | @@ -55,12 +55,12 @@ |
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | | - * Set the attribute to which this value refers. Used to generate search links and |
60 | | - * to find custom settings that relate to the attribute. |
61 | | - * The attribute is given as a simple wiki text title, without namespace prefix. |
| 59 | + * Set the property to which this value refers. Used to generate search links and |
| 60 | + * to find custom settings that relate to the property. |
| 61 | + * The property is given as a simple wiki text title, without namespace prefix. |
62 | 62 | */ |
63 | | - public function setAttribute($attstring) { |
64 | | - $this->m_attribute = $attstring; |
| 63 | + public function setProperty($propertyname) { |
| 64 | + $this->m_property = $propertyname; |
65 | 65 | } |
66 | 66 | |
67 | 67 | public function addInfoLink(SMWInfoLink $link) { |
— | — | @@ -196,9 +196,9 @@ |
197 | 197 | * text, but no more. Result might have no entries but is always an array. |
198 | 198 | */ |
199 | 199 | public function getInfolinks() { |
200 | | - if (!$this->m_hasssearchlink && $this->isValid() && $this->m_attribute) { |
| 200 | + if (!$this->m_hasssearchlink && $this->isValid() && $this->m_property) { |
201 | 201 | $this->m_hasssearchlink = true; |
202 | | - $this->m_infolinks[] = SMWInfolink::newAttributeSearchLink('+', $this->m_attribute, $this->getWikiValue()); |
| 202 | + $this->m_infolinks[] = SMWInfolink::newPropertySearchLink('+', $this->m_property, $this->getWikiValue()); |
203 | 203 | } |
204 | 204 | return $this->m_infolinks; |
205 | 205 | } |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Datatype.php |
— | — | @@ -286,12 +286,9 @@ |
287 | 287 | global $wgContLang; |
288 | 288 | |
289 | 289 | SMWTypeHandlerFactory::$possibleValuesByAttribute[$attribute] = Array(); |
290 | | - $atitle = Title::newFromText($wgContLang->getNsText(SMW_NS_ATTRIBUTE) . ':' . $attribute); |
| 290 | + $atitle = Title::newFromText($wgContLang->getNsText(SMW_NS_PROPERTY) . ':' . $attribute); |
291 | 291 | if ($atitle !== NULL) { |
292 | | - // get special property for possible values. Assume only one such property per attribute. |
293 | 292 | $apvprops = smwfGetStore()->getSpecialValues($atitle, SMW_SP_POSSIBLE_VALUE); |
294 | | - // OBSOLETE: Possible values are separated by commas. |
295 | | - // SMWTypeHandlerFactory::$possibleValuesByAttribute[$attribute] = preg_split('/[,][\s]*/',$apvprops[0]); |
296 | 293 | foreach ($apvprops as $prop ) { |
297 | 294 | SMWTypeHandlerFactory::$possibleValuesByAttribute[$attribute][] = $prop; |
298 | 295 | } |
— | — | @@ -373,138 +370,7 @@ |
374 | 371 | // Booleans can (and more problematic: will) be modelled by two-valued enums; too much choice yields confusion (note that Categories are also addressing a simliar modelling problem already -- let's not introduce three ways of encoding this) |
375 | 372 | //SMWTypeHandlerFactory::announceTypeHandler($smwgContLang->getDatatypeLabel('smw_bool'),'bool','Boolean','SMWBooleanTypeHandler'); |
376 | 373 | |
377 | | - |
378 | | - |
379 | 374 | /*********************************************************************/ |
380 | | -/* Helper classes for storing output of type handlers */ |
381 | | -/*********************************************************************/ |
382 | | - |
383 | | -/** |
384 | | - * This class mainly is a container to store URLs for the factbox in a |
385 | | - * clean way. The class provides methods for creating source code for |
386 | | - * realising them in wiki or html contexts. |
387 | | - */ |
388 | | -class SMWInfolink { |
389 | | - private $target; // the actual link target |
390 | | - private $caption; // the label for the link |
391 | | - private $style; // CSS class of a span to embedd the link into, or |
392 | | - // false if no extra style is required |
393 | | - private $internal; // indicates whether $target is a page name (true) or URL (false) |
394 | | - |
395 | | - /** |
396 | | - * Create a new link to an internal page $target. All parameters are mere strings |
397 | | - * as used by wiki users |
398 | | - */ |
399 | | - static function newInternalLink($caption, $target, $style=false) { |
400 | | - return new SMWInfolink(true,$caption,$target,$style); |
401 | | - } |
402 | | - |
403 | | - /** |
404 | | - * Create a new link to an external location $url. |
405 | | - */ |
406 | | - static function newExternalLink($caption, $url, $style=false) { |
407 | | - return new SMWInfolink(false,$caption,$url,$style); |
408 | | - } |
409 | | - |
410 | | - /** |
411 | | - * Static function to construct links to attribute searches. |
412 | | - */ |
413 | | - static function newAttributeSearchLink($caption,$attribute,$value,$style = 'smwsearch') { |
414 | | - global $wgContLang; |
415 | | - return new SMWInfolink(true,$caption,$wgContLang->getNsText(NS_SPECIAL) . ':SearchByAttribute/' . $attribute . ':=' . $value, $style); |
416 | | - } |
417 | | - |
418 | | - /** |
419 | | - * Static function to construct links to relation searches. |
420 | | - */ |
421 | | - static function newRelationSearchLink($caption,$relation,$object,$style = 'smwsearch') { |
422 | | - global $wgContLang; |
423 | | - return new SMWInfolink(true,$caption,$wgContLang->getNsText(NS_SPECIAL) . ':SearchByRelation/' . $relation . '::' . $object, $style); |
424 | | - } |
425 | | - |
426 | | - /** |
427 | | - * Static function to construct links to inverse relation searches. |
428 | | - */ |
429 | | - static function newInverseRelationSearchLink($caption,$subject,$relation,$style = false) { |
430 | | - global $wgContLang; |
431 | | - return new SMWInfolink(true,$caption,$wgContLang->getNsText(NS_SPECIAL) . ':PageProperty/' . $subject . '::' . $relation, $style); |
432 | | - } |
433 | | - |
434 | | - /** |
435 | | - * Static function to construct links to inverse attribute searches. |
436 | | - */ |
437 | | - static function newInverseAttributeSearchLink($caption,$subject,$attribute,$style = false) { |
438 | | - global $wgContLang; |
439 | | - return new SMWInfolink(true,$caption,$wgContLang->getNsText(NS_SPECIAL) . ':PageProperty/' . $subject . '::' . $attribute, $style); |
440 | | - } |
441 | | - |
442 | | - /** |
443 | | - * Static function to construct links to the browsing special. |
444 | | - */ |
445 | | - static function newBrowsingLink($caption,$titletext,$style = 'smwbrowse') { |
446 | | - global $wgContLang; |
447 | | - return new SMWInfolink(true,$caption,$wgContLang->getNsText(NS_SPECIAL) . ':Browse/' . $titletext, $style); |
448 | | - } |
449 | | - |
450 | | - /** |
451 | | - * Create a new link to some internal page or to some external URL. |
452 | | - */ |
453 | | - function SMWInfolink($internal, $caption, $target, $style=false) { |
454 | | - $this->internal = $internal; |
455 | | - $this->caption = $caption; |
456 | | - $this->target = $target; |
457 | | - $this->style = $style; |
458 | | - } |
459 | | - |
460 | | - /** |
461 | | - * Return hyperlink for this infolink in HTML format. |
462 | | - * @access public |
463 | | - */ |
464 | | - function getHTML($skin) { |
465 | | - if ($this->style !== false) { |
466 | | - $start = "<span class=\"$this->style\">"; |
467 | | - $end = '</span>'; |
468 | | - } else { |
469 | | - $start = ''; |
470 | | - $end = ''; |
471 | | - } |
472 | | - if ($this->internal) { |
473 | | - $title = Title::newFromText($this->target); |
474 | | - if ($title !== NULL) { |
475 | | - return $start . $skin->makeKnownLinkObj(Title::newFromText($this->target), $this->caption) . $end; |
476 | | - } else { |
477 | | - return ''; |
478 | | - } |
479 | | - } else { |
480 | | - return $start . "<a href=\"$this->target\">$this->caption</a>" . $end; |
481 | | - } |
482 | | - } |
483 | | - |
484 | | - /** |
485 | | - * Return hyperlink for this infolink in wiki format. |
486 | | - * @access public |
487 | | - */ |
488 | | - function getWikiText() { |
489 | | - if ($this->style !== false) { |
490 | | - $start = "<span class=\"$this->style\">"; |
491 | | - $end = '</span>'; |
492 | | - } else { |
493 | | - $start = ''; |
494 | | - $end = ''; |
495 | | - } |
496 | | - if ($this->internal) { |
497 | | - if (preg_match('/(.*)(\[|\]|<|>|>|<|{|})(.*)/', $this->target) != 0 ) { |
498 | | - return ''; // give up if illegal characters occur, |
499 | | - // TODO: we would need a skin to provide an ext URL in this case |
500 | | - } |
501 | | - return $start . "[[$this->target|$this->caption]]" . $end; |
502 | | - } else { |
503 | | - return $start . "[$this->target $this->caption]" . $end; |
504 | | - } |
505 | | - } |
506 | | -} |
507 | | - |
508 | | -/*********************************************************************/ |
509 | 375 | /* Basic typehandler classes */ |
510 | 376 | /*********************************************************************/ |
511 | 377 | |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DT_Text.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | class SMWTextTypeHandler implements SMWTypeHandler { |
15 | 15 | |
16 | 16 | function getID() { |
17 | | - return 'text'; |
| 17 | + return '_txt'; |
18 | 18 | } |
19 | 19 | |
20 | 20 | function getXSDType() { |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Factbox.php |
— | — | @@ -6,7 +6,9 @@ |
7 | 7 | * @author Markus Krötzsch |
8 | 8 | */ |
9 | 9 | |
10 | | -require_once('SMW_SemanticData.php'); |
| 10 | +global $smwgIP; |
| 11 | +require_once($smwgIP . '/includes/SMW_SemanticData.php'); |
| 12 | +require_once($smwgIP . '/includes/SMW_Infolink.php'); |
11 | 13 | |
12 | 14 | /** |
13 | 15 | * Static class for representing semantic data, which accepts user |
— | — | @@ -60,9 +62,9 @@ |
61 | 63 | |
62 | 64 | switch ($special) { |
63 | 65 | case false: // normal attribute |
64 | | - $result = SMWDataValueFactory::newAttributeValue($attribute,$value,$caption); |
| 66 | + $result = SMWDataValueFactory::newPropertyValue($attribute,$value,$caption); |
65 | 67 | if ($smwgStoreActive) { |
66 | | - SMWFactbox::$semdata->addAttributeTextValue($attribute,$result); |
| 68 | + SMWFactbox::$semdata->addPropertyValue($attribute,$result); |
67 | 69 | } |
68 | 70 | return $result; |
69 | 71 | case SMW_SP_IMPORTED_FROM: // this requires special handling |
— | — | @@ -109,7 +111,7 @@ |
110 | 112 | SMWFactbox::$semdata->addSpecialValue($special, $value); |
111 | 113 | } |
112 | 114 | } else { |
113 | | - SMWFactbox::$semdata->addRelationTextValue($relation, $value); |
| 115 | + SMWFactbox::$semdata->addPropertyValue($relation, $value); |
114 | 116 | } |
115 | 117 | } |
116 | 118 | |
— | — | @@ -235,7 +237,7 @@ |
236 | 238 | switch ($smwgShowFactbox) { |
237 | 239 | case SMW_FACTBOX_HIDDEN: return true; |
238 | 240 | case SMW_FACTBOX_NONEMPTY: |
239 | | - if ( (!SMWFactbox::$semdata->hasRelations()) && (!SMWFactbox::$semdata->hasAttributes()) && (!SMWFactbox::$semdata->hasSpecialProperties()) ) { |
| 241 | + if ( (!SMWFactbox::$semdata->hasProperties()) && (!SMWFactbox::$semdata->hasSpecialProperties()) ) { |
240 | 242 | return; |
241 | 243 | } |
242 | 244 | } |
— | — | @@ -251,8 +253,7 @@ |
252 | 254 | '<span class="smwfactboxhead">' . wfMsgForContent('smw_factbox_head', $browselink->getWikiText() ) . '</span>' . |
253 | 255 | '<span class="smwrdflink">' . $rdflink->getWikiText() . '</span>' . |
254 | 256 | '<table class="smwfacttable">' . "\n"; |
255 | | - SMWFactbox::printRelations($text); |
256 | | - SMWFactbox::printAttributes($text); |
| 257 | + SMWFactbox::printProperties($text); |
257 | 258 | SMWFactbox::printSpecialProperties($text); |
258 | 259 | $text .= '</table></div>'; |
259 | 260 | } |
— | — | @@ -260,15 +261,15 @@ |
261 | 262 | /** |
262 | 263 | * This method prints attribute values at the bottom of an article. |
263 | 264 | */ |
264 | | - static protected function printAttributes(&$text) { |
265 | | - if (!SMWFactbox::$semdata->hasAttributes()) { |
| 265 | + static protected function printProperties(&$text) { |
| 266 | + if (!SMWFactbox::$semdata->hasProperties()) { |
266 | 267 | return; |
267 | 268 | } |
268 | 269 | |
269 | 270 | //$text .= ' <tr><th class="atthead"></th><th class="atthead">' . wfMsgForContent('smw_att_head') . "</th></tr>\n"; |
270 | 271 | |
271 | | - foreach(SMWFactbox::$semdata->getAttributes() as $attribute) { |
272 | | - $attributeValueArray = SMWFactbox::$semdata->getAttributeValues($attribute); |
| 272 | + foreach(SMWFactbox::$semdata->getProperties() as $attribute) { |
| 273 | + $attributeValueArray = SMWFactbox::$semdata->getPropertyValues($attribute); |
273 | 274 | $text .= '<tr><td class="smwattname">'; |
274 | 275 | $text .= ' [[' . $attribute->getPrefixedText() . '|' . preg_replace('/[\s]/',' ',$attribute->getText(),2) . ']] </td><td class="smwatts">'; |
275 | 276 | // TODO: the preg_replace is a kind of hack to ensure that the left column does not get too narrow; maybe we can find something nicer later |
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Special handling for relation/attribute description pages. |
| 4 | + * Special handling for property description pages. |
5 | 5 | * Some code based on CategoryPage.php |
6 | 6 | * |
7 | 7 | * @author: Markus Krötzsch |
— | — | @@ -13,9 +13,8 @@ |
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Implementation of MediaWiki's Article that shows additional information on |
17 | | - * property pages (Relation: and Attribute:). Very simliar to CategoryPage, but |
18 | | - * with different printout that also displays values for each subject with the |
19 | | - * given property. |
| 17 | + * property pages. Very simliar to CategoryPage, but with different printout |
| 18 | + * that also displays values for each subject with the given property. |
20 | 19 | */ |
21 | 20 | class SMWPropertyPage extends SMWOrderedListPage { |
22 | 21 | |
— | — | @@ -57,11 +56,7 @@ |
58 | 57 | $options->include_boundary = false; |
59 | 58 | $reverse = true; |
60 | 59 | } |
61 | | - if ( $this->mTitle->getNamespace()== SMW_NS_RELATION ) { |
62 | | - $this->articles = $store->getAllRelationSubjects($this->mTitle, $options); |
63 | | - } else { |
64 | | - $this->articles = $store->getAllAttributeSubjects($this->mTitle, $options); |
65 | | - } |
| 60 | + $this->articles = $store->getAllPropertySubjects($this->mTitle, $options); |
66 | 61 | if ($reverse) { |
67 | 62 | $this->articles = array_reverse($this->articles); |
68 | 63 | } |
— | — | @@ -79,16 +74,8 @@ |
80 | 75 | $ti = htmlspecialchars( $this->mTitle->getText() ); |
81 | 76 | $nav = $this->getNavigationLinks(); |
82 | 77 | $r = '<a name="SMWResults"></a>' . $nav . "<div id=\"mw-pages\">\n"; |
83 | | - switch ( $this->mTitle->getNamespace() ) { |
84 | | - case SMW_NS_RELATION: |
85 | | - $r .= '<h2>' . wfMsg('smw_relation_header',$ti) . "</h2>\n"; |
86 | | - $r .= wfMsg('smw_relationarticlecount', min($this->limit, count($this->articles))) . "\n"; |
87 | | - break; |
88 | | - case SMW_NS_ATTRIBUTE: |
89 | | - $r .= '<h2>' . wfMsg('smw_attribute_header',$ti) . "</h2>\n"; |
90 | | - $r .= wfMsg('smw_relationarticlecount', min($this->limit, count($this->articles))) . "\n"; |
91 | | - break; |
92 | | - } |
| 78 | + $r .= '<h2>' . wfMsg('smw_attribute_header',$ti) . "</h2>\n"; |
| 79 | + $r .= wfMsg('smw_relationarticlecount', min($this->limit, count($this->articles))) . "\n"; |
93 | 80 | $r .= $this->shortList( $this->articles, $this->articles_start_char ) . "\n</div>" . $nav; |
94 | 81 | return $r; |
95 | 82 | } |
— | — | @@ -121,50 +108,32 @@ |
122 | 109 | $r .= '<tr><th class="smwattname"><h3>' . htmlspecialchars( $this->articles_start_char[$index] ) . "</h3></th><th></th></tr>\n"; |
123 | 110 | $prevchar = $this->articles_start_char[$index]; |
124 | 111 | } |
125 | | - // Attribute/relation name |
| 112 | + // Property name |
126 | 113 | $searchlink = SMWInfolink::newBrowsingLink('+',$this->articles[$index]->getPrefixedText()); |
127 | 114 | $r .= '<tr><td class="smwattname">' . $this->getSkin()->makeKnownLinkObj( $this->articles[$index], |
128 | 115 | $wgContLang->convert( $this->articles[$index]->getPrefixedText() ) ) . |
129 | 116 | ' ' . $searchlink->getHTML($this->getSkin()) . |
130 | 117 | '</td><td class="smwatts">'; |
131 | | - // Attribute/relation values |
| 118 | + // Property values |
132 | 119 | $ropts = new SMWRequestOptions(); |
133 | 120 | $ropts->limit = 4; |
134 | | - if ($this->mTitle->getNamespace() == SMW_NS_RELATION) { |
135 | | - $objects = $store->getRelationObjects($this->articles[$index], $this->mTitle,$ropts); |
136 | | - $i=0; |
137 | | - foreach ($objects as $object) { |
138 | | - if ($i != 0) { |
139 | | - $r .= ', '; |
140 | | - } |
141 | | - $i++; |
142 | | - if ($i < 4) { |
143 | | - $searchlink = SMWInfolink::newRelationSearchLink('+',$this->mTitle->getText(),$object->getPrefixedText()); |
144 | | - $r .= $this->getSkin()->makeLinkObj($object, $wgContLang->convert( $object->getText() )) . ' ' . $searchlink->getHTML($this->getSkin()); |
145 | | - } else { |
146 | | - $searchlink = SMWInfolink::newInverseRelationSearchLink('…', $this->articles[$index]->getPrefixedText(), $this->mTitle->getText()); |
147 | | - $r .= $searchlink->getHTML($this->getSkin()); |
148 | | - } |
| 121 | + $values = $store->getPropertyValues($this->articles[$index], $this->mTitle, $ropts); |
| 122 | + $i=0; |
| 123 | + foreach ($values as $value) { |
| 124 | + if ($i != 0) { |
| 125 | + $r .= ', '; |
149 | 126 | } |
150 | | - } elseif ($this->mTitle->getNamespace() == SMW_NS_ATTRIBUTE) { |
151 | | - $values = $store->getAttributeValues($this->articles[$index], $this->mTitle, $ropts); |
152 | | - $i=0; |
153 | | - foreach ($values as $value) { |
154 | | - if ($i != 0) { |
155 | | - $r .= ', '; |
| 127 | + $i++; |
| 128 | + if ($i < 4) { |
| 129 | + $r .= $value->getLongHTMLText($this->getSkin()); |
| 130 | + $sep = ' '; |
| 131 | + foreach ($value->getInfolinks() as $link) { |
| 132 | + $r .= $sep . $link->getHTML($this->getSkin()); |
| 133 | + $sep = ' '; // allow breaking for longer lists of infolinks |
156 | 134 | } |
157 | | - $i++; |
158 | | - if ($i < 4) { |
159 | | - $r .= $value->getLongHTMLText($this->getSkin()); |
160 | | - $sep = ' '; |
161 | | - foreach ($value->getInfolinks() as $link) { |
162 | | - $r .= $sep . $link->getHTML($this->getSkin()); |
163 | | - $sep = ' '; // allow breaking for longer lists of infolinks |
164 | | - } |
165 | | - } else { |
166 | | - $searchlink = SMWInfolink::newInverseAttributeSearchLink('…', $this->articles[$index]->getPrefixedText(), $this->mTitle->getText()); |
167 | | - $r .= $searchlink->getHTML($this->getSkin()); |
168 | | - } |
| 135 | + } else { |
| 136 | + $searchlink = SMWInfolink::newInversePropertySearchLink('…', $this->articles[$index]->getPrefixedText(), $this->mTitle->getText()); |
| 137 | + $r .= $searchlink->getHTML($this->getSkin()); |
169 | 138 | } |
170 | 139 | } |
171 | 140 | $r .= "</td></tr>\n"; |
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | |
100 | 100 | public function getTypeID() { |
101 | 101 | if ($this->m_typeid === false) { |
102 | | - $dv = SMWDataValueFactory::newAttributeObjectValue($this->m_title); |
| 102 | + $dv = SMWDataValueFactory::newPropertyObjectValue($this->m_title); |
103 | 103 | $this->m_typeid = $dv->getTypeID(); |
104 | 104 | } |
105 | 105 | return $this->m_typeid; |
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore.php |
— | — | @@ -172,13 +172,10 @@ |
173 | 173 | |
174 | 174 | $sql = 'property_id=' . $db->addQuotes($specialprop) . |
175 | 175 | ' AND value_string=' . $db->addQuotes($stringvalue) . |
176 | | - $this->getSQLConditions($requestoptions,'subject_title','subject_title'); |
177 | | - |
| 176 | + $this->getSQLConditions($requestoptions,'subject_title','subject_title'); |
178 | 177 | $res = $db->select( 'smw_specialprops', |
179 | 178 | 'DISTINCT subject_id', |
180 | 179 | $sql, 'SMW::getSpecialSubjects', $this->getSQLOptions($requestoptions,'subject_title') ); |
181 | | - |
182 | | - // rewrite result as array |
183 | 180 | while($row = $db->fetchObject($res)) { |
184 | 181 | $result[] = Title::newFromID($row->subject_id); |
185 | 182 | } |
— | — | @@ -189,25 +186,23 @@ |
190 | 187 | } |
191 | 188 | |
192 | 189 | |
193 | | - function getAttributeValues(Title $subject, Title $attribute, $requestoptions = NULL, $outputformat = '') { |
| 190 | + function getPropertyValues(Title $subject, Title $property, $requestoptions = NULL, $outputformat = '') { |
194 | 191 | $db =& wfGetDB( DB_SLAVE ); |
195 | 192 | $result = array(); |
196 | 193 | |
197 | | - $id = SMWDataValueFactory::getAttributeObjectTypeID($attribute); |
| 194 | + $id = SMWDataValueFactory::getPropertyObjectTypeID($property); |
198 | 195 | switch ($id) { |
199 | 196 | case '_txt': // long text attribute |
200 | 197 | $res = $db->select( $db->tableName('smw_longstrings'), |
201 | 198 | 'value_blob', |
202 | 199 | 'subject_id=' . $db->addQuotes($subject->getArticleID()) . |
203 | | - ' AND attribute_title=' . $db->addQuotes($attribute->getDBkey()), |
204 | | - 'SMW::getAttributeValues', $this->getSQLOptions($requestoptions) ); |
205 | | - if($db->numRows( $res ) > 0) { |
206 | | - while($row = $db->fetchObject($res)) { |
207 | | - $dv = SMWDataValueFactory::newAttributeObjectValue($attribute); |
208 | | - $dv->setOutputFormat($outputformat); |
209 | | - $dv->setXSDValue($row->value_blob, ''); |
210 | | - $result[] = $dv; |
211 | | - } |
| 200 | + ' AND attribute_title=' . $db->addQuotes($property->getDBkey()), |
| 201 | + 'SMW::getPropertyValues', $this->getSQLOptions($requestoptions) ); |
| 202 | + while($row = $db->fetchObject($res)) { |
| 203 | + $dv = SMWDataValueFactory::newPropertyObjectValue($property); |
| 204 | + $dv->setOutputFormat($outputformat); |
| 205 | + $dv->setXSDValue($row->value_blob, ''); |
| 206 | + $result[] = $dv; |
212 | 207 | } |
213 | 208 | $db->freeResult($res); |
214 | 209 | break; |
— | — | @@ -215,16 +210,14 @@ |
216 | 211 | $res = $db->select( $db->tableName('smw_relations'), |
217 | 212 | 'object_title, object_namespace', |
218 | 213 | 'subject_id=' . $db->addQuotes($subject->getArticleID()) . |
219 | | - ' AND relation_title=' . $db->addQuotes($attribute->getDBkey()) . |
| 214 | + ' AND relation_title=' . $db->addQuotes($property->getDBkey()) . |
220 | 215 | $this->getSQLConditions($requestoptions,'object_title','object_title'), |
221 | | - 'SMW::getAttributeValues', $this->getSQLOptions($requestoptions,'object_title') ); |
222 | | - if($db->numRows( $res ) > 0) { |
223 | | - while($row = $db->fetchObject($res)) { |
224 | | - $dv = SMWDataValueFactory::newTypeIDValue('_wpg'); |
225 | | - $dv->setOutputFormat($outputformat); |
226 | | - $dv->setValues($row->object_title, $row->object_namespace); |
227 | | - $result[] = $dv; |
228 | | - } |
| 216 | + 'SMW::getPropertyValues', $this->getSQLOptions($requestoptions,'object_title') ); |
| 217 | + while($row = $db->fetchObject($res)) { |
| 218 | + $dv = SMWDataValueFactory::newPropertyObjectValue($property); |
| 219 | + $dv->setOutputFormat($outputformat); |
| 220 | + $dv->setValues($row->object_title, $row->object_namespace); |
| 221 | + $result[] = $dv; |
229 | 222 | } |
230 | 223 | $db->freeResult($res); |
231 | 224 | break; |
— | — | @@ -236,57 +229,72 @@ |
237 | 230 | $value_column = 'value_xsd'; |
238 | 231 | } |
239 | 232 | $sql = 'subject_id=' . $db->addQuotes($subject->getArticleID()) . |
240 | | - ' AND attribute_title=' . $db->addQuotes($attribute->getDBkey()) . |
| 233 | + ' AND attribute_title=' . $db->addQuotes($property->getDBkey()) . |
241 | 234 | $this->getSQLConditions($requestoptions,$value_column,'value_xsd'); |
242 | 235 | $res = $db->select( $db->tableName('smw_attributes'), |
243 | 236 | 'value_unit, value_xsd', |
244 | | - $sql, 'SMW::getAttributeValues', $this->getSQLOptions($requestoptions,$value_column) ); |
245 | | - if($db->numRows( $res ) > 0) { |
246 | | - while($row = $db->fetchObject($res)) { |
247 | | - $dv = SMWDataValueFactory::newAttributeObjectValue($attribute); |
248 | | - $dv->setOutputFormat($outputformat); |
249 | | - $dv->setXSDValue($row->value_xsd, $row->value_unit); |
250 | | - $result[] = $dv; |
251 | | - } |
| 237 | + $sql, 'SMW::getPropertyValues', $this->getSQLOptions($requestoptions,$value_column) ); |
| 238 | + while($row = $db->fetchObject($res)) { |
| 239 | + $dv = SMWDataValueFactory::newPropertyObjectValue($property); |
| 240 | + $dv->setOutputFormat($outputformat); |
| 241 | + $dv->setXSDValue($row->value_xsd, $row->value_unit); |
| 242 | + $result[] = $dv; |
252 | 243 | } |
253 | 244 | $db->freeResult($res); |
254 | 245 | } |
255 | 246 | return $result; |
256 | 247 | } |
257 | 248 | |
258 | | - function getAttributeSubjects(Title $attribute, SMWDataValue $value, $requestoptions = NULL) { |
| 249 | + function getPropertySubjects(Title $property, SMWDataValue $value, $requestoptions = NULL) { |
259 | 250 | if ( !$value->isValid() ) { |
260 | 251 | return array(); |
261 | 252 | } |
262 | | - |
| 253 | + $result = array(); |
263 | 254 | $db =& wfGetDB( DB_SLAVE ); |
264 | | - $sql = 'value_xsd=' . $db->addQuotes($value->getXSDValue()) . |
265 | | - ' AND value_unit=' . $db->addQuotes($value->getUnit()) . |
266 | | - ' AND attribute_title=' . $db->addQuotes($attribute->getDBKey()) . |
267 | | - $this->getSQLConditions($requestoptions,'subject_title','subject_title'); |
268 | 255 | |
269 | | - $result = array(); |
270 | | - $res = $db->select( $db->tableName('smw_attributes'), |
| 256 | + switch ($value->getTypeID()) { |
| 257 | + case '_txt': // not supported |
| 258 | + break; |
| 259 | + case '_wpg': // wikipage |
| 260 | + $sql = 'object_namespace=' . $db->addQuotes($value->getNamespace()) . |
| 261 | + ' AND object_title=' . $db->addQuotes($value->getDBKey()) . |
| 262 | + ' AND relation_title=' . $db->addQuotes($property->getDBKey()) . |
| 263 | + $this->getSQLConditions($requestoptions,'subject_title','subject_title'); |
| 264 | + |
| 265 | + $res = $db->select( $db->tableName('smw_relations'), |
| 266 | + 'DISTINCT subject_id', |
| 267 | + $sql, 'SMW::getPropertySubjects', |
| 268 | + $this->getSQLOptions($requestoptions,'subject_title') ); |
| 269 | + while($row = $db->fetchObject($res)) { |
| 270 | + $result[] = Title::newFromID($row->subject_id); |
| 271 | + } |
| 272 | + $db->freeResult($res); |
| 273 | + break; |
| 274 | + default: |
| 275 | + $sql = 'value_xsd=' . $db->addQuotes($value->getXSDValue()) . |
| 276 | + ' AND value_unit=' . $db->addQuotes($value->getUnit()) . |
| 277 | + ' AND attribute_title=' . $db->addQuotes($property->getDBKey()) . |
| 278 | + $this->getSQLConditions($requestoptions,'subject_title','subject_title'); |
| 279 | + $res = $db->select( $db->tableName('smw_attributes'), |
271 | 280 | 'DISTINCT subject_id', |
272 | | - $sql, 'SMW::getAttributeSubjects', $this->getSQLOptions($requestoptions,'subject_title') ); |
273 | | - if($db->numRows( $res ) > 0) { |
| 281 | + $sql, 'SMW::getPropertySubjects', |
| 282 | + $this->getSQLOptions($requestoptions,'subject_title') ); |
274 | 283 | while($row = $db->fetchObject($res)) { |
275 | 284 | $result[] = Title::newFromID($row->subject_id); |
276 | 285 | } |
| 286 | + $db->freeResult($res); |
| 287 | + break; |
277 | 288 | } |
278 | | - $db->freeResult($res); |
279 | | - // long strings not supported for this operation |
280 | | - |
281 | 289 | return $result; |
282 | 290 | } |
283 | 291 | |
284 | | - function getAllAttributeSubjects(Title $attribute, $requestoptions = NULL) { |
| 292 | + function getAllPropertySubjects(Title $property, $requestoptions = NULL) { |
285 | 293 | $db =& wfGetDB( DB_SLAVE ); |
286 | | - $sql = 'attribute_title=' . $db->addQuotes($attribute->getDBkey()) . |
| 294 | + $sql = 'attribute_title=' . $db->addQuotes($property->getDBkey()) . |
287 | 295 | $this->getSQLConditions($requestoptions,'subject_title','subject_title'); |
288 | 296 | |
289 | 297 | $result = array(); |
290 | | - $id = SMWDataValueFactory::getAttributeObjectTypeID($attribute); |
| 298 | + $id = SMWDataValueFactory::getPropertyObjectTypeID($property); |
291 | 299 | switch ($id) { |
292 | 300 | case '_txt': |
293 | 301 | $res = $db->select( $db->tableName('smw_longstrings'), |
— | — | @@ -300,10 +308,22 @@ |
301 | 309 | } |
302 | 310 | $db->freeResult($res); |
303 | 311 | break; |
| 312 | + case '_wpg': |
| 313 | + $sql = 'relation_title=' . $db->addQuotes($property->getDBkey()) . |
| 314 | + $this->getSQLConditions($requestoptions,'subject_title','subject_title'); |
| 315 | + $res = $db->select( $db->tableName('smw_relations'), |
| 316 | + 'DISTINCT subject_id', |
| 317 | + $sql, 'SMW::getAllAttributeSubjects', |
| 318 | + $this->getSQLOptions($requestoptions,'subject_title') ); |
| 319 | + while($row = $db->fetchObject($res)) { |
| 320 | + $result[] = Title::newFromId($row->subject_id); |
| 321 | + } |
| 322 | + $db->freeResult($res); |
| 323 | + break; |
304 | 324 | default: |
305 | 325 | $res = $db->select( $db->tableName('smw_attributes'), |
306 | 326 | 'DISTINCT subject_id', |
307 | | - $sql, 'SMW::getAllAttributeSubjects', |
| 327 | + $sql, 'SMW::getAllAttributeSubjects', |
308 | 328 | $this->getSQLOptions($requestoptions,'subject_title') ); |
309 | 329 | if($db->numRows( $res ) > 0) { |
310 | 330 | while($row = $db->fetchObject($res)) { |
— | — | @@ -315,14 +335,14 @@ |
316 | 336 | return $result; |
317 | 337 | } |
318 | 338 | |
319 | | - function getAttributes(Title $subject, $requestoptions = NULL) { |
| 339 | + function getProperties(Title $subject, $requestoptions = NULL) { |
320 | 340 | $db =& wfGetDB( DB_SLAVE ); |
321 | 341 | $sql = 'subject_id=' . $db->addQuotes($subject->getArticleID()) . $this->getSQLConditions($requestoptions,'attribute_title','attribute_title'); |
322 | 342 | |
323 | 343 | $result = array(); |
324 | 344 | $res = $db->select( $db->tableName('smw_attributes'), |
325 | 345 | 'DISTINCT attribute_title', |
326 | | - $sql, 'SMW::getAttributes', $this->getSQLOptions($requestoptions,'attribute_title') ); |
| 346 | + $sql, 'SMW::getProperties', $this->getSQLOptions($requestoptions,'attribute_title') ); |
327 | 347 | if ($db->numRows( $res ) > 0) { |
328 | 348 | while($row = $db->fetchObject($res)) { |
329 | 349 | $result[] = Title::newFromText($row->attribute_title, SMW_NS_ATTRIBUTE); |
— | — | @@ -331,7 +351,7 @@ |
332 | 352 | $db->freeResult($res); |
333 | 353 | $res = $db->select( $db->tableName('smw_longstrings'), |
334 | 354 | 'DISTINCT attribute_title', |
335 | | - $sql, 'SMW::getAttributes', $this->getSQLOptions($requestoptions,'attribute_title') ); |
| 355 | + $sql, 'SMW::getProperties', $this->getSQLOptions($requestoptions,'attribute_title') ); |
336 | 356 | if ($db->numRows( $res ) > 0) { |
337 | 357 | while($row = $db->fetchObject($res)) { |
338 | 358 | $result[] = Title::newFromText($row->attribute_title, SMW_NS_ATTRIBUTE); |
— | — | @@ -339,23 +359,14 @@ |
340 | 360 | } |
341 | 361 | $db->freeResult($res); |
342 | 362 | |
343 | | - return $result; |
344 | | - } |
345 | | - |
346 | | - function getRelationObjects(Title $subject, Title $relation, $requestoptions = NULL) { |
347 | | - $db =& wfGetDB( DB_SLAVE ); |
348 | 363 | $sql = 'subject_id=' . $db->addQuotes($subject->getArticleID()) . |
349 | | - ' AND relation_title=' . $db->addQuotes($relation->getDBKey()) . |
350 | | - $this->getSQLConditions($requestoptions,'object_title','object_title'); |
351 | | - |
| 364 | + $this->getSQLConditions($requestoptions,'relation_title','relation_title'); |
352 | 365 | $res = $db->select( $db->tableName('smw_relations'), |
353 | | - 'object_title, object_namespace', |
354 | | - $sql, 'SMW::getRelationObjects', $this->getSQLOptions($requestoptions,'object_title') ); |
355 | | - // rewrite result as array |
356 | | - $result = array(); |
| 366 | + 'DISTINCT relation_title', |
| 367 | + $sql, 'SMW::getOutRelations', $this->getSQLOptions($requestoptions,'relation_title') ); |
357 | 368 | if($db->numRows( $res ) > 0) { |
358 | 369 | while($row = $db->fetchObject($res)) { |
359 | | - $result[] = Title::newFromText($row->object_title, $row->object_namespace); |
| 370 | + $result[] = Title::newFromText($row->relation_title, SMW_NS_ATTRIBUTE); |
360 | 371 | } |
361 | 372 | } |
362 | 373 | $db->freeResult($res); |
— | — | @@ -363,89 +374,129 @@ |
364 | 375 | return $result; |
365 | 376 | } |
366 | 377 | |
367 | | - function getRelationSubjects(Title $relation, Title $object, $requestoptions = NULL) { |
| 378 | + function getInProperties(SMWDataValue $value, $requestoptions = NULL) { |
368 | 379 | $db =& wfGetDB( DB_SLAVE ); |
369 | | - $sql = 'object_namespace=' . $db->addQuotes($object->getNamespace()) . |
370 | | - ' AND object_title=' . $db->addQuotes($object->getDBKey()) . |
371 | | - ' AND relation_title=' . $db->addQuotes($relation->getDBKey()) . |
372 | | - $this->getSQLConditions($requestoptions,'subject_title','subject_title'); |
373 | | - |
374 | | - $res = $db->select( $db->tableName('smw_relations'), |
375 | | - 'DISTINCT subject_id', |
376 | | - $sql, 'SMW::getRelationSubjects', $this->getSQLOptions($requestoptions,'subject_title') ); |
377 | | - // rewrite result as array |
378 | 380 | $result = array(); |
379 | | - if($db->numRows( $res ) > 0) { |
| 381 | + if ($value->getTypeID() == '_wpg') { |
| 382 | + $sql = 'object_namespace=' . $db->addQuotes($value->getNamespace()) . |
| 383 | + ' AND object_title=' . $db->addQuotes($value->getDBKey()) . |
| 384 | + $this->getSQLConditions($requestoptions,'relation_title','relation_title'); |
| 385 | + |
| 386 | + $res = $db->select( $db->tableName('smw_relations'), |
| 387 | + 'DISTINCT relation_title', |
| 388 | + $sql, 'SMW::getInRelations', $this->getSQLOptions($requestoptions,'relation_title') ); |
380 | 389 | while($row = $db->fetchObject($res)) { |
381 | | - $result[] = Title::newFromID($row->subject_id); |
| 390 | + $result[] = Title::newFromText($row->relation_title, SMW_NS_RELATION); |
382 | 391 | } |
| 392 | + $db->freeResult($res); |
383 | 393 | } |
384 | | - $db->freeResult($res); |
385 | | - |
386 | 394 | return $result; |
387 | 395 | } |
388 | 396 | |
389 | | - function getAllRelationSubjects(Title $relation, $requestoptions = NULL) { |
390 | | - $db =& wfGetDB( DB_SLAVE ); |
391 | | - $sql = 'relation_title=' . $db->addQuotes($relation->getDBkey()) . |
392 | | - $this->getSQLConditions($requestoptions,'subject_title','subject_title'); |
| 397 | +// function getRelationObjects(Title $subject, Title $relation, $requestoptions = NULL) { |
| 398 | +// $db =& wfGetDB( DB_SLAVE ); |
| 399 | +// $sql = 'subject_id=' . $db->addQuotes($subject->getArticleID()) . |
| 400 | +// ' AND relation_title=' . $db->addQuotes($relation->getDBKey()) . |
| 401 | +// $this->getSQLConditions($requestoptions,'object_title','object_title'); |
| 402 | +// |
| 403 | +// $res = $db->select( $db->tableName('smw_relations'), |
| 404 | +// 'object_title, object_namespace', |
| 405 | +// $sql, 'SMW::getRelationObjects', $this->getSQLOptions($requestoptions,'object_title') ); |
| 406 | +// // rewrite result as array |
| 407 | +// $result = array(); |
| 408 | +// if($db->numRows( $res ) > 0) { |
| 409 | +// while($row = $db->fetchObject($res)) { |
| 410 | +// $result[] = Title::newFromText($row->object_title, $row->object_namespace); |
| 411 | +// } |
| 412 | +// } |
| 413 | +// $db->freeResult($res); |
| 414 | +// |
| 415 | +// return $result; |
| 416 | +// } |
393 | 417 | |
394 | | - $res = $db->select( $db->tableName('smw_relations'), |
395 | | - 'DISTINCT subject_id', |
396 | | - $sql, 'SMW::getAllRelationSubjects', $this->getSQLOptions($requestoptions,'subject_title') ); |
397 | | - // rewrite result as array |
398 | | - $result = array(); |
399 | | - if($db->numRows( $res ) > 0) { |
400 | | - while($row = $db->fetchObject($res)) { |
401 | | - $result[] = Title::newFromId($row->subject_id); |
402 | | - } |
403 | | - } |
404 | | - $db->freeResult($res); |
| 418 | +// function getRelationSubjects(Title $relation, Title $object, $requestoptions = NULL) { |
| 419 | +// $db =& wfGetDB( DB_SLAVE ); |
| 420 | +// $sql = 'object_namespace=' . $db->addQuotes($object->getNamespace()) . |
| 421 | +// ' AND object_title=' . $db->addQuotes($object->getDBKey()) . |
| 422 | +// ' AND relation_title=' . $db->addQuotes($relation->getDBKey()) . |
| 423 | +// $this->getSQLConditions($requestoptions,'subject_title','subject_title'); |
| 424 | +// |
| 425 | +// $res = $db->select( $db->tableName('smw_relations'), |
| 426 | +// 'DISTINCT subject_id', |
| 427 | +// $sql, 'SMW::getRelationSubjects', $this->getSQLOptions($requestoptions,'subject_title') ); |
| 428 | +// // rewrite result as array |
| 429 | +// $result = array(); |
| 430 | +// if($db->numRows( $res ) > 0) { |
| 431 | +// while($row = $db->fetchObject($res)) { |
| 432 | +// $result[] = Title::newFromID($row->subject_id); |
| 433 | +// } |
| 434 | +// } |
| 435 | +// $db->freeResult($res); |
| 436 | +// |
| 437 | +// return $result; |
| 438 | +// } |
405 | 439 | |
406 | | - return $result; |
407 | | - } |
| 440 | +// function getAllRelationSubjects(Title $relation, $requestoptions = NULL) { |
| 441 | +// $db =& wfGetDB( DB_SLAVE ); |
| 442 | +// $sql = 'relation_title=' . $db->addQuotes($relation->getDBkey()) . |
| 443 | +// $this->getSQLConditions($requestoptions,'subject_title','subject_title'); |
| 444 | +// |
| 445 | +// $res = $db->select( $db->tableName('smw_relations'), |
| 446 | +// 'DISTINCT subject_id', |
| 447 | +// $sql, 'SMW::getAllRelationSubjects', $this->getSQLOptions($requestoptions,'subject_title') ); |
| 448 | +// // rewrite result as array |
| 449 | +// $result = array(); |
| 450 | +// if($db->numRows( $res ) > 0) { |
| 451 | +// while($row = $db->fetchObject($res)) { |
| 452 | +// $result[] = Title::newFromId($row->subject_id); |
| 453 | +// } |
| 454 | +// } |
| 455 | +// $db->freeResult($res); |
| 456 | +// |
| 457 | +// return $result; |
| 458 | +// } |
408 | 459 | |
409 | | - function getOutRelations(Title $subject, $requestoptions = NULL) { |
410 | | - $db =& wfGetDB( DB_SLAVE ); |
411 | | - $sql = 'subject_id=' . $db->addQuotes($subject->getArticleID()) . |
412 | | - $this->getSQLConditions($requestoptions,'relation_title','relation_title'); |
| 460 | +// function getOutRelations(Title $subject, $requestoptions = NULL) { |
| 461 | +// $db =& wfGetDB( DB_SLAVE ); |
| 462 | +// $sql = 'subject_id=' . $db->addQuotes($subject->getArticleID()) . |
| 463 | +// $this->getSQLConditions($requestoptions,'relation_title','relation_title'); |
| 464 | +// |
| 465 | +// $res = $db->select( $db->tableName('smw_relations'), |
| 466 | +// 'DISTINCT relation_title', |
| 467 | +// $sql, 'SMW::getOutRelations', $this->getSQLOptions($requestoptions,'relation_title') ); |
| 468 | +// // rewrite result as array |
| 469 | +// $result = array(); |
| 470 | +// if($db->numRows( $res ) > 0) { |
| 471 | +// while($row = $db->fetchObject($res)) { |
| 472 | +// $result[] = Title::newFromText($row->relation_title, SMW_NS_RELATION); |
| 473 | +// } |
| 474 | +// } |
| 475 | +// $db->freeResult($res); |
| 476 | +// |
| 477 | +// return $result; |
| 478 | +// } |
413 | 479 | |
414 | | - $res = $db->select( $db->tableName('smw_relations'), |
415 | | - 'DISTINCT relation_title', |
416 | | - $sql, 'SMW::getOutRelations', $this->getSQLOptions($requestoptions,'relation_title') ); |
417 | | - // rewrite result as array |
418 | | - $result = array(); |
419 | | - if($db->numRows( $res ) > 0) { |
420 | | - while($row = $db->fetchObject($res)) { |
421 | | - $result[] = Title::newFromText($row->relation_title, SMW_NS_RELATION); |
422 | | - } |
423 | | - } |
424 | | - $db->freeResult($res); |
| 480 | +// function getInRelations(Title $object, $requestoptions = NULL) { |
| 481 | +// $db =& wfGetDB( DB_SLAVE ); |
| 482 | +// $sql = 'object_namespace=' . $db->addQuotes($object->getNamespace()) . |
| 483 | +// ' AND object_title=' . $db->addQuotes($object->getDBKey()) . |
| 484 | +// $this->getSQLConditions($requestoptions,'relation_title','relation_title'); |
| 485 | +// |
| 486 | +// $res = $db->select( $db->tableName('smw_relations'), |
| 487 | +// 'DISTINCT relation_title', |
| 488 | +// $sql, 'SMW::getInRelations', $this->getSQLOptions($requestoptions,'relation_title') ); |
| 489 | +// // rewrite result as array |
| 490 | +// $result = array(); |
| 491 | +// if($db->numRows( $res ) > 0) { |
| 492 | +// while($row = $db->fetchObject($res)) { |
| 493 | +// $result[] = Title::newFromText($row->relation_title, SMW_NS_RELATION); |
| 494 | +// } |
| 495 | +// } |
| 496 | +// $db->freeResult($res); |
| 497 | +// |
| 498 | +// return $result; |
| 499 | +// } |
425 | 500 | |
426 | | - return $result; |
427 | | - } |
428 | | - |
429 | | - function getInRelations(Title $object, $requestoptions = NULL) { |
430 | | - $db =& wfGetDB( DB_SLAVE ); |
431 | | - $sql = 'object_namespace=' . $db->addQuotes($object->getNamespace()) . |
432 | | - ' AND object_title=' . $db->addQuotes($object->getDBKey()) . |
433 | | - $this->getSQLConditions($requestoptions,'relation_title','relation_title'); |
434 | | - |
435 | | - $res = $db->select( $db->tableName('smw_relations'), |
436 | | - 'DISTINCT relation_title', |
437 | | - $sql, 'SMW::getInRelations', $this->getSQLOptions($requestoptions,'relation_title') ); |
438 | | - // rewrite result as array |
439 | | - $result = array(); |
440 | | - if($db->numRows( $res ) > 0) { |
441 | | - while($row = $db->fetchObject($res)) { |
442 | | - $result[] = Title::newFromText($row->relation_title, SMW_NS_RELATION); |
443 | | - } |
444 | | - } |
445 | | - $db->freeResult($res); |
446 | | - |
447 | | - return $result; |
448 | | - } |
449 | | - |
450 | 501 | ///// Writing methods ///// |
451 | 502 | |
452 | 503 | function deleteSubject(Title $subject) { |
— | — | @@ -481,49 +532,36 @@ |
482 | 533 | $up_specials = array(); |
483 | 534 | $up_subprops = array(); |
484 | 535 | |
485 | | - // relations |
486 | | - foreach($data->getRelations() as $relation) { |
487 | | - foreach($data->getRelationObjects($relation) as $object) { |
488 | | - $up_relations[] = |
489 | | - array( 'subject_id' => $subject->getArticleID(), |
490 | | - 'subject_namespace' => $subject->getNamespace(), |
491 | | - 'subject_title' => $subject->getDBkey(), |
492 | | - 'relation_title' => $relation->getDBkey(), |
493 | | - 'object_namespace' => $object->getNamespace(), |
494 | | - 'object_title' => $object->getDBkey() ); |
495 | | - } |
496 | | - } |
497 | | - |
498 | | - //attributes |
499 | | - foreach($data->getAttributes() as $attribute) { |
500 | | - $attributeValueArray = $data->getAttributeValues($attribute); |
501 | | - foreach($attributeValueArray as $value) { |
| 536 | + //properties |
| 537 | + foreach($data->getProperties() as $property) { |
| 538 | + $propertyValueArray = $data->getPropertyValues($property); |
| 539 | + foreach($propertyValueArray as $value) { |
502 | 540 | if ($value->isValid()) { |
503 | | - if ($value->getTypeID() !== '_txt') { |
| 541 | + if ($value->getTypeID() == '_txt') { |
| 542 | + $up_longstrings[] = |
| 543 | + array( 'subject_id' => $subject->getArticleID(), |
| 544 | + 'subject_namespace' => $subject->getNamespace(), |
| 545 | + 'subject_title' => $subject->getDBkey(), |
| 546 | + 'attribute_title' => $property->getDBkey(), |
| 547 | + 'value_blob' => $value->getXSDValue() ); |
| 548 | + } elseif ($value->getTypeID() == '_wpg') { // f.k.a. "Relation" |
| 549 | + $up_relations[] = |
| 550 | + array( 'subject_id' => $subject->getArticleID(), |
| 551 | + 'subject_namespace' => $subject->getNamespace(), |
| 552 | + 'subject_title' => $subject->getDBkey(), |
| 553 | + 'relation_title' => $property->getDBkey(), |
| 554 | + 'object_namespace' => $value->getNamespace(), |
| 555 | + 'object_title' => $value->getDBkey() ); |
| 556 | + } else { |
504 | 557 | $up_attributes[] = |
505 | 558 | array( 'subject_id' => $subject->getArticleID(), |
506 | 559 | 'subject_namespace' => $subject->getNamespace(), |
507 | 560 | 'subject_title' => $subject->getDBkey(), |
508 | | - 'attribute_title' => $attribute->getDBkey(), |
| 561 | + 'attribute_title' => $property->getDBkey(), |
509 | 562 | 'value_unit' => $value->getUnit(), |
510 | 563 | 'value_datatype' => $value->getTypeID(), |
511 | 564 | 'value_xsd' => $value->getXSDValue(), |
512 | 565 | 'value_num' => $value->getNumericValue() ); |
513 | | - } elseif ($value->getTypeID() !== '_wpg') { // f.k.a. "Relation" |
514 | | - $up_relations[] = |
515 | | - array( 'subject_id' => $subject->getArticleID(), |
516 | | - 'subject_namespace' => $subject->getNamespace(), |
517 | | - 'subject_title' => $subject->getDBkey(), |
518 | | - 'relation_title' => $attribute->getDBkey(), |
519 | | - 'object_namespace' => $value->getNamespace(), |
520 | | - 'object_title' => $value->getDBkey() ); |
521 | | - } else { |
522 | | - $up_longstrings[] = |
523 | | - array( 'subject_id' => $subject->getArticleID(), |
524 | | - 'subject_namespace' => $subject->getNamespace(), |
525 | | - 'subject_title' => $subject->getDBkey(), |
526 | | - 'attribute_title' => $attribute->getDBkey(), |
527 | | - 'value_blob' => $value->getXSDValue() ); |
528 | 566 | } |
529 | 567 | } |
530 | 568 | } |
— | — | @@ -747,7 +785,7 @@ |
748 | 786 | $row[] = new SMWResultArray($this->getSpecialValues($qt,SMW_SP_HAS_CATEGORY), $pr); |
749 | 787 | break; |
750 | 788 | case SMW_PRINT_ATTS: |
751 | | - $row[] = new SMWResultArray($this->getAttributeValues($qt,$pr->getTitle(), NULL, $pr->getOutputFormat()), $pr); |
| 789 | + $row[] = new SMWResultArray($this->getPropertyValues($qt,$pr->getTitle(), NULL, $pr->getOutputFormat()), $pr); |
752 | 790 | break; |
753 | 791 | } |
754 | 792 | } |
— | — | @@ -1269,7 +1307,7 @@ |
1270 | 1308 | } |
1271 | 1309 | } |
1272 | 1310 | } elseif ($description instanceof SMWSomeAttribute) { |
1273 | | - $id = SMWDataValueFactory::getAttributeObjectTypeID($description->getAttribute()); |
| 1311 | + $id = SMWDataValueFactory::getPropertyObjectTypeID($description->getAttribute()); |
1274 | 1312 | switch ($id) { |
1275 | 1313 | case '_txt': |
1276 | 1314 | $table = 'TEXT'; |
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Store.php |
— | — | @@ -129,60 +129,144 @@ |
130 | 130 | abstract function getSpecialSubjects($specialprop, $value, $requestoptions = NULL); |
131 | 131 | |
132 | 132 | /** |
| 133 | + * Get an array of all property values stored for the given subject and property. The result |
| 134 | + * is an array of SMWDataValue objects. The provided outputformat is a string identifier that |
| 135 | + * may be used by the datavalues to modify their output behaviour, e.g. when interpreted as a |
| 136 | + * desired unit to convert the output to. |
| 137 | + */ |
| 138 | + abstract function getPropertyValues(Title $subject, Title $property, $requestoptions = NULL, $outputformat = ''); |
| 139 | + |
| 140 | + /** |
| 141 | + * Get an array of all subjects that have the given value for the given property. The |
| 142 | + * result is an array of Title objects. |
| 143 | + */ |
| 144 | + abstract function getPropertySubjects(Title $property, SMWDataValue $value, $requestoptions = NULL); |
| 145 | + |
| 146 | + /** |
| 147 | + * Get an array of all subjects that have some value for the given property. The |
| 148 | + * result is an array of Title objects. |
| 149 | + */ |
| 150 | + abstract function getAllPropertySubjects(Title $property, $requestoptions = NULL); |
| 151 | + |
| 152 | + /** |
| 153 | + * Get an array of all properties for which the given subject has some value. The result is an |
| 154 | + * array of Title objects. |
| 155 | + */ |
| 156 | + abstract function getProperties(Title $subject, $requestoptions = NULL); |
| 157 | + |
| 158 | + /** |
| 159 | + * Get an array of all properties for which there is some subject that relates to the given value. |
| 160 | + * The result is an array of Title objects. |
| 161 | + * This function might be implemented partially so that only values of type Page (_wpg) are supported. |
| 162 | + */ |
| 163 | + abstract function getInProperties(SMWDataValue $object, $requestoptions = NULL); |
| 164 | + |
| 165 | + |
| 166 | + |
| 167 | +////// Transition methods (deprecated) |
| 168 | + |
| 169 | + /** |
133 | 170 | * Get an array of all attribute values stored for the given subject and atttribute. The result |
134 | 171 | * is an array of SMWDataValue objects. The provided outputformat is a string identifier that |
135 | 172 | * may be used by the datavalues to modify their output behaviour, e.g. when interpreted as a |
136 | 173 | * desierd unit to convert the output to. |
| 174 | + * @DEPRECATED |
137 | 175 | */ |
138 | | - abstract function getAttributeValues(Title $subject, Title $attribute, $requestoptions = NULL, $outputformat = ''); |
| 176 | + function getAttributeValues(Title $subject, Title $attribute, $requestoptions = NULL, $outputformat = '') { |
| 177 | + trigger_error("Function getAttributeValues is deprecated. Use new property methods.", E_USER_NOTICE); |
| 178 | + return $this->getPropertyValues($subject, $attribute, $requestoptions, $outputformat); |
| 179 | + } |
139 | 180 | |
140 | 181 | /** |
141 | 182 | * Get an array of all subjects that have the given value for the given attribute. The |
142 | 183 | * result is an array of Title objects. |
| 184 | + * @DEPRECATED |
143 | 185 | */ |
144 | | - abstract function getAttributeSubjects(Title $relation, SMWDataValue $value, $requestoptions = NULL); |
| 186 | + function getAttributeSubjects(Title $attribute, SMWDataValue $value, $requestoptions = NULL) { |
| 187 | + trigger_error("Function getAttributeSubjects is deprecated. Use new property methods.", E_USER_NOTICE); |
| 188 | + return $this->getPropertySubjects($attribute,$value,$requestoptions); |
| 189 | + } |
145 | 190 | |
146 | 191 | /** |
147 | 192 | * Get an array of all subjects that have some value for the given attribute. The |
148 | 193 | * result is an array of Title objects. |
| 194 | + * @DEPRECATED |
149 | 195 | */ |
150 | | - abstract function getAllAttributeSubjects(Title $attribute, $requestoptions = NULL); |
| 196 | + function getAllAttributeSubjects(Title $attribute, $requestoptions = NULL) { |
| 197 | + trigger_error("Function getAllAttributeSubjects is deprecated. Use new property methods.", E_USER_NOTICE); |
| 198 | + return $this->getAllPropertySubjects($attribute,$requestoptions); |
| 199 | + } |
151 | 200 | |
152 | 201 | /** |
153 | 202 | * Get an array of all attributes for which the given subject has some value. The result is an |
154 | 203 | * array of Title objects. |
| 204 | + * @DEPRECATED |
155 | 205 | */ |
156 | | - abstract function getAttributes(Title $subject, $requestoptions = NULL); |
| 206 | + function getAttributes(Title $subject, $requestoptions = NULL) { |
| 207 | + trigger_error("Function getAttributes is deprecated. Use new property methods.", E_USER_NOTICE); |
| 208 | + return $this->getProperties($subject, $requestoptions); |
| 209 | + } |
157 | 210 | |
158 | 211 | /** |
159 | 212 | * Get an array of all objects that a given subject relates to via the given relation. The |
160 | 213 | * result is an array of Title objects. |
| 214 | + * @DEPRECATED |
161 | 215 | */ |
162 | | - abstract function getRelationObjects(Title $subject, Title $relation, $requestoptions = NULL); |
| 216 | + function getRelationObjects(Title $subject, Title $relation, $requestoptions = NULL) { |
| 217 | + trigger_error("Function getRelationObjects is deprecated. Use new property methods.", E_USER_NOTICE); |
| 218 | + $dvs = $this->getPropertyValues($subject, $relation, $requestoptions); |
| 219 | + $result = array(); |
| 220 | + foreach ($dvs as $dv) { |
| 221 | + if ($dv->getTypeID() == '_wpg') { |
| 222 | + $result[] = $dv->getTitle(); |
| 223 | + } |
| 224 | + } |
| 225 | + return $result; |
| 226 | + } |
163 | 227 | |
164 | 228 | /** |
165 | 229 | * Get an array of all subjects that are related to a given object via the given relation. The |
166 | 230 | * result is an array of Title objects. |
| 231 | + * @DEPRECATED |
167 | 232 | */ |
168 | | - abstract function getRelationSubjects(Title $relation, Title $object, $requestoptions = NULL); |
| 233 | + function getRelationSubjects(Title $relation, Title $object, $requestoptions = NULL) { |
| 234 | + trigger_error("Function getRelationSubjects is deprecated. Use new property methods.", E_USER_NOTICE); |
| 235 | + $value = SMWDataValueFactory::newTypeIDValue('_wpg'); |
| 236 | + $value->setValues($object->getDBKey(), $object->getNamespace()); |
| 237 | + return $this->getPropertySubjects($relation, $value, $requestoptions); |
| 238 | + } |
169 | 239 | |
170 | 240 | /** |
171 | 241 | * Get an array of all subjects that relate to some object via the given relation. The |
172 | 242 | * result is an array of Title objects. |
| 243 | + * @DEPRECATED |
173 | 244 | */ |
174 | | - abstract function getAllRelationSubjects(Title $relation, $requestoptions = NULL); |
| 245 | + function getAllRelationSubjects(Title $relation, $requestoptions = NULL) { |
| 246 | + trigger_error("Function getAllPropertySubjects is deprecated. Use new property methods.", E_USER_NOTICE); |
| 247 | + return $this->getAllPropertySubjects($relation, $requestoptions); |
| 248 | + } |
175 | 249 | |
176 | 250 | /** |
177 | 251 | * Get an array of all relations via which the given subject relates to some object. The result is an |
178 | 252 | * array of Title objects. |
| 253 | + * @DEPRECATED |
179 | 254 | */ |
180 | | - abstract function getOutRelations(Title $subject, $requestoptions = NULL); |
| 255 | + function getOutRelations(Title $subject, $requestoptions = NULL) { |
| 256 | + trigger_error("Function getOutRelations is deprecated. Use new property methods.", E_USER_NOTICE); |
| 257 | + return $this->getProperties($subject, $requestoptions); |
| 258 | + } |
181 | 259 | |
182 | 260 | /** |
183 | 261 | * Get an array of all relations for which there is some subject that relates to the given object. |
184 | 262 | * The result is an array of Title objects. |
| 263 | + * @DEPRECATED |
185 | 264 | */ |
186 | | - abstract function getInRelations(Title $object, $requestoptions = NULL); |
| 265 | + function getInRelations(Title $object, $requestoptions = NULL) { |
| 266 | + trigger_error("Function getInRelations is deprecated. Use new property methods.", E_USER_NOTICE); |
| 267 | + $value = SMWDataValueFactory::newTypeIDValue('_wpg'); |
| 268 | + $value->setValues($object->getDBKey(), $object->getNamespace()); |
| 269 | + return $this->getInProperties($value,$requestoptions); |
| 270 | + } |
187 | 271 | |
188 | 272 | ///// Writing methods ///// |
189 | 273 | |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_URI.php |
— | — | @@ -62,7 +62,6 @@ |
63 | 63 | break; |
64 | 64 | } |
65 | 65 | $this->m_value = str_replace(array('&','<',' '),array('&','<','_'),$value); // TODO: spaces are just not allowed and should lead to an error |
66 | | - $this->m_infolinks[] = SMWInfolink::newAttributeSearchLink('+', $this->m_attribute, $this->m_value); |
67 | 66 | } else { |
68 | 67 | $this->addError(wfMsgForContent('smw_emptystring')); |
69 | 68 | } |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageRu.php |
— | — | @@ -147,22 +147,13 @@ |
148 | 148 | 'smw_ask_ascorder' => 'По возрастанию', |
149 | 149 | 'smw_ask_descorder' => 'По убыванию', |
150 | 150 | 'smw_ask_submit' => 'Найти', |
151 | | - // Messages for search by relation Special |
152 | | - 'searchbyrelation' => 'Искать по отношению', |
153 | | - 'smw_tb_docu' => '<p>Искать все страницы, которые содержат указанное отношение к заданной странице.</p>', |
154 | | - 'smw_tb_notype' => '<p>Укажите отношение или <a href="$2">просмотрите все ссылки на $1.</a></p>', |
155 | | - 'smw_tb_notarget' => '<p>Укажите страницу или просмотрите все отношения $1.</p>', |
156 | | - 'smw_tb_displayresult' => 'Список всех страниц, которые содержат отношение $1 к странице $2.', |
157 | | - 'smw_tb_linktype' => 'Отношение', |
158 | | - 'smw_tb_linktarget' => 'к', |
159 | | - 'smw_tb_submit' => 'Найти', |
160 | | - // Messages for the search by attribute special |
161 | | - 'searchbyattribute' => 'Искать по атрибуту', |
| 151 | + // Messages for the search by property special |
| 152 | + 'searchbyproperty' => 'Искать по атрибуту', |
162 | 153 | 'smw_sbv_docu' => '<p>Искать все страницы, которые содержат указанный атрибут и значение.</p>', |
163 | | - 'smw_sbv_noattribute' => '<p>Укажите атрибут.</p>', |
| 154 | + 'smw_sbv_noproperty' => '<p>Укажите атрибут.</p>', |
164 | 155 | 'smw_sbv_novalue' => '<p>Укажите значение или просмотрите все значения атрибута $1.</p>', |
165 | 156 | 'smw_sbv_displayresult' => 'Список всех страниц, которые содержат атрибут $1 со значением $2.', |
166 | | - 'smw_sbv_attribute' => 'Атрибут', |
| 157 | + 'smw_sbv_property' => 'Атрибут', |
167 | 158 | 'smw_sbv_value' => 'значение', |
168 | 159 | 'smw_sbv_submit' => 'Найти', |
169 | 160 | // Messages for the browsing system |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEs.php |
— | — | @@ -156,22 +156,13 @@ |
157 | 157 | 'smw_ask_ascorder' => 'Ascendente', |
158 | 158 | 'smw_ask_descorder' => 'Descendente', |
159 | 159 | 'smw_ask_submit' => 'Buscar resultados', |
160 | | - // Messages for search by relation Special |
161 | | - 'searchbyrelation' => 'Buscar por relacion', |
162 | | - 'smw_tb_docu' => '<p>Buscar para todas las páginas que tenga una cierta relación con la página objetivo dada.</p>', |
163 | | - 'smw_tb_notype' => '<p>Por favor introduzca una relación, o <a href="$2">ver todos los enlaces a $1.</a></p>', |
164 | | - 'smw_tb_notarget' => '<p>Por favor introduzca una página objetivo, o ver todas las $1 relaciones.</p>', |
165 | | - 'smw_tb_displayresult' => 'Un listado de páginas que tienen una relación $1 a la página $2.', |
166 | | - 'smw_tb_linktype' => 'Relación', |
167 | | - 'smw_tb_linktarget' => 'A', |
168 | | - 'smw_tb_submit' => 'Buscar resultados', |
169 | | - // Messages for the search by attribute special |
170 | | - 'searchbyattribute' => 'Buscar por atributo', |
| 160 | + // Messages for the search by property special |
| 161 | + 'searchbyproperty' => 'Buscar por atributo', |
171 | 162 | 'smw_sbv_docu' => '<p>Buscar por todas las páginas que tiene un atributo y valor dado.</p>', |
172 | | - 'smw_sbv_noattribute' => '<p>Por favor introduzca un atributo.</p>', |
| 163 | + 'smw_sbv_noproperty' => '<p>Por favor introduzca un atributo.</p>', |
173 | 164 | 'smw_sbv_novalue' => '<p>Por favor introduzca un valor, o ver todos los valores de atributo para $1.</p>', |
174 | 165 | 'smw_sbv_displayresult' => 'Una lista de todas las páginas que tienen un atributo $1 con el valor $2.', |
175 | | - 'smw_sbv_attribute' => 'Atributo', |
| 166 | + 'smw_sbv_property' => 'Atributo', |
176 | 167 | 'smw_sbv_value' => 'Valor', |
177 | 168 | 'smw_sbv_submit' => 'Buscar resultados', |
178 | 169 | // Messages for the browsing system |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageFr.php |
— | — | @@ -157,22 +157,13 @@ |
158 | 158 | 'smw_ask_ascorder' => 'Croissant', |
159 | 159 | 'smw_ask_descorder' => 'Décroissant', |
160 | 160 | 'smw_ask_submit' => 'Trouver des résultats', |
161 | | - // Messages for search by relation Special |
162 | | - 'searchbyrelation' => 'Rechercher par relation', |
163 | | - 'smw_tb_docu' => '<p>Rechercher toutes les pages qui ont une certaine relation à la page cible.</p>', |
164 | | - 'smw_tb_notype' => '<p>Veuillez entrer une relation, ou <a href="$2">voir tous les liens vers $1.</a></p>', |
165 | | - 'smw_tb_notarget' => '<p>Veuillez entrer une page cible, ou voir toutes les relations à $1.</p>', |
166 | | - 'smw_tb_displayresult' => 'Liste de toutes les pages qui ont une relation $1 à la page $2.', |
167 | | - 'smw_tb_linktype' => 'Relation', |
168 | | - 'smw_tb_linktarget' => 'À', |
169 | | - 'smw_tb_submit' => 'Trouver des résultats', |
170 | | - // Messages for the search by attribute special |
171 | | - 'searchbyattribute' => 'Rechercher par attribut', |
| 161 | + // Messages for the search by property special |
| 162 | + 'searchbyproperty' => 'Rechercher par attribut', |
172 | 163 | 'smw_sbv_docu' => '<p>Rechercher toutes les pages qui ont un attribut donné avec un certaine valeur.</p>', |
173 | | - 'smw_sbv_noattribute' => '<p>Veuillez entrer un attribut.</p>', |
| 164 | + 'smw_sbv_noproperty' => '<p>Veuillez entrer un attribut.</p>', |
174 | 165 | 'smw_sbv_novalue' => '<p>Veuillez entrer une valeur ou consulter toutes les valeurs des attributs pour $1.</p>', |
175 | 166 | 'smw_sbv_displayresult' => 'Liste de toutes les pages qui ont un attribut $1 avec la valeur $2.', |
176 | | - 'smw_sbv_attribute' => 'Attribut', |
| 167 | + 'smw_sbv_property' => 'Attribut', |
177 | 168 | 'smw_sbv_value' => 'Valeur', |
178 | 169 | 'smw_sbv_submit' => 'Trouver des résultats', |
179 | 170 | // Messages for the browsing system |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageDe.php |
— | — | @@ -157,22 +157,13 @@ |
158 | 158 | 'smw_ask_ascorder' => 'Aufsteigend', |
159 | 159 | 'smw_ask_descorder' => 'Absteigend', |
160 | 160 | 'smw_ask_submit' => 'Finde Ergebnisse', |
161 | | - // Messages for search by relation Special |
162 | | - 'searchbyrelation' => 'Suche mittels Relation', |
163 | | - 'smw_tb_docu' => '<p>Diese Spezialseite findet alle Seiten, die eine bestimmte Relation zur angegebenen Zielseite haben.</p>', |
164 | | - 'smw_tb_notype' => '<p>Bitte den Namen einer Relation eingeben oder <a href="$2">alle Links zur Seite $1 ansehen.</a></p>', |
165 | | - 'smw_tb_notarget' => '<p>Bitte den Namen der Zeilseite eingeben oder alle Verwendungen der Relation $1 ansehen.</p>', |
166 | | - 'smw_tb_displayresult' => 'Eine Liste aller Seiten mit der Relation $1 zur Seite $2.', |
167 | | - 'smw_tb_linktype' => 'Relation', |
168 | | - 'smw_tb_linktarget' => 'Zu', |
169 | | - 'smw_tb_submit' => 'Finde Ergebnisse', |
170 | | - // Messages for the search by attribute special |
171 | | - 'searchbyattribute' => 'Suche mittels Attribut', |
172 | | - 'smw_sbv_docu' => '<p>Diese Spezialseite findet alle Seiten, die einen bestimmten Wert für das angegebene Attribut haben.</p>', |
173 | | - 'smw_sbv_noattribute' => '<p>Bitte den Namen eines Attributs eingeben</p>', |
174 | | - 'smw_sbv_novalue' => '<p>Bitte den gewünschten Wert eingeben oder alle Werte für das Attribut $1 ansehen.</p>', |
175 | | - 'smw_sbv_displayresult' => 'Eine Liste aller Seiten, die ein Attribut $1 mit dem Wert $2 haben.', |
176 | | - 'smw_sbv_attribute' => 'Attribut', |
| 161 | + // Messages for the search by property special |
| 162 | + 'searchbyproperty' => 'Suche mittels Eigenschaft', |
| 163 | + 'smw_sbv_docu' => '<p>Diese Spezialseite findet alle Seiten, die einen bestimmten Wert für die angegebene Eigenschaft haben.</p>', |
| 164 | + 'smw_sbv_noproperty' => '<p>Bitte den Namen einer Eigenschaft eingeben</p>', |
| 165 | + 'smw_sbv_novalue' => '<p>Bitte den gewünschten Wert eingeben oder alle Werte für die Eingenschaft $1 ansehen.</p>', |
| 166 | + 'smw_sbv_displayresult' => 'Eine Liste aller Seiten, die eine Eigenschaft $1 mit dem Wert $2 haben.', |
| 167 | + 'smw_sbv_property' => 'Eigenschaft', |
177 | 168 | 'smw_sbv_value' => 'Wert', |
178 | 169 | 'smw_sbv_submit' => 'Finde Ergebnisse', |
179 | 170 | // Messages for the browsing system |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguagePl.php |
— | — | @@ -187,22 +187,13 @@ |
188 | 188 | 'smw_ask_ascorder' => 'Rosnąco', |
189 | 189 | 'smw_ask_descorder' => 'Malejąco', |
190 | 190 | 'smw_ask_submit' => 'Szukaj wyników', |
191 | | - // Messages for search by relation Special |
192 | | - 'searchbyrelation' => 'Szukaj po relacji', |
193 | | - 'smw_tb_docu' => '<p>Szukanie wszystkich stron, które są w pewnej relacji do danej strony docelowej.</p>', |
194 | | - 'smw_tb_notype' => '<p>Wpisz relację, lub <a href="$2">zobacz wszystkie linki do $1.</a></p>', |
195 | | - 'smw_tb_notarget' => '<p>Wpisz stronę docelową, lub zobacz wszystkie relacje $1.</p>', |
196 | | - 'smw_tb_displayresult' => 'Lista wszystkich stron, które są w relacji $1 do strony $2.', |
197 | | - 'smw_tb_linktype' => 'Relacja', |
198 | | - 'smw_tb_linktarget' => 'Do', |
199 | | - 'smw_tb_submit' => 'Znajdź wyniki', |
200 | | - // Messages for the search by attribute special |
201 | | - 'searchbyattribute' => 'Szukaj po atrybucie', |
| 191 | + // Messages for the search by property special |
| 192 | + 'searchbyproperty' => 'Szukaj po atrybucie', |
202 | 193 | 'smw_sbv_docu' => '<p>Szukanie wszystkich stron, które mają dany atrybut i wartość.</p>', |
203 | | - 'smw_sbv_noattribute' => '<p>Wpisz atrybut.</p>', |
| 194 | + 'smw_sbv_noproperty' => '<p>Wpisz atrybut.</p>', |
204 | 195 | 'smw_sbv_novalue' => '<p>Wpisz wartość, lub zobacz wszystkie wartości atrybutów dla $1.</p>', |
205 | 196 | 'smw_sbv_displayresult' => 'Lista wszystkich stron, które mają atrybut $1 z wartością $2.', |
206 | | - 'smw_sbv_attribute' => 'Atrybut', |
| 197 | + 'smw_sbv_property' => 'Atrybut', |
207 | 198 | 'smw_sbv_value' => 'Wartość', |
208 | 199 | 'smw_sbv_submit' => 'Znajdź wyniki', |
209 | 200 | // Messages for the browsing system |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageHe.php |
— | — | @@ -165,22 +165,13 @@ |
166 | 166 | 'smw_ask_ascorder' => 'בסדר עולה', |
167 | 167 | 'smw_ask_descorder' => 'בסדר יורד', |
168 | 168 | 'smw_ask_submit' => 'חפש תוצאות', |
169 | | - // Messages for search by relation Special |
170 | | - 'searchbyrelation' => 'Search by relation', //TODO: translate |
171 | | - 'smw_tb_docu' => '<p>Search for all pages that have a certain relation to the given target page.</p>', //TODO: translate |
172 | | - 'smw_tb_notype' => '<p>Please enter a relation, or <a href="$2">view all links to $1.</a></p>', //TODO: translate |
173 | | - 'smw_tb_notarget' => '<p>Please enter a target page, or view all $1 relations.</p>', //TODO: translate |
174 | | - 'smw_tb_displayresult' => 'A list of all pages that have a relation $1 to the page $2.', //TODO: translate |
175 | | - 'smw_tb_linktype' => 'Relation', //TODO: translate |
176 | | - 'smw_tb_linktarget' => 'To', //TODO: translate |
177 | | - 'smw_tb_submit' => 'Find results', //TODO: translate |
178 | | - // Messages for the search by attribute special |
179 | | - 'searchbyattribute' => 'Search by attribute', //TODO: translate |
180 | | - 'smw_sbv_docu' => '<p>Search for all pages that have a given attribute and value.</p>', //TODO: translate |
181 | | - 'smw_sbv_noattribute' => '<p>Please enter an attribute.</p>', //TODO: translate |
182 | | - 'smw_sbv_novalue' => '<p>Please enter a value, or view all attributes values for $1.</p>', //TODO: translate |
183 | | - 'smw_sbv_displayresult' => 'A list of all pages that have an attribute $1 with value $2.', //TODO: translate |
184 | | - 'smw_sbv_attribute' => 'Attribute', //TODO: translate |
| 169 | + // Messages for the search by property special TODO: translate |
| 170 | + 'searchbyproperty' => 'Search by property', //TODO: translate |
| 171 | + 'smw_sbv_docu' => '<p>Search for all pages that have a given property and value.</p>', //TODO: translate |
| 172 | + 'smw_sbv_noproperty' => '<p>Please enter a property.</p>', //TODO: translate |
| 173 | + 'smw_sbv_novalue' => '<p>Please enter a valid value for the property, or view all property values for “$1.”</p>', //TODO: translate |
| 174 | + 'smw_sbv_displayresult' => 'A list of all pages that have property “$1” with value “$2”', //TODO: translate |
| 175 | + 'smw_sbv_property' => 'Property', //TODO: translate |
185 | 176 | 'smw_sbv_value' => 'Value', //TODO: translate |
186 | 177 | 'smw_sbv_submit' => 'Find results', //TODO: translate |
187 | 178 | // Messages for the browsing system |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageSk.php |
— | — | @@ -167,22 +167,13 @@ |
168 | 168 | 'smw_ask_ascorder' => 'Vzostupne', |
169 | 169 | 'smw_ask_descorder' => 'Zostupne', |
170 | 170 | 'smw_ask_submit' => 'Nájdi výsledky', |
171 | | - // Messages for typed backlink Special // TODO: consider re-translation (look at new English version) |
172 | | - 'searchbyrelation' => 'Typové spätné odkazy', |
173 | | - 'smw_tb_docu' => '<p>Vyhľadávať na wiki akýkoľvek článok s istým typom odkazu na zadaný cieľ.</p>', |
174 | | - 'smw_tb_notype' => '<p>Nebol poskytnutý typ odkazu. Prosím, poskytnite ho vo formulári alebo <a href="$2">kliknite sem pre zobrazenie všetkých odkazov na $1</a></p>', |
175 | | - 'smw_tb_notarget' => '<p>Nebola poskytnutá cieľová stránka pre spätné odkazy. Prosím, poskytnite ju vo formulári alebo zobrazte všetky odkazy typu $1</p>', |
176 | | - 'smw_tb_displayresult' => 'Zoznam všetkých článkov, ktoré majú vzťah $1 $2.', |
177 | | - 'smw_tb_linktype' => 'Typ odkazu:', |
178 | | - 'smw_tb_linktarget' => 'Cieľ odkazu:', |
179 | | - 'smw_tb_submit' => 'Hľadať výsledky', |
180 | 171 | // Messages for the search by value special // TODO: consider re-translation (look at new English version) |
181 | | - 'searchbyattribute' => 'Hľadať podľa hodnoty atribútu', |
| 172 | + 'searchbyproperty' => 'Hľadať podľa hodnoty atribútu', |
182 | 173 | 'smw_sbv_docu' => '<p>Hľadať na wiki článok, ktorý má atribút s istou hodnotou.</p>', |
183 | | - 'smw_sbv_noattribute' => '<p>Nebol poskytnutý atribút. Prosím, poskytnite ho vo formulári.</p>', |
| 174 | + 'smw_sbv_noproperty' => '<p>Nebol poskytnutý atribút. Prosím, poskytnite ho vo formulári.</p>', |
184 | 175 | 'smw_sbv_novalue' => '<p>Nebola poskytnutá hodnota. Prosím, poskytnite ju vo formulári alebo zobrazte všetky atribúty typu $1</p>', |
185 | 176 | 'smw_sbv_displayresult' => 'Zoznam všetkých článkov, ktoré majú atribút $1 $2.', |
186 | | - 'smw_sbv_attribute' => 'Atribút:', |
| 177 | + 'smw_sbv_property' => 'Atribút:', |
187 | 178 | 'smw_sbv_value' => 'Hodnota:', |
188 | 179 | 'smw_sbv_submit' => 'Hľadať výsledky', |
189 | 180 | // Messages for the browsing system |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php |
— | — | @@ -166,22 +166,13 @@ |
167 | 167 | 'smw_ask_ascorder' => 'Ascending', |
168 | 168 | 'smw_ask_descorder' => 'Descending', |
169 | 169 | 'smw_ask_submit' => 'Find results', |
170 | | - // Messages for search by relation Special |
171 | | - 'searchbyrelation' => 'Search by relation', |
172 | | - 'smw_tb_docu' => '<p>Search for all pages that have a certain relation to the given target page.</p>', |
173 | | - 'smw_tb_notype' => '<p>Please enter a relation, or <a href="$2">view all links to “$1.”</a></p>', |
174 | | - 'smw_tb_notarget' => '<p>Please enter a target page, or view all “$1” relations.</p>', |
175 | | - 'smw_tb_displayresult' => 'A list of all pages that have a relation “$1” to the page “$2”', |
176 | | - 'smw_tb_linktype' => 'Relation', |
177 | | - 'smw_tb_linktarget' => 'To', |
178 | | - 'smw_tb_submit' => 'Find results', |
179 | | - // Messages for the search by attribute special |
180 | | - 'searchbyattribute' => 'Search by attribute', |
181 | | - 'smw_sbv_docu' => '<p>Search for all pages that have a given attribute and value.</p>', |
182 | | - 'smw_sbv_noattribute' => '<p>Please enter an attribute.</p>', |
183 | | - 'smw_sbv_novalue' => '<p>Please enter a valid value for the attribute, or view all attributes values for “$1.”</p>', |
184 | | - 'smw_sbv_displayresult' => 'A list of all pages that have an attribute “$1” with value “$2”', |
185 | | - 'smw_sbv_attribute' => 'Attribute', |
| 170 | + // Messages for the search by property special |
| 171 | + 'searchbyproperty' => 'Search by property', |
| 172 | + 'smw_sbv_docu' => '<p>Search for all pages that have a given property and value.</p>', |
| 173 | + 'smw_sbv_noproperty' => '<p>Please enter a property.</p>', |
| 174 | + 'smw_sbv_novalue' => '<p>Please enter a valid value for the property, or view all property values for “$1.”</p>', |
| 175 | + 'smw_sbv_displayresult' => 'A list of all pages that have property “$1” with value “$2”', |
| 176 | + 'smw_sbv_property' => 'Property', |
186 | 177 | 'smw_sbv_value' => 'Value', |
187 | 178 | 'smw_sbv_submit' => 'Find results', |
188 | 179 | // Messages for the browsing special |