[OTDev] How to upload a dataset ...
surajit ray mr.surajit.ray at gmail.comFri Sep 3 17:33:42 CEST 2010
- Previous message: [OTDev] How to upload a dataset ...
- Next message: [OTDev] How to upload a dataset ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, Tried uploading using this piece of code ************************************ System.out.println(result_dataset_URI); Representation representation = new OutputRepresentation(MediaType.APPLICATION_RDF_XML) { @Override public void write(OutputStream out) throws IOException { resultDataset.write(out, "RDF/XML-ABBREV"); } }; Request request = new Request(); Client client = new Client(Protocol.HTTP); request.setResourceRef(result_dataset_URI); request.setReferrerRef(MaxtoxApplicationSettings.getServerRootPath()); request.setMethod(Method.POST); request.getClientInfo().getAcceptedMediaTypes().add(new Preference<MediaType>(MediaType.APPLICATION_RDF_XML)); request.setEntity(representation); Response response = client.handle(request); // Get the output from the response Representation output = response.getEntity(); this.uploaded_URI = output.getText(); ************************************ I got this as the result ************************************* 0.0 Error 1283527568408 File import application/rdf+xml [-1] The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation 500 ************************************* Could you clarify ? I am using the http://apps.ideaconsult.net:8080/ambit2/dataset for testing as the other server was down - sorry for that. I just uploaded twice so you can delete 2 vague looking databases ... Regards Surajit On 3 September 2010 11:46, Nina Jeliazkova <jeliazkova.nina at gmail.com> wrote: > 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 >> > > > >
- Previous message: [OTDev] How to upload a dataset ...
- Next message: [OTDev] How to upload a dataset ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Development mailing list