[Biojava-l] Ontology and BioSQL
Richard HOLLAND
hollandr at gis.a-star.edu.sg
Wed Dec 1 02:58:08 EST 2004
Hi all,
I am trying to use the Ontology class in Biojava 1.4rc1 to create terms
and triples, which are automatically persisted using the BioSQL links in
BioJava. Here is my code:
BioSQLSequenceDB db = new BioSQLSequenceDB(dbURL,
dbUser,
dbPass,
biodatabase,
createIfMissing);
Ontology o = db.createOntology("MyOntology","An ontology"); //
Use getOntology to update
Term MyGroup = o.createTerm("MyGroup","My favourite terms.");
Term Boo = o.createTerm("Boo","A fright");
Term ISA = o.createTerm("ISA","Is a");
Term Joke = o.createTerm("Joke","Something funny");
o.createTriple(Boo,Joke,ISA,null,null);
I get the following exception (NB. the ontology does not exist yet but
the database connection is just fine):
Exception in thread "main" org.biojava.bio.BioRuntimeException: Error
removing from BioSQL tables (rolled back successfully)
at
org.biojava.bio.seq.db.biosql.OntologySQL.persistTriple(OntologySQL.java
:588)
at
org.biojava.bio.seq.db.biosql.OntologySQL.access$300(OntologySQL.java:61
)
at
org.biojava.bio.seq.db.biosql.OntologySQL$OntologyMonitor.postChange(Ont
ologySQL.java:512)
at
org.biojava.utils.ChangeSupport.firePostChangeEvent(ChangeSupport.java:3
38)
at org.biojava.ontology.Ontology$Impl.createTriple(Ontology.java:497)
at testapp.LoadOntology.main(LoadOntology.java:61)
Caused by: java.sql.SQLException: Failed to persist term: ISA(Boo, Joke)
from ontology: ontology: MyOntology with error: 1 : 23000
at
org.biojava.bio.seq.db.biosql.OntologySQL.persistTerm(OntologySQL.java:5
62)
at
org.biojava.bio.seq.db.biosql.OntologySQL.persistTriple(OntologySQL.java
:595)
at
org.biojava.bio.seq.db.biosql.OntologySQL.persistTriple(OntologySQL.java
:576)
... 5 more
Caused by: java.sql.SQLException: ORA-00001: unique constraint
(BIOSQL_OWNER.XAK1TERM) violated
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:12
5)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
at
oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.jav
a:181)
at
oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStat
ement.java:543)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.
java:1028)
at
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePrepare
dStatement.java:2888)
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedS
tatement.java:2960)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(Delega
tingPreparedStatement.java:101)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(Delega
tingPreparedStatement.java:101)
at
org.biojava.bio.seq.db.biosql.OntologySQL.persistTerm(OntologySQL.java:5
54)
... 7 more
Java Result: 1
When I check in the database, I find that the ontology has been created,
and entries made in term for each of the terms, and also an entry has
been made in term for the triple itself. So why the exception? Is it
trying to insert the triple twice?
cheers,
Richard
Richard Holland
Bioinformatics Specialist
Genome Institute of Singapore
60 Biopolis Street, #02-01 Genome, Singapore 138672
Tel: (65) 6478 8000 DID: (65) 6478 8199
Email: hollandr at gis.a-star.edu.sg
---------------------------------------------
This email is confidential and may be privileged. If you are not the
intended recipient, please delete it and notify us immediately. Please
do not copy or use it for any purpose, or disclose its content to any
other person. Thank you.
---------------------------------------------
More information about the Biojava-l
mailing list