[OTDev] Are there some sample dataset services available ?
surajit ray mr.surajit.ray at gmail.comSat Feb 20 12:06:31 CET 2010
- Previous message: [OTDev] ToxPredict beta testing report template (update)
- Next message: [OTDev] Are there some sample dataset services available ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thanks Nina, that worked ... On Sat, Feb 20, 2010 at 4:27 PM, Nina Jeliazkova <nina at acad.bg> wrote: > Hi, > > This should work in Restlet 1.x : > > Request request = new Request(); > Client client = new Client(Protocol.HTTP); > request.setResourceRef(uri); > request.setMethod(Method.GET); > request.getClientInfo().getAcceptedMediaTypes().add(new > Preference<MediaType>(media)); > Response response = client.handle(request); > if (expectedStatus.equals(Status.SUCCESS_OK)) { > > InputStream in = response.getEntity().getStream(); > //do something > in.close(); > } > > Regards, > Nina > > surajit ray wrote: > > Hi Nina, > > > > How do i set the mediatype of a request ... > > > > according to the restlet 1.0 tutorial : > > > > Note that the example above uses a simplified way to issue calls via > > the generic Client class. A more flexible way is to create a new > > Request object and to ask the Client to handle it. The example below > > illustrate how to set some preferences in your call, like a referrer > > URI. It could also be the languages and media types you prefer to > > receive as a response: > > > > > > But the tutorial does not show how to set the mediatype of the > > request. Tried using > > > > Request request = new Request(Method.GET, URIofCompound ); > > > > request.setReferrerRef(MaxtoxApplicationSettings.getServerRootPath()); > > > > request.getEntity().setMediaType(ChemicalMediaType.CHEMICAL_SMILES); > > > > but I got null pointer exceptions. also > > > > request.getEntity().setMediaType(MediaType.TEXT_PLAIN); > > > > did not work either ... so its not the ChemicalMediaType which is the > > problem > > Could you tell me how the mediatype is et for a request ? > > > > Thanks > > Surajit > > > > > > On Sat, Feb 20, 2010 at 11:58 AM, Nina Jeliazkova <nina at acad.bg > > <mailto:nina at acad.bg>> wrote: > > > > surajit ray wrote: > > > Hi Nina, > > > > > > In the restlet media types there is no option for a chemical > > mime type > > > ... how do I assign this media type to a request ? > > This is what I do > > > > public class ChemicalMediaType { > > > > public static final MediaType CHEMICAL_MDLSDF = new > > MediaType("chemical/x-mdl-sdfile"); > > public static final MediaType CHEMICAL_MDLMOL= new > > MediaType("chemical/x-mdl-molfile"); > > public static final MediaType CHEMICAL_CML = new > > MediaType("chemical/x-cml"); > > public static final MediaType CHEMICAL_SMILES = new > > MediaType("chemical/x-daylight-smiles"); > > public static final MediaType CHEMICAL_INCHI = new > > MediaType("chemical/x-inchi"); > > > > > > protected ChemicalMediaType() { > > > > } > > } > > > > > > Also it seems to return the smile as a file ... how can I get a > > string > > > response (and not a file ) ....? > > It returns a Representation - whether you treat it as a file or > string > > is up to you. > > > > Regards, > > Nina > > > > > > Thanks > > > Surajit > > > > > > > > > On Sat, Feb 20, 2010 at 11:03 AM, Nina Jeliazkova <nina at acad.bg > > <mailto:nina at acad.bg> > > > <mailto:nina at acad.bg <mailto:nina at acad.bg>>> wrote: > > > > > > surajit ray wrote: > > >> Hi Nina, > > >> > > >> tried a few ... for example > > >> (with mime type application/rdf+xml) > > >> > > >> > > > http://ambit.uni-plovdiv.bg:8080/ambit2/compound/3287/conformer/262287 > > >> > > > http://ambit.uni-plovdiv.bg:8080/ambit2/compound/17611/conformer/262288 > > >> > > > http://ambit.uni-plovdiv.bg:8080/ambit2/compound/3287/conformer/262287 > > >> > > >> I tried the same with Chemical mime type and got an sdf > > file ... > > >> > > >> However I could not get a SMILE string anywhere in the > response > > >> .... do I have to do something else to get a smile string in a > > >> response ? > > > > > > Have you tried mime type "chemical/x-daylight-smiles" ? This > > > will you give you SMILES string. > > > > > >> > > >> Also is there an easy way to get a set of molecules and their > > >> smiles. This currently looks like I have to first get and > > iterate > > >> over the rdf model and then send individual get requests (with > > >> chemical mime type) to get the SDF file (how to get SMILE - i > > >> still dont know ...) > > > The SDF/MOL itself contains structures, no need of SMILES; > > if only > > > SMILES is what you are looking for, use mime type > > > "chemical/x-daylight-smiles" . I think Christoph is using > SMILES > > > as well. > > > > > > Regards, > > > Nina > > > > > >> > > >> Thanks > > >> Surajit > > >> > > >> On Sat, Feb 20, 2010 at 1:01 AM, Nina Jeliazkova > > <nina at acad.bg <mailto:nina at acad.bg> > > >> <mailto:nina at acad.bg <mailto:nina at acad.bg>>> wrote: > > >> > > >> > > >> > > > >> > b) how do I retrieve the value contained in the Feature > > >> node in the > > >> > statement : > > >> > > > >> > RDFNode value = > > >> fv.getProperty(OT.value).getObject(); > > >> > out.write(String.format("%s=%s\n", > > >> > //Feature > > >> > > > >> fv.getProperty(OT.feature).getObject().toString(), > > >> > //Value > > >> > value)); > > >> > > > >> > Value is a string representation of the node like so > > >> > : Cc1ccc(N=Nc2c(O)ccc3ccccc23)c(c1)N(=O)O^^ > > >> > http://www.w3.org/2001/XMLSchema#string > > >> > > > >> > I would like to retrieve the just the value (the smile > > >> string ...) > > >> > > > >> > > > >> > > >> if (value.isLiteral() ) > > >> ((Literal) value).getString(); > > >> > > >> > > >> will return the string value; there are similar > > functions for > > >> other data > > >> types. But again, use it for data values, not chemical > > >> structures. > > >> > > >> Regards, > > >> Nina > > >> > > >> > > >> _______________________________________________ > > >> Development mailing list > > >> Development at opentox.org > > <mailto:Development at opentox.org> <mailto:Development at opentox.org > > <mailto:Development at opentox.org>> > > >> http://www.opentox.org/mailman/listinfo/development > > >> > > >> > > >> > > >> > > >> -- > > >> Surajit Ray > > >> Partner > > >> www.rareindianart.com <http://www.rareindianart.com> > > <http://www.rareindianart.com> > > > > > > > > > > > > > > > -- > > > Surajit Ray > > > Partner > > > www.rareindianart.com <http://www.rareindianart.com> > > <http://www.rareindianart.com> > > > > > > > > > > -- > > Surajit Ray > > Partner > > www.rareindianart.com <http://www.rareindianart.com> > > -- Surajit Ray Partner www.rareindianart.com
- Previous message: [OTDev] ToxPredict beta testing report template (update)
- Next message: [OTDev] Are there some sample dataset services available ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Development mailing list