2007/09/12
This documentation explains about org.biopax.paxtools.proxy and org.biopax.paxtools.persistence among Paxtools.
The following libraries are required to use Paxtools.jar.
The following are used for Persistence related library above mentioned by the development.
The setup of DBMS and Lusene is required for the persistence-related function among Paxtools.jar.
The operation of DBMS is checked by PostgreSQL (8.2) and MySQL (5.0.)
Decide the host used for DB access, DB space name, and a user name.
The default value is described in META-INF/persistence.xml in Paxtools.jar.
The property name of a host and DB space name is "hibernate.connection.url", and a value is "jdbc:postgresql://localhost/PAXTOOLS" or "jdbc:mysql://localhost/PAXTOOLS."
The property name of a user name is "hibernate.connection.username"and the value is "paxtools."
These values can be set up in org.biopax.paxtools.persistence.level2.HiRDBConnect.
The locale of DB cluster and DB space needs to be coincided for PostgreSQL.
Please specify ja_JP.utf8 as follows when creating the DB cluster.
initdb -D /opt/pgsql/data --locale=ja_JP.utf8
Moreover, please specify UNICODE when creating the DB space.
createdb PAXTOOLS -E UNICODE
If this locale information is not in agreement, the phenomenon of an error with the upper function is confirmed.
Please note that PostgreSQL will be set to ja_JP.eucJP by the default even if the file system of the distribution of Linux is UTF-8 base.
createuser is for creating the PostgreSQL user.
createuser paxtools
When a machine using Paxtools.jar and the host of PostgreSQL are different, it will be connected by the network. but it is necessary to permit the access by pg_hba.conf in the directory of DB cluster.
The following shows how to create the MySQL user.
Create two users, for the local host and for other than the local host.
mysql --user=root mysql grant all privileges on *.* to paxtools@localhost; grant all privileges on *.* to paxtools@'%';
The following shows how to create the DB space of MySQL.
mysql create database PAXTOOLS;
The directory path for the Licene index is required.
mkdir /opt/paxtools/lucene_index
Since there is no initial value, it is necessary to set up the value in org.biopax.paxtools.persistence.level2.HiRDBConnect.
org.biopax.paxtools.persistence.level2.HiRDBTrial has the main function for checking the operation of the persistence and searching.
How to use
java -classpath The path of the above-mentioned library and Paxtools.ja. org.biopax.paxtools.persistence.level2.HiRDBTrial [Option] command parameter...
| Option | Description |
|---|---|
|
-i Setting file path -ini Setting file path |
The path of the ini file which sets up the option. If omitted, HiRDBTrialCmd.ini of the current directory will be used. |
|
-f File path -file File path -filePath File path |
The file path of the command which needs a file path. The file path is used by the command of buildddl, upload, and download. |
|
-puName Persistence unit name |
Character strings which choose persistence-unit under META-INF/persistence.xml. Specify PaxtoolsForPostgreSQL or PaxtoolsForMySQL. If omitted PaxtoolsForPostgreSQL will be used. |
|
-jdbc URL |
The URL which describes the host name and the space name of DB. If omitted "jdbc:postgresql://localhost/PAXTOOLS" will be used. |
|
-user DB user name |
It is a user name to access DB. If omitted "paxtools" will be used. |
|
-password DB user password |
It is a user password to access DB. If omitted, an empty string will be used. |
|
-indexBase directory path |
It is a directory path for Lucene index. If omitted, an empty string will be used. |
Example of HiRDBTrialCmd.ini
puName=PaxtoolsForPostgreSQL jdbc=jdbc\:postgresql\://miracle/PAXTOOLS user=paxtools indexBase=D:\\Paxtools\\lucene_index
The search command makes the API name a command and adds a parameter to it.
Elements among parameters (pathway etc.) can be specified by the rdf:ID with name space.
Boolean can be specified as true or false.
Here we explain how to use the HiRDB class from the application which uses the persistence by Paxtools.jar.
HiRDB holds the connection and the session of the persistence.
HiRDBConnect and HiRDBSession are used when more detailed operation is required.
HiRDB is one of the example of how to use HiRDBConnect and HiRDBSession.
HiRDB.HiRDB(String puName, String connectionURL, String user, String password, String indexBase)
Set the various parameters about the persistence and call the constructor.
Actual connection etc. is not made when calling the constructor.
When HiRDB.setup is called explicitly or when various commands, such as search, are called before setting up, the setup is performed automatically, and connection are made.
boolean HiRDB.setup()
Connect and make the session.
There is no explicit release of the connection.
Call HiRDB.getSession().close() in order to release the session.
The element (for example, pathway) obtained by the search of persistence etc. and its property (for example, NAME) are effective only while the session is maintained.
An error may occur when accessing the element and the property after releasing the session.
public BioPAXElement HiRDB.getElementByRDFID(String rdfID)
Specify rdf:ID and acquire the element (the element which inherits BioPAXElement, for example, pathway.)
The full path with the name space is required for rdf:ID.
KeywordSearch createKeywordSearch()
Acquire the instance of keyword search.
The following search can be called using the acquired instance.
OWL data is classified by various character strings into the following field when persisted, and these are passed to Lucene.
BioPAXElementProxy.SEARCH_INDEX_NAME = "paxtools"; BioPAXElementProxy.SEARCH_FIELD_KEYWORD = "keyword"; BioPAXElementProxy.SEARCH_FIELD_NAME = "name"; BioPAXElementProxy.SEARCH_FIELD_SYNONYMS = "synonyms"; BioPAXElementProxy.SEARCH_FIELD_TERM = "term"; BioPAXElementProxy.SEARCH_FIELD_EC_NUMBER = "ec_number"; BioPAXElementProxy.SEARCH_FIELD_SEQUENCE = "sequence"; BioPAXElementProxy.SEARCH_FIELD_XREF_DB = "xref_db"; BioPAXElementProxy.SEARCH_FIELD_XREF_ID = "xref_id"; BioPAXElementProxy.SEARCH_FIELD_AVAILABILITY = "availability"; BioPAXElementProxy.SEARCH_FIELD_COMMENT = "comment";
PathwaySearch createPathwaySearch()
Acquire the instance of the search by Pathway.
The following searches are called using the acquired instance.
InteractionSearch createInteractionSearch()
Acquire the instance of Interaction search.
The following search can be called using the acquired instance.
PhysicalEntitySearch createPhysicalEntitySearch()
Acquire the instance of PhysicalEntity search.
The following search can be called using the acquired instance.
MiscSearch createMiscSearch()
Acquire the instance of other search.
The following search can be called using the acquired instance.