[pcplantdb] .3 and other things.
pyg at galatea.org
Sun Aug 21 14:11:43 EDT 2005
I'm putting this out to the list, because [as usual] much of this is
applicable to others as well.
Bear Kaufmann writes:
> Hi Chad,
> Congrats on getting .3 up on dev.
> I don't have a lot of time to work on the project right now or comment,
> and will be away.
> I've played around with a little faceted search system (in PHP).
> I've uploaded it to
> Perhaps you can try it on you're own machine, or pull the db password
> info and include it in a dir accessible to php but not users, and put
> it on dev. It probably takes a bit of DB power to run it, but shows
> faceted search. SQL is GROUPing with varchar fields like pollinators,
> etc, which would probably speed up if these were related by integer id
> to their own table/tag. I may also be looking at the older database and
First, notice how messed up pollinators is... bees, insects,
bees/insects, flies/bees. Should have really been its own table to be
fully normalized or constrained to specific values.
More to answer your question, what I'd really like you to do is use
Here is the php equivilant to my example python xml-rpc
snippet... also my first php ever! Get xmlrpc.inc from
$server = new xmlrpc_client('/cgi-bin/eden_xml-rpc.py', 'dev.permaculture.info');
$message = new xmlrpcmsg('GetComment', array(new xmlrpcval(8000, 'int')));
$result = $server->send($message);
$output = $result->value();
Not sure how to really handle $output as it's supposed to be a
dictionary. Does php have dictionary obects (associative arrays)? If
so something like print $output['Title'] should give you 'Edible uses'.
Anyway, I looked at your facets.php and couldn't really get what sort
of query methods you would need, but if you just tell me what you need
(if it isn't already in the api <http://dev.permaculture.info/api/>)
they will appear to support this. I'm actually pretty sure that
simple methods to do what you want don't exist. You could use the
Search method with family=Blahblah and then GetPlantCulture for the
results, but like I said, I can implement specific methods easily.
There are a lot of good reasons for using the server API via xml-rpc
the most important being security. I am quite confident that the
server cannot be trivially exploited (at least by SQL insertion).
Clients [including the default web browser one] are not trusted and
must provide some form of authentication to any request that is not
read only. Additionally, methods I add now to support facets.php can
later be used by Rich's Java GBI client and so on... based on the idea
that if one client needs them then it will likely be useful to others.
Anyway, tell me what your input will look like, what happens, and what
you want the output to look like and I'll have at it.
The one caution I have is that the xml-rpc stuff is rather untested
and there are some known gotchas that I really need/want to work
through (one of my reasons for wanting to add usda.gov). Most notable
is that some methods return a python None type object which is not
supported by the xml-rpc standard. This could be changed to boolean
False but I'm also not sure how strictly typed languages (like
C/C++/Java and maybe PHP) handle different return values in
xml-rpc... expecting an array and get an int for example. I also
would like to add helpful/reasonable error messages to the server API
(False is not helpful) but probably need to do so in a way that
accommodates the capabilities of strictly typed languages xml-rpc
> There's a demo of one result at
> No fancy styling/UI, but you get the idea.
python -c 'import base64;print base64.decodestring("cHlnQGdhbGF0ZWEub3Jn")'
More information about the pcplantdb