Yes, you can use the API. If you go to Special:Ask, recreate the query and select "CSV export" as the format, then hit "Find results", you should get a URL for the CSV export you need. You then just need to have the PHP retrieve and parse that URL; you can see the getCSVData() function in the External Data extension for how to do that (though your code can probably be simpler).


On Sat, Jul 25, 2009 at 3:39 PM, Laurent Alquier <> wrote:
Actually, I thought about a way that could work, except I still have to find an example in PHP.

In case someone already knows the answer, how would I go about getting the results of a #show or #ask query in PHP ?

Something like :

$propertyValuesArray = GetQueryResults("{{#show:Some page|?Some property}}")

Is this possible with the SMW API ?

- Laurent

From: "Laurent Alquier" <>
Sent: Saturday, July 25, 2009 6:43 AM
To: "Semantic MediaWiki Developers List" <>
Subject: [SMW-devel] How about retrieving a single triple ?

Related to a recent question about retrieving all triples on a page - is there a quick way to retrieve a single triple on a page ?

More precisely - If I have a page name and a property name, is there a direct way to get the values for that pair (page, property name) without having to declare the supporting structures such as :

    $page = SMWDataValueFactory::newTypeIDValue( '_wpg',  $title->getFullText());

    $semdata = smwfGetStore()->getSemanticData($page->getTitle()     );  

- Laurent


Semediawiki-devel mailing list