[Mulgara-dev] Mulgara 2.0.7 - support for sparql?

Paul Gearon gearon at ieee.org
Tue Feb 10 13:30:32 UTC 2009


On Tue, Feb 10, 2009 at 3:19 AM, Agustina Martinez <amgcia at gmail.com> wrote:
> Lots of thanks Paul!!! The real thing is that I was pretending to pass the
> data directly from the results obtained from the REST call to Fedora API-A
> to obtain directly the RDF, but I didn't know how to, thats why I thought on
> copying the response to a file and after that call the service using POST
> request. But it really less efficient I think. Maybe your Calais trick can
> apply to the rdf obtained as a string from the Fedora GET methods :-).

Sure. Instead of filling the entity for the "post" with a FileBody,
you use your own class. You just have to extend StringBody and
override the getFilename method:

import java.nio.charset.Charset;
import org.apache.http.entity.mime.content.StringBody;

static class DataBody extends StringBody {
  private String name;

  public DataBody(String text, String name) throws
UnsupportedEncodingException {
    super(text, Charset.forName("UTF-8"););
    this.name = name;
  }

  public String getFilename() {
    return name;
  }
}


Regards,
Paul



More information about the Mulgara-dev mailing list