Python RDF example of a MySQL triple store thanks to redland/librdf

In a way similar to my previous post about persisting graphs in PostGreSQL in PHP, here’s similar examples for Python and MySQL.

Note that you may need to adjust the MySQL table creation templates if you’re running librdf version 1.0.16 (see this bug for details).

The first example will load data from a file, and store the parsed model to the RDBMS, while the second example, will reload the model and issue queries on it.watch A Cure for Wellness 2017 movie now

These examples don’t do much, but hopefully, they’ll help you get started if you’re interested in using redland/librdf.

One potential benefit can be interoperability with other languages like PHP, for instance if you’re running harvesters in Python that will save facts in a triple store, which is then accessed by a PHP application that will publish a Web interface.

Scripting mysql database backups on phpMyadmin with CURL

Sometimes, you can only access your MySQL database with phpMyadmin (the previous tool I blogged about won’t be helpful, then). But you may wish to backup the database on a regular way.

PhpMyadmin allows you to backup the database, but you may like to do it in an unattended way.

I’ve written a shell-script which will use CURL to do so.

I couldn’t find any such script… so I hope I didn’t reinvent the wheel 😉

Update 2008/04/15 : I have made some modifications to the script, and it is now in SVN. You may grab a copy from the picoforge project’s websvn.

How to backup mysql databases : mysql_backup

I have a couple databases in mysql on my machines (either for stuff like my weblog or more serious applications like for work ;). The machines are probably backed-up regularly using file-system-based tools… so I suppose that my database is backed-up once in a while if it is stored somewhere in /var/lib/mysql…

However, if for some reason the mysql server crashed, and had a problem opening the “raw” backup (maybe no longer backward-compatible after un upgrade), it would be difficult to get back my data…

The idea is to complement the raw backup with one of the data in “full-text”. mysqldump can be used to do so.

I found the mysql_backup(.pl) script developped by Peter Falkenberg Brown really useful. This GPL’ed tool handles the backup of selected mysql databases into files (one for each table), which are then compressed (.tar.gz) and named after the date of the backups, then rotated ala logrotate (btw, for uses of logrotate for similar needs, see this post by benj). It’s easily setup and configured with many options. A must-have in my opinion.

Thought I had blogged about it before… but it seems that I did not 😉

Update 2008/04/15 : Btw, if you can’t access the database directly, but have phpMyAdmin available, see the linked post in the trackbacks of this post for a tool I wrote.