[OTDev] how to get compound URIs for the compounds I add to a dataset?

Nina Jeliazkova jeliazkova.nina at gmail.com
Fri Oct 29 17:42:56 CEST 2010


On 29 October 2010 18:40, Nina Jeliazkova <jeliazkova.nina at gmail.com> wrote:

>
>
> On 29 October 2010 18:30, Egon Willighagen <egon.willighagen at gmail.com>wrote:
>
>> On Fri, Oct 29, 2010 at 5:23 PM, Nina Jeliazkova
>> <jeliazkova.nina at gmail.com> wrote:
>> > Yet another option.
>>
>> OK, something related... I'm now creating a data set and then
>> requesting it's features with:
>>
>> http://apps.ideaconsult.net:8080/ambit2/dataset/11955/features
>>
>
BTW, look for the HTTP status code - it should be 200 OK - and then read the
result.  For the link above it returns Not found 404.

Nina


>
>> (data sets I remove afterwards, so this link will not work...)
>>
>
>
>
>
>>
>> I'm using this code (fullURI is the one above):
>>
>> HttpMethod method = new GetMethod(fullURI);
>>                method.setRequestHeader("Accept", "text/uri-list");
>>                client.executeMethod(method);
>>                System.out.println(method.getResponseBodyAsString());
>>                method.releaseConnection();
>>                List<String> features = new ArrayList<String>();
>>                BufferedReader reader = new BufferedReader(
>>                        new StringReader(method.getResponseBodyAsString())
>>                );
>>                String line;
>>                while ((line = reader.readLine()) != null) {
>>                        line = line.trim();
>>                        if (line.length() > 0) features.add(line);
>>                }
>>                return features;
>>
>> But I get an HTML page instead of the URIs of the features instead...
>>
>> What Accept should I be using? Can't find this in the 1.1 specs...
>>
>
> This should work (but the link above is nonexistent)
>
> curl -H "Accept:text/uri-list"
> http://apps.ideaconsult.net:8080/ambit2/dataset/1/feature
> http://apps.ideaconsult.net:8080/ambit2/feature/1
> http://apps.ideaconsult.net:8080/ambit2/feature/2
> http://apps.ideaconsult.net:8080/ambit2/feature/3
> http://apps.ideaconsult.net:8080/ambit2/feature/4
> http://apps.ideaconsult.net:8080/ambit2/feature/5
> http://apps.ideaconsult.net:8080/ambit2/feature/6
> http://apps.ideaconsult.net:8080/ambit2/feature/7
> http://apps.ideaconsult.net:8080/ambit2/feature/8
> http://apps.ideaconsult.net:8080/ambit2/feature/9
> http://apps.ideaconsult.net:8080/ambit2/feature/10
> http://apps.ideaconsult.net:8080/ambit2/feature/11
> http://apps.ideaconsult.net:8080/ambit2/feature/12
> http://apps.ideaconsult.net:8080/ambit2/feature/13
> http://apps.ideaconsult.net:8080/ambit2/feature/14
> http://apps.ideaconsult.net:8080/ambit2/feature/15
> http://apps.ideaconsult.net:8080/ambit2/feature/16
> http://apps.ideaconsult.net:8080/ambit2/feature/17
>
> You could get features with "Accept:application/rdf+xml" as well.
>
> Nina
>
>>
>> Egon
>>
>> --
>> Dr E.L. Willighagen
>> Postdoctoral Research Associate
>> University of Cambridge
>> Homepage: http://egonw.github.com/
>> LinkedIn: http://se.linkedin.com/in/egonw
>> Blog: http://chem-bla-ics.blogspot.com/
>> PubList: http://www.citeulike.org/user/egonw/tag/papers
>> _______________________________________________
>> Development mailing list
>> Development at opentox.org
>> http://www.opentox.org/mailman/listinfo/development
>>
>
>



More information about the Development mailing list