Thanks for the pointer.  The other issue with POM is that I wouldn’t know how to find all of the pages for a category.  I also think that I’ll be finding myself working on additional tasks that will require better knowledge of how to use PHP to get at MW, so this is a pretty good learning experience.

One point though.  In order to avoid having to run SMW_refreshData, wouldn’t it make sense to update the SMW tables via smwfGetStore()->updateData in addition to using Article::doEdit to change the wiki text?

Thanks again,

 - Keith


On 3/27/09 2:26 PM, "Yaron Koren" <yaron57@gmail.com> wrote:

I'll leave it to Sergey to comment on POM specifically, but you should never modify the SMW tables directly - they'll get overwritten as soon as someone modifies the corresponding page. You should only ever make changes to the wiki pages themselves.

I'd use POM, by the way. If you really don't want to, look into Article::doEdit().

-Yaron

On Fri, Mar 27, 2009 at 5:12 PM, Keith Fligg <Keith.Fligg@pnl.gov> wrote:
So, I’m working on writing a script to make this work on real data.  I’m not using POM, because it doesn’t sound like it’s being maintained.  Instead I’m writing a php script to be run from the command line, using the code below as a starting point.  The big caveat here is that I’m not (yet) a MediaWiki hacker, so I’m at the base of the big learning curve.

In fact, this isn’t turning out to be too big a deal.  But I have hit a significant bump, that I would appreciate some help with.  I figured out how to add new properties to the pages I’d like to attach coordinates to.  This works, insofar as SMW tables get updated: the new property shows up in the property browser, the value is what I set it to, etc.  However, the #ask queries don’t pick the property up.  This leads me to believe that the #ask query uses the page source to find properties.

I’ve drawn this conclusion based on the property text not being in the wiki, just in the SMW database tables.  So, I’m wondering  how to get the #ask queries to work.  Do I either a) update the wiki text based on the SMW tables (which I’m pretty sure isn’t an option) b) update the wiki text from PHP so as to reflect the changes I’ve made to the SMW data?  c) other?

If I need to modify the wiki text, can anyone point me to some code that does that?

Thanks for all the help.

 - Keith



On 3/23/09 10:52 AM, "Yaron Koren" <yaron57@gmail.com <http://yaron57@gmail.com> > wrote:

Cool, I think we may have found ourselves a solution. :) It's probably worth adding this code to the documentation pages for Semantic Google Maps and/or Google Geocoder. And of course, first prize to whoever is first able to run the script on real data.

-Yaron


2009/3/23 Thomas Fellows <thomas.fellows@gmail.com <http://thomas.fellows@gmail.com> >
(response too long, canceling first post)

quick off the top of my head - maybe something like this, though this just returns all of the pages in a given category:

>From  includes/specials/SpecialExport.php

function wfExportGetPagesFromCategory( $title ) {
global $wgContLang;

$name = $title->getDBkey();

$dbr = wfGetDB( DB_SLAVE );

list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' );
$sql = "SELECT page_namespace, page_title FROM $page " .
"JOIN $categorylinks ON cl_from = page_id " .
"WHERE cl_to = " . $dbr->addQuotes( $name );

$pages = array();
$res = $dbr->query( $sql, 'wfExportGetPagesFromCategory' );
while ( $row = $dbr->fetchObject( $res ) ) {
$n = $row->page_title;
if ($row->page_namespace) {
$ns = $wgContLang->getNsText( $row->page_namespace );
$n = $ns . ':' . $n;
}

$pages[] = $n;
}
$dbr->freeResult($res);

return $pages;
}

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Semediawiki-user mailing list
Semediawiki-user@lists.sourceforge.net <http://Semediawiki-user@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/semediawiki-user




------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com

_______________________________________________
Semediawiki-user mailing list
Semediawiki-user@lists.sourceforge.net <http://Semediawiki-user@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/semediawiki-user