[OTDev] How to upload a dataset ...

Nina Jeliazkova jeliazkova.nina at gmail.com
Fri Sep 3 08:16:47 CEST 2010


Hi Surajit,

On Fri, Sep 3, 2010 at 1:50 AM, surajit ray <mr.surajit.ray at gmail.com>wrote:

> From your previous example I gathered this
>
> RDFRepresentation r = new RDFRepresentation();
> Representation rep = r.createRepresentation(rdfDataset,
> MediaType.APPLICATION_RDF_XML);
>
> The problem is this representation does not exist in the stable
> version of Restlets !
>

If you refer to opentox-client examples, then RDFRepresentation is not a
Restlet class at all, but custom one, using Jena writers for serializing
RDF.

https://ambit.svn.sourceforge.net/svnroot/ambit/branches/opentox/opentox-client/src/main/java/org/opentox/rdf/representation/RDFRepresentation.java

Restlet RDF support is rather minimalistic (graph representation, no
querying, let alone reasoning), I am not sure if any of the partners
actually uses it. If you are working with 1.x Restlet , there is indeed no
RDF support there. But Restlet RDF support can be safely ignored if you are
already using Jena (though I would be curious to see performance comparison
between the two).

Using StringRepresentation/ FileRepresentation with media type
"application/rdf+xml" does the same job.  RDFRepresentation class discussed
above actually creates OutputStreamRepresentation.

Upload examples can be found here

https://ambit.svn.sourceforge.net/svnroot/ambit/branches/opentox/opentox-client/src/test/java/org/opentox/dataset/test/DatasetTest.java
https://ambit.svn.sourceforge.net/svnroot/ambit/branches/opentox/opentox-client/src/test/java/org/opentox/dataset/test/FeatureTest.java

The examples above are cleaned up versions of ambit code. JUnit tests of
ambit dataset services can be found here

https://ambit.svn.sourceforge.net/svnroot/ambit/trunk/ambit2-all/ambit2-www/src/test/java/ambit2/rest/test/dataset/DatasetsResourceTest.java




> Also the example uses a RemoteTask to achieve the actual upload.
> Therefore I could not exactly fathom how to do the upload.
>

Here is a summary

curl -X POST -d "@filecontent" -H "Content-type:application/rdf+xml"
http://datasetservice/dataset

This returns Task object (either URI, if -H "Accept:text/uri-list" is
specified or Task RDF representation if -H "Accept:application/rdf+xml" is
specified).  Task RDF representation is defined in
http://opentox.org/api/1_1/opentox.owl

If the task is still running you'll get result codes 201 or 202 , this means
you need to query again the returned task URI.  If code 200 is returned, the
URI returned is where the result should be found.   In the examples there is
a RemoteTask class that handles all this.

https://ambit.svn.sourceforge.net/svnroot/ambit/branches/opentox/opentox-client/src/main/java/org/opentox/task/RemoteTask.java

>
> On 3 September 2010 03:47, surajit ray <mr.surajit.ray at gmail.com> wrote:
> > Hi,
> >
> > I have managed to get a dataset (RDF) made using the results of a
> > model prediction run. Could you please tell me a dataset service where
> > I could upload the same ?
>

For testing

http://ambit-uni-plovdiv.bg:8080/ambit2/dataset

For your final models/results , especially if you would like them appearing
in ToxPredict.

http://apps.ideaconsult.net:8080/ambit2/dataset



> Also it would be very helpful if you could
> > give an example of an upload request using restlets ...
>

See above.

Hope this helps,
Nina


>
> > Thanx
> > Surajit
> >
>



More information about the Development mailing list