Skip to content

Instantly share code, notes, and snippets.

@egonw
Created May 6, 2009 11:03
Show Gist options
  • Select an option

  • Save egonw/107480 to your computer and use it in GitHub Desktop.

Select an option

Save egonw/107480 to your computer and use it in GitHub Desktop.
// connect to the XMPP hive
xmpp.connect();
// we are going to call the RDF bridge to http://rdf.openmolecule.net/
service = xmpp.getService("rdf.ws1.bmc.uu.se");
service.discoverSync(5000);
service.getFunctions();
func = service.getFunction("Bridge to RDF.OpenMolecules.net");
// the input is a RDF description element of which only the rdf:about
// attribute is used by the service
inchi = "InChI=1/CH4/h1h4";
input = "<rdf:Description xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' " +
"about='http://rdf.openmolecules.net/?" + inchi + "'/>";
js.clear()
js.print("Molecule InChI: " + inchi + "\n");
result = func.invokeSync(input, 900000);
rdfReturned = xmpp.toString(result);
// convert the returned CML into CMLXOM and extract the value
js.print("RDF:\n")
js.print(rdfReturned + "\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment