> And another note: {{#ask}} is in SVN (in a first version). Thank you! > Working example query:
> {{#ask: [[Category:Country]] [[borders::Nigeria]] | > ?population| > ?area#km² = ''Size''| > format=list| > limit = 3| > link=all| > intro=<b>Test</b>_| > }} It seems that the category specific syntax is identical to ask tag, parameters of the output are specified without leading questions, starting with leading question defines the searching property, if I got it right.. I've tried to convert my SMW 0.7 (really working) query to SMW 1.0RC3 #ask query. But I've stumbled with the problem. There's the query I use, only the cyrillic property names and format strings are translated (because it may be confusing to read Cyrillic to westerners, if there's a need to get original bytecodes, I can send them with escaped strings): ---- {{#ask: [[Category:News]] | ?Date| sort=Date| order=descending| limit=3| format=template| template=newsrow| default=There was no news| searchlabel=Browse all news...| }} ---- The results set is correct list of links to the pages where the property "Date" is defined, {{{1}}} and {{{2}}} parameter are correctly expanded in the template, but.. there's no sorting! The results were sorted by Date field in SMW 0.7, now they aren't. I've tried to figure out what's wrong, it must be either something had changed with syntax of the query, or the query is incorrectly parsed. After browsing through few nested function calls, I've found method getQueryResult(SMWQuery $query) in SMW_SQLStore.php, where's the following code: ---- if ( $smwgQSortingSupport ) { $order = $query->ascending ? 'ASC' : 'DESC'; if ( ($this->m_sortfield == false) && ($this->m_sortkey == false) ) { $sql_options['ORDER BY'] = "$pagetable.page_title $order "; // default } elseif ($this->m_sortfield != false) { $sql_options['ORDER BY'] = $this->m_sortfield . " $order "; } // else: sortkey given but not found: do not sort } ---- My $smwgQSortingSupport is true, of course. But the content of $this is such: ---- object(SMWSQLStore)#140 (3) { ["m_sortkey:protected"]=> string(8) "\u0414\u0430\u0442\u0430" ["m_sortfield:protected"]=> bool(false) ["m_usedtables:protected"]=> array(1) { [0]=> string(5) "cats1" } } ---- translated version: object(SMWSQLStore)#140 (3) { ["m_sortkey:protected"]=> string(8) "Date" ["m_sortfield:protected"]=> bool(false) ["m_usedtables:protected"]=> array(1) { [0]=> string(5) "cats1" } } ---- You see, that my m_sortkey is proper (Date) - it's not false, but for some strange reason my m_sortfield is false :-( The following code in createSQLQuery seems to be designated for subqueries and not being executed in my case: ---- if ($sub) { $nexttables = array(); $nexttables['p' . $tablename] = $table; // keep only current table for reference $this->createSQLQuery($description->getDescription(), $from, $subwhere, $db, $nexttables, $nary_pos); if ($sort) { $this->m_sortfield = "$table.$sort"; } if ( $subwhere != '') { $where .= ' AND (' . $subwhere . ')'; } } ---- So, the sql_options ORDER BY is not set.. After that, I've changed the "format" parameter value to "debug", ---- ---- here's the SQL query it tries to execute: ---- Generated Wiki-Query <q> <q>+ || \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435:+</q> </q> Query-Size: 3 Query-Depth: 0 SQL-Query SELECT DISTINCT `page`.page_title as title, `page`.page_namespace as namespace FROM `cats3`, `page` INNER JOIN `categorylinks` AS cl2 ON cl2.cl_from=`page`.page_id WHERE ((`page`.page_namespace='0') OR (`page`.page_namespace='6')) AND (cats3.title=cl2.cl_to) SQL-Query options LIMIT=4 OFFSET=0 Errors and Warnings Auxilliary tables used cats3: \u041d\u043e\u0432\u043e\u0441\u0442\u0438, ---- translated version: Generated Wiki-Query <q> <q>+ || Image:+</q> </q> Query-Size: 3 Query-Depth: 0 SQL-Query SELECT DISTINCT `page`.page_title as title, `page`.page_namespace as namespace FROM `cats3`, `page` INNER JOIN `categorylinks` AS cl2 ON cl2.cl_from=`page`.page_id WHERE ((`page`.page_namespace='0') OR (`page`.page_namespace='6')) AND (cats3.title=cl2.cl_to) SQL-Query options LIMIT=4 OFFSET=0 Errors and Warnings Auxilliary tables used cats3: News, ---- If you need any additional information to debug, I can provide. The Property:Date is defined as "[[has type::Type:Date]]" of course. I don't know whether it's my simple mistake with query, or a some kind of bug in SMW.. Dmitriy ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel