Quantcast

Category missing in printouts

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Category missing in printouts

anachron
Hi all,

Trying to use the ask and askargs API, I’m unable to get a list of categories for each page.

I’m currently testing this with the Cities example data. Here’s the query URLs I’ve tested:

   https://www.semantic-mediawiki.org/w/api.php?action=askargs&conditions=Category:Cities|Belleville&printouts=categories|population&format=jsonfm

  https://www.semantic-mediawiki.org/w/api.php?action=ask&query=[[Category:Cities]][[Belleville]]|%3Fcategories|%3Fpopulation&format=jsonfm

The results for both URLs contain this printout key/value:

  "printouts": {
                      "categories": [],
                      "population": [
                          43765
                      ]
                  }

I expected "categories" to include at least "City", but it is empty. What am I doing wrong here?


Thanks,
Bjørnar
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Category missing in printouts

James HK
Hi,

> https://www.semantic-mediawiki.org/w/api.php?action=ask&query=[[Category:Cities]][[Belleville]]|%3Fcategories|%3Fpopulation&format=jsonfm

> I expected "categories" to include at least "City", but it is empty. What am
> I doing wrong here?

The printout for "categories" expects the singular form (same as in
the condition) therefore [0] should yield the correct results.

[0] https://www.semantic-mediawiki.org/w/api.php?action=ask&query=[[Category:Cities]][[Belleville]]|%3FCategory|%3Fpopulation&format=jsonfm

Cheers

On 3/17/17, anachron <[hidden email]> wrote:

> Hi all,
>
> Trying to use the ask and askargs API, I’m unable to get a list of
> categories for each page.
>
> I’m currently testing this with the Cities example data. Here’s the query
> URLs I’ve tested:
>
>
> https://www.semantic-mediawiki.org/w/api.php?action=askargs&conditions=Category:Cities|Belleville&printouts=categories|population&format=jsonfm
>
>
> https://www.semantic-mediawiki.org/w/api.php?action=ask&query=[[Category:Cities]][[Belleville]]|%3Fcategories|%3Fpopulation&format=jsonfm
>
> The results for both URLs contain this printout key/value:
>
>   "printouts": {
>                       "categories": [],
>                       "population": [
>                           43765
>                       ]
>                   }
>
> I expected "categories" to include at least "City", but it is empty. What am
> I doing wrong here?
>
>
> Thanks,
> Bjørnar
>
>
>
> --
> View this message in context:
> http://wikimedia.7.x6.nabble.com/Category-missing-in-printouts-tp5073131.html
> Sent from the Semantic Mediawiki - User mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Category missing in printouts

anachron
Thank you! Replacing ‘category’ for ‘categories’ indeed fixes the ask query. However, even with this change, the askargs query does not work as expected.  There is a particular server I want to interact with, but this server returns HTTP 500 errors  on ask queries containing printouts. Askargs queries seem to work fine, except for the problem with missing category printouts.

By the way, how does one perform logical OR operations between conditions in an askargs query?

 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Category missing in printouts

anachron
This post was updated on .
Hi again!

The administrator of the server that was having issues with ask queries was able to fix the issue. There was a missing package ‘php-mbstring’ causing the HTTP 500 errors. Now my ask queries are working perfectly.

Thanks again for helping out!


Best regards
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Category missing in printouts

kghbln
Heiya,

thanks for reporting back on this issue and glad that you detected it.
This will make it easier for others to track it down if they have the
same issue.

As of version 2.4.0 Semantic MediaWiki includes a check on install using
Composer if "mbstring" is available or not. However I can imagine that
this check will not work when using the tarballs.

Cheers Karsten

Am 23.03.2017 um 09:22 schrieb anachron:

> Hi again!
>
> The administrator of the server that was having issues with ask queries was
> able to fix the issue. There was a missing package ‘php-mbstring’ causing
> the HTTP 500 errors. Now my ask queries are working perfectly.
>
> Thanks again for helping out!
>
>
> Rest regards
>
>
>
> --
> View this message in context: http://wikimedia.7.x6.nabble.com/Category-missing-in-printouts-tp5073131p5073306.html
> Sent from the Semantic Mediawiki - User mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Loading...