Exemplo n.º 1
0
def request(request):
    """ handles the request regarding serql queries and return the results """
    def output(result, query):
        template = loader.get_template('serql.html')
        values = {'query': query, 'result': result}

        return render_to_response('serql.html',
                                  roboearth.webpage_values(request, values))

    if request.method == 'GET':
        query = request.GET['semanticQuery']
        repository = request.GET['repository']

        return output(sesame.generic_get(query, repository), query)
    else:
        return serql(request)
Exemplo n.º 2
0
def request(request):
    """ handles the request regarding serql queries and return the results """
    def output(result, query):
        template = loader.get_template('serql.html')
        values = {'query' : query,
                  'result' : result}
    
        return render_to_response('serql.html', roboearth.webpage_values(request,values))

    if request.method == 'GET':
        query = request.GET['semanticQuery']
        repository = request.GET['repository']

        return output(sesame.generic_get(query, repository), query)
    else:
        return serql(request)
Exemplo n.º 3
0
   def create(self, request):
      """
      handle POST request to
      'http://roboearth.informatik.uni-stuttgart.de/api/0.1/serql' for generic
      semantic queries

      Upload new data:

      Content-Type: application/json which contains:

      'query' : semantic query

      'repository' : Data Repository (Objects, Recipes or Environments)
      """

      try:
         return sesame.generic_get(query=request.data['query'], repository=request.data['repository'], format="xml")
      except Exception, e:
         return rc.BAD_REQUEST
Exemplo n.º 4
0
    def create(self, request):
        """
      handle POST request to
      'http://roboearth.informatik.uni-stuttgart.de/api/0.1/serql' for generic
      semantic queries

      Upload new data:

      Content-Type: application/json which contains:

      'query' : semantic query

      'repository' : Data Repository (Objects, Recipes or Environments)
      """

        try:
            return sesame.generic_get(query=request.data['query'],
                                      repository=request.data['repository'],
                                      format="xml")
        except Exception, e:
            return rc.BAD_REQUEST