title: Convert Remote sparql endpoint json results into JSON-LD
body: <p>I have a Sparql Endpoint(openrdf sesame) on my local machine. I am able to get the results of the queries(6) in json (using sparql-client node module). Now, I need to convert this json into json-ld so that I can easily display it in the jade file. How can I do this without using rdfstore-js in my node.js application? I did read about jsonld node module. The json data is quite huge and so I cant specify the context for it.</p>
  
  <p>Problem with rdfstore-js:
  Since the endpoint is on my local machine, I am facing the cross domain issue. So, I tried to load data from remote sparql endpoints into the store but it does not work. 
  <a href="https://github.com/antoniogarrote/rdfstore-js/issues/20" rel="nofollow">https://github.com/antoniogarrote/rdfstore-js/issues/20</a></p>
  
  <p>Alternatively, I am open to suggestions wherein I can display data without json-ld.</p>
  
  <p>Edit: After reading Gregg' suggestion, I tried to use CONSTRUCT query. However, the sesame server 
  returns response of the query as text/plain. I tried the content negotiation by giving accept header for json-ld. But it would fail - gives me 'No acceptable file format found'.</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p>I am now using http nodejs module as below. I get the response as text/plain. Is there a way to convert plain text into json-ld ?</p>
  
  <pre><code>var queryString = syllPrefix+" CONSTRUCT { ?uri ?p ?o } where  { ?uri a syll:Person . ?uri ?p ?o}";
  var encodedquerystring = encodeURIComponent(queryString);
  var options = {
          host: 'localhost',
          port: 8080,
          path: '/openrdf-sesame/repositories/myrepo?query=' +encodedquerystring,
          headers: {
              'Content-Type': 'application/x-www-form-urlencoded',
              'Accept': 'text/plain',
          },
        };
  
  
  var req = http.get(options, function(res) {
    //  console.log("Got response: " + res.statusCode);
     // console.log('HEADERS: ' + JSON.stringify(res.headers));
      var data = "";
      res.on('data', function (chunk) {
        data += chunk;
      });
      res.on('end', function () {
        console.log (data);
      });
    }).on('error', function(e) {
      console.log("Got error: " + e.message);
    });
    req.end();
  </code></pre>