web/views/sparql.py
changeset 4045 f4a52abb6f4f
parent 3998 94cc7cad3d2d
child 4159 6b2b20c73d59
equal deleted inserted replaced
4044:3876c894e018 4045:f4a52abb6f4f
    42         self.w(form.render())
    42         self.w(form.render())
    43         sparql = self._cw.form.get('sparql')
    43         sparql = self._cw.form.get('sparql')
    44         vid = self._cw.form.get('resultvid', 'table')
    44         vid = self._cw.form.get('resultvid', 'table')
    45         if sparql:
    45         if sparql:
    46             try:
    46             try:
    47                 qinfo = Sparql2rqlTranslator(self._cw.schema).translate(sparql)
    47                 qinfo = Sparql2rqlTranslator(self._cw.vreg.schema).translate(sparql)
    48             except rql.TypeResolverException, ex:
    48             except rql.TypeResolverException, ex:
    49                 self.w(self._cw._('can not resolve entity types:') + u' ' + unicode('ex'))
    49                 self.w(self._cw._('can not resolve entity types:') + u' ' + unicode('ex'))
    50             except UnsupportedQuery:
    50             except UnsupportedQuery:
    51                 self.w(self._cw._('we are not yet ready to handle this query'))
    51                 self.w(self._cw._('we are not yet ready to handle this query'))
    52             except xy.UnsupportedVocabulary, ex:
    52             except xy.UnsupportedVocabulary, ex:
   100         self.w(u'<?xml version="1.0"?>\n')
   100         self.w(u'<?xml version="1.0"?>\n')
   101         self.w(etree.tostring(sparql, encoding=unicode, pretty_print=True))
   101         self.w(etree.tostring(sparql, encoding=unicode, pretty_print=True))
   102 
   102 
   103     def cell_binding(self, row, col, varname):
   103     def cell_binding(self, row, col, varname):
   104         celltype = self.cw_rset.description[row][col]
   104         celltype = self.cw_rset.description[row][col]
   105         if self._cw.schema.eschema(celltype).final:
   105         if self._cw.vreg.schema.eschema(celltype).final:
   106             cellcontent = self.view('cell', self.cw_rset, row=row, col=col)
   106             cellcontent = self.view('cell', self.cw_rset, row=row, col=col)
   107             return E.binding(E.literal(cellcontent,
   107             return E.binding(E.literal(cellcontent,
   108                                        datatype=xmlschema(celltype)),
   108                                        datatype=xmlschema(celltype)),
   109                              name=varname)
   109                              name=varname)
   110         else:
   110         else: