Extension talk:SMWAskAPI

Latest comment: 13 years ago by Jeroen De Dauw in topic Native SMW support

PHP Warning

edit

I get following deprecating warnings:

Deprecated: Call-time pass-by-reference has been deprecated in C:\xampp\htdocs\wiki\extensions\SMWAskAPI\api\SMWAsk_API.php on line 79

Deprecated: Call-time pass-by-reference has been deprecated in C:\xampp\htdocs\wiki\extensions\SMWAskAPI\api\SMWAsk_API.php on line 85

Deprecated: Call-time pass-by-reference has been deprecated in C:\xampp\htdocs\wiki\extensions\SMWAskAPI\api\SMWAsk_API.php on line 99

Deprecated: Call-time pass-by-reference has been deprecated in C:\xampp\htdocs\wiki\extensions\SMWAskAPI\api\SMWAsk_API.php on line 145

Deprecated: Call-time pass-by-reference has been deprecated in C:\xampp\htdocs\wiki\extensions\SMWAskAPI\api\SMWAsk_API.php on line 152

Deprecated: Call-time pass-by-reference has been deprecated in C:\xampp\htdocs\wiki\extensions\SMWAskAPI\api\SMWAsk_API.php on line 169

Details of my configuration:

  • MediaWiki 1.16.2
  • PHP 5.3.5 (apache2handler)
  • MySQL 5.5.8
  • Semantic Bundle (Version 2011-03-29.20110329)

Any hints? Cheers, --Rolze 09:22, 6 April 2011 (UTC)Reply

Yes, some call-time pass-by-reference was actually done in several parts of the extension, and your apache is configured to display such warnings. This has been fixed in the latest version, available on the SVN. The corresponding zip archive will follow briefly --PierreMz 10:05, 12 september 2011 (UTC+2)

Updated for SMW 1.6

edit

These changes made it work for me on SMW 1.6

Index: api/SMWAsk_API.php
===================================================================
125c125
<                 $item['title'] = $rowsubject->getShortText(null, null);
---
>                 $item['title'] = $rowsubject->getTitle();
149,150c149,151
<             $item['uri'] = $wgServer . $wgScriptPath . '/index.php?title=' . $rowsubject->getPrefixedText();
<             $page_cats = smwfGetStore()->getPropertyValues($rowsubject, SMWPropertyValue::makeProperty('_INST')); // TODO: set limit to 1 here
---
>             $item['uri'] = $wgServer . $wgScriptPath . '/index.php?title=' . $rowsubject->getTitle();
>             $ptype = new SMWDIProperty( '_INST' ); 
>             $page_cats = smwfGetStore()->getPropertyValues($rowsubject, $ptype); // TODO: set limit to 1 here
152c153
<                 $this->addPropToItem(&$item, 'type', array(reset($page_cats)->getShortHTMLText()));
---
>                 $this->addPropToItem(&$item, 'type', array(reset($page_cats)->getTitle()));

Cariaso 16:31, 28 August 2011 (UTC)Reply

Now two versions of the extension, to support both SMW 1.5 and 1.6

edit

The patch above has been applied to the trunk of SMWAskAPI. The version for SMW 1.5 has been kept in branches/smw-1.5/.

Both versions are available to direct download :

Native SMW support

edit

I've created 2 API modules in SMW core based on this extension, as it's such a great idea :) They can be found here. I wrote them from ground up, and there are still several todos, such as API specific serialization cleanup and not creating a query string that then gets parsed in askargs. Anyway, I'd be great if you could switch your dev efforts to these new API modules and have this extension be deprecated for new versions of SMW.

-- Jeroen De Dauw 17:30, 18 September 2011 (UTC)Reply

XML Output format?

edit

Why do I get as result of an ask query a page showing the following and not the result table?

You are looking at the HTML representation of the XML format.
HTML is good for debugging, but probably is not suitable for your application.
See complete documentation, or API help for more information.

<?xml version="1.0"?>
<api>
  <ask result="Success">
 :
 :
  </ask>
</api>

  • MediaWiki 1.16.0
  • PHP 5.2.9 (apache2handler)
  • Semantic MediaWiki (Version 1.5.5 alpha)
  • SMWAskAPI (Version 0.9 alpha)

Thanks.

Return to "SMWAskAPI" page.