POM is only for manipulating the page body, that's a hard part (trust me, I'm experienced Perl hacker and my original approach didn't work so I wrote POM).

Finding pages by category is easy - changing just one parameter's value in one template considering all the other formatting and stuff is what POM is for and even though it's not being updated frequently with all the ideas I have for it, MediaWiki syntax didn't change either.

Actual editing can be done either using POM itself (that minor addition that exposes getter and setter through MW API) or using all different other methods - I actually modified edit.php maintenance script to work with content from STDIN and just push the results of my other data mining scripts through it. You can use POM directly with Article::doEdit for example.

Most important part as Yaron mentioned is to just write it as wiki page - it's the only way to make sure all the parser functions and SMW parsing will work properly and it's the easiest way as well as most of the complexity can be left to MW templates and parser functions.

Thank you,

† † † † Sergey


--
Sergey Chernyshev
http://www.sergeychernyshev.com/


2009/3/27 Keith Fligg <Keith.Fligg@pnl.gov>
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>



------------------------------------------------------------------------------
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>



------------------------------------------------------------------------------

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