News

October 2009 : a new release (bibus 1.5.0)

  • OOo3.1 compatibility
  • Infinite number of file/http links
  • Clever capitalization (lord of war => Lord of War ...)
  • Better handling of journal abbreviations
  • Import/Export filters can be added easily (plugin)
  • journal abbreviations and shortcuts can be easily edited (simple csv file that can be edited in OOo/excel or a text editor)
  • Lot of bug fixes
  • Requires python2.5 (not a problem anymore under Windows since OOo3.1 includes 2.6)
  • Requires wxpython-2.8

Deleting references

From Bibus

Jump to: navigation, search

Contents

Introduction

Since Bibus 1.4, references can be directly deleted in bibus.


Till Bibus 1.4, it was not possible to delete references in Bibus. However, because the bibus database is a SQL database, one was able to access the database directly with one of the command line or GUI tool available:

command line tools

  • mysql.exe for a MySQL database
  • SQlite.exe for a SQLite database

GUI tool, e.g.,


With command line tool

When you are familiar with using SQL directly or you don't have a GUI tool, you can use one of the queries below in the command line tool. Imporant: to be on the safe side, make a backup of your database before you do it! BTW: For more general tips on the use of SQL, see: Direct access to the Bibus database

First steps in bibus

1) First make a new key named 'to_be_deleted' (you can choose any other name if you want).
2) Add all the refs you want to delete to this key.
3) One can use the following scripts for MySQL (2 queries) or SQLite (4 queries)to delete all refs that are in the 'to_be_deleted' key. They will also clean the bibreflink table that contains the links between the keys and the refs. You can save the code below in a text file and execute it in one of the above mentioned command line tools (and also using the script or query window in many GUI tools).

Queries for SQLite database

  1. First make a new key named 'to_be_deleted' (you can choose any other name if you want). To add a new key (at least in Ubuntu 8.04) right click over "references" in the upper left part of the screen, then choose "add child" and name the new key "ToBeDeleted".
  2. Add all the refs you want to delete to this key.
  3. One can use the following scripts for SQLite
  • The following instructions were tested on Ubuntu 8.04.
    • Open SQLite.
    • Press Ctrl-O (or File then Open Database on the upper left corner of the window). In Linux you'll probably have to navigate to the \home\xxx\.bibus\Databases where xxx is the user. Pay attention to the "." in ".bibus" part of the address.
    • Open the copy of the database: should you not have copied the original file, close SQLite amd make a copy on which you can test this procedure. The database file should have a name like DB_FHf7rV.sqlite or something similar.
    • Locate the tag "Execute SQL", paste the instructions here below and press "Execute query".
    • On quitting SQLite, save the database.
DELETE from bibref where id in (Select ref_id from
bibreflink where key_id in (Select key_id from bibrefkey
where key_name="to_be_deleted"));
#if using bibus 1.4 DELETE from table_modif where ref_id in (Select ref_id from bibreflink where key_id in (Select key_id from bibrefKey where key_name='to_be_deleted'))
DELETE from bibreflink where key_id in (Select key_id from
bibrefkey where key_name="to_be_deleted");
DELETE from bibrefkey where key_name="to_be_deleted";
DELETE from bibreflink where ref_id not in (select id from
bibref); 

A simple solution is to include the scripts directly in the __getAllRef function in dbBibBase.py as follows

def __getAllRef(self,table,collist,order,how=BIB.LIST_HOW):
		tmpstr="""DELETE from bibref where id in (Select ref_id from bibreflink where key_id in (Select key_id from bibrefkey where key_name='to_be_deleted'))"""
		self.dbCursor.execute(tmpstr)
		self.dbConnection.commit()
		#uncomment the 3 following lines for bibus 1.4
		tmpstr="""DELETE from table_modif where ref_id in (Select ref_id from bibreflink where key_id in (Select key_id from bibrefKey where key_name='to_be_deleted'))"""
		self.dbCursor.execute(tmpstr)
		self.dbConnection.commit()		
		tmpstr="""DELETE from bibreflink where key_id in (Select key_id from bibrefkey where key_name='to_be_deleted')"""
		self.dbCursor.execute( tmpstr)
		self.dbConnection.commit()
		tmpstr="""DELETE from bibreflink where ref_id not in (select id from bibref)"""
		self.dbCursor.execute(tmpstr)
		self.dbConnection.commit()
		try:
			self.dbCursor.execute("""SELECT %s FROM %s ORDER BY %s +0 %s"""% (','.join(('Id',)+collist),table,order,how))	# column Id added for SetData of refList
			return self.dbCursor.fetchall()
		except Error,errorType:
			self.showError("dbBibBase.__getAllRef " + `errorType.args`)
			return None

With this function, the content of the "to_be_deleted" category is deleted each time you click on the "All" category or you launch.

Personal tools