JavaCyc Example Query
JavaCyc Example Query
The following example of a query in Java, provided by Thomas Yan, is a transliteration of
the corresponding Lisp query (atp-inhibits) , which can be found among the
Example Pathway Tools queries in Common Lisp.
It finds all enzymes for which ATP is an inhibitor.
import java.util.*;
public class JavacycSample {
public static void main(String[] args) {
Javacyc cyc = new Javacyc("ECOLI");
ArrayList enzrxns =
cyc.getClassAllInstances("|Enzymatic-Reactions|");
for (int i = 0; i < enzrxns.size(); i++) {
String er = (String)enzrxns.get(i);
// We test for whether the INHIBITORS-ALL
// slot contains the compound frame ATP
boolean bool =
cyc.memberSlotValueP(er, "Inhibitors-All", "Atp");
if (bool) {
// Whenever the test is positive, we collect
// the value of the slot ENZYME. The results
// are printed in the terminal.
String enz = cyc.getSlotValue(er, "Enzyme");
System.out.println(enz);
}
}
}
}
|