Page MenuHomePhabricator

format = count doenst work
Closed, ResolvedPublic

Description

Author: simon.bachenberg

Description:
{{#ask: [[Kategorie:Projekte]]|format = count}}

SMW: 1.6.1 = No Result

SMW: 1.6.0 = 1996

SMW: <1.6.0 = 47.3610

www(dot)gesis(dot)org/sofiswiki/Test


Version: unspecified
Severity: normal

Details

Reference
bz30543

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 21 2014, 11:52 PM
bzimport set Reference to bz30543.

There is an error in your query, as indicated by the yellow question mark thing put after it. Fixed the error and the count should show up (count queries are working fine for me using SMW trunk). Going on the difference in results between 1.6 and earlier, I'd say you are using some deprecated or otherwise changed functionality causing the error in the query.

Do feel free to reopen the bug if my guess is wrong :)

simon.bachenberg wrote:

dbolser gave me the tip to try my query qith out "format=count"

The Yellow Thing just say "Too many Results" for {{#ask: [[Kategorie:Projekte]]}}

The Code of the Page:
Test count [Kategorie:Projekte]:{{#ask: [[Kategorie:Projekte]]|format = count}}

Test without count [Kategorie:Projekte]:{{#ask: [[Kategorie:Projekte]]}}

In English it would be:
Test count [Category:Projects]:{{#ask: [[Category:Projects]]|format = count}}

Test without count [Category:Projects]:{{#ask: [[Category:Projects]]}}

Huh. I've not seen that before :) I'll try to look into this soonish.

I did a bit of searching through the code, and it turns out this is a SPARQL error specific to SMW 4store support - no wonder I had not seen it before. 4store is retuning that you have either hit the query complexity limit or that a number of results have been dropped (ie going over the result count limit). I'm guessing you are running into the later one. The count format will not display when there are errors (which I implemented because the handling code would causes a fatal PHP error in SMW 1.6.0). I'm not sure how to best fix this, as it's not clear which values, or even which types the relevant variables have.

Can you place this at line 321 of includes/SMW_QueryProcessor.php

var_dump($res);var_dump($query);exit;

(That's right before $result = smwfEncodeMessages( $query->getErrors() );)

And then refresh the page and give me the output? (And obviously remove the line again.)

I don't have the time to set up a 4store install and test myself at the moment.

simon.bachenberg wrote:

I put your code here: Line 310 - 319

if ( is_string( $res ) ) {
if ( array_key_exists( 'intro', $params ) ) {

		$res = str_replace( '_', ' ', $params['intro'] ) . $res;

}
if ( array_key_exists( 'outro', $params ) ) {

		$res .= str_replace( '_', ' ', $params['outro'] );

}
var_dump($res);var_dump($query);exit;
$result = $res . smwfEncodeMessages( $query->getErrors() );
}

But i dont get any output on my Querypage :-(

p.s. I can totally understand that you have no time for setting up a 4store :)

Oops - that line should be put in the else part, above

$result = smwfEncodeMessages( $query->getErrors() );

Are you saying that setting up 4store is a pain/takes a long time?

simon.bachenberg wrote:

Now i have it there:

else {
// When no valid result was obtained, $res will be a SMWQueryResult.
var_dump($res);var_dump($query);exit;
$result = smwfEncodeMessages( $query->getErrors() );
}

But there is no output on the querypage at all. Any Localconf setting, i should change ?

Setting up 4Store took me 2 Days, because there is no stable Debian release and i had to Compile everything on my own (with bad Linux knowledge)

But there is no output on the querypage at all.

As in blank page, or as in nothing changed after putting that code there. In case of the former you need to change some stuff in LocalSettings, in case of the later I'm totally puzzled as to what's going on.

simon.bachenberg wrote:

Now it Worked :-)

int(0) object(SMWQuery)#336 (12) { ["sort"]=> bool(false) ["sortkeys"]=> array(1) { [""]=> string(3) "ASC" } ["querymode"]=> int(2) ["m_limit:protected"]=> int(10000) ["m_offset:protected"]=> int(0) ["m_description:protected"]=> object(SMWConjunction)#348 (2) { ["m_descriptions:protected"]=> array(4) { [0]=> object(SMWClassDescription)#308 (2) { ["m_diWikiPages:protected"]=> array(1) { [0]=> object(SMWDIWikiPage)#327 (4) { ["m_dbkey:protected"]=> string(4) "Item" ["m_namespace:protected"]=> int(14) ["m_interwiki:protected"]=> string(0) "" ["m_subobjectname:protected"]=> string(0) "" } } ["m_printreqs:protected"]=> array(0) { } } [1]=> object(SMWSomeProperty)#347 (3) { ["m_description:protected"]=> object(SMWValueDescription)#301 (4) { ["m_dataItem:protected"]=> object(SMWDIWikiPage)#326 (4) { ["m_dbkey:protected"]=> string(2) "Ba" ["m_namespace:protected"]=> int(0) ["m_interwiki:protected"]=> string(0) "" ["m_subobjectname:protected"]=> string(0) "" } ["m_comparator:protected"]=> int(1) ["m_property:protected"]=> object(SMWDIProperty)#325 (3) { ["m_key:protected"]=> string(4) "User" ["m_inverse:protected"]=> bool(false) ["m_proptypeid:protected"]=> string(4) "_wpg" } ["m_printreqs:protected"]=> array(0) { } } ["m_property:protected"]=> object(SMWDIProperty)#325 (3) { ["m_key:protected"]=> string(4) "User" ["m_inverse:protected"]=> bool(false) ["m_proptypeid:protected"]=> string(4) "_wpg" } ["m_printreqs:protected"]=> array(0) { } } [2]=> object(SMWSomeProperty)#349 (3) { ["m_description:protected"]=> object(SMWValueDescription)#338 (4) { ["m_dataItem:protected"]=> object(SMWDIWikiPage)#337 (4) { ["m_dbkey:protected"]=> string(118) "Security_versus_rights:_the_Europeanization_of_policies_on_human_trafficking,_people_smuggling_and_irregular_migration" ["m_namespace:protected"]=> int(0) ["m_interwiki:protected"]=> string(0) "" ["m_subobjectname:protected"]=> string(0) "" } ["m_comparator:protected"]=> int(1) ["m_property:protected"]=> object(SMWDIProperty)#331 (3) { ["m_key:protected"]=> string(5) "Titel" ["m_inverse:protected"]=> bool(false) ["m_proptypeid:protected"]=> string(4) "_wpg" } ["m_printreqs:protected"]=> array(0) { } } ["m_property:protected"]=> object(SMWDIProperty)#331 (3) { ["m_key:protected"]=> string(5) "Titel" ["m_inverse:protected"]=> bool(false) ["m_proptypeid:protected"]=> string(4) "_wpg" } ["m_printreqs:protected"]=> array(0) { } } [3]=> object(SMWSomeProperty)#350 (3) { ["m_description:protected"]=> object(SMWValueDescription)#345 (4) { ["m_dataItem:protected"]=> object(SMWDIWikiPage)#344 (4) { ["m_dbkey:protected"]=> string(4) "True" ["m_namespace:protected"]=> int(0) ["m_interwiki:protected"]=> string(0) "" ["m_subobjectname:protected"]=> string(0) "" } ["m_comparator:protected"]=> int(4) ["m_property:protected"]=> object(SMWDIProperty)#316 (3) { ["m_key:protected"]=> string(6) "Delete" ["m_inverse:protected"]=> bool(false) ["m_proptypeid:protected"]=> string(4) "_wpg" } ["m_printreqs:protected"]=> array(0) { } } ["m_property:protected"]=> object(SMWDIProperty)#316 (3) { ["m_key:protected"]=> string(6) "Delete" ["m_inverse:protected"]=> bool(false) ["m_proptypeid:protected"]=> string(4) "_wpg" } ["m_printreqs:protected"]=> array(0) { } } } ["m_printreqs:protected"]=> array(1) { [0]=> object(SMWPrintRequest)#340 (7) { ["m_mode:protected"]=> int(2) ["m_label:protected"]=> string(0) "" ["m_data:protected"]=> NULL ["m_typeid:protected"]=> bool(false) ["m_outputformat:protected"]=> bool(false) ["m_hash:protected"]=> bool(false) ["m_params:protected"]=> array(0) { } } } } ["m_errors:protected"]=> array(0) { } ["m_querystring:protected"]=> string(177) "[[Kategorie:Item]][[User::ba ]][[Titel::Security versus rights: the Europeanization of policies on human trafficking, people smuggling and irregular migration]][[Delete::!True]]" ["m_inline:protected"]=> bool(true) ["m_concept:protected"]=> bool(false) ["m_extraprintouts:protected"]=> array(0) { } ["m_mainlabel:protected"]=> string(0) "" }

Can you do view source when getting that value and place it at http://dpaste.org/ ? Not very readable like this. Looks like the value would be 0, even if it was displayed as it should. So this seems to be a 4store specific count issue.

simon.bachenberg wrote:

The Code is still in the Script, you could look at the page your own maybe it looks better than.

For Testing you can use Test|test01

IIRC this has been fixed. Do reopen if I'm mistaken and it's still on trunk :)