<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
  lang="en-US"
  metal:use-macro="here/main_template/macros/master"
  i18n:domain="eea">

<body>

<div metal:fill-slot="content-core" tal:define="options view/test_query">

<form tal:condition="options/arg_spec"
      name="method-arguments" method="get">
  <table>
    <tr tal:repeat="arg options/arg_spec">
      <td class="form-label" tal:content="arg"/>
      <td tal:define="input_name python:'%s:utf8:ustring' % (arg,)">
        <input size="50"
               tal:define="prev_value python:request.form.get(arg)"
               tal:attributes="name input_name; value prev_value"/>
      </td>
    </tr>
    <tr><td colspan="2"><input type="submit" value="Execute" i18n:attributes="value"/></td></tr>
  </table>
</form>

<blockquote class="sparql-query"
            tal:condition="options/query|nothing"
            tal:content="structure options/query"/>

<p class="sparql-stats" tal:condition="options/data">
  Received
  <span class="number" tal:content="python:len(options['data']['rows'])"/>
  rows<tal:block condition="python:'duration' in options"> in
    <span class="number" tal:content="python:'%.3f' % options['duration']"/>
  seconds</tal:block>.
</p>

<table class="sparql-results" tal:condition="options/data">
  <thead>
    <tr>
      <th tal:repeat="name options/data/var_names"
          tal:content="name"/>
    </tr>
  </thead>
  <tbody>
    <tr tal:repeat="row options/data/rows">
      <td tal:repeat="value row"
          tal:content="value/n3|string:&quot;${value}&quot;"/>
    </tr>
  </tbody>
</table>

<p class="sparql-has-result"
   tal:define="has_result options/data/has_result|nothing"
   tal:condition="python: has_result is not None">
   
      <tal:block condition="has_result" i18n:translate=""> 
          Query will return a result.
      </tal:block>
      <tal:block condition="not:has_result" i18n:translate="">
          Query will not return a result.
      </tal:block>    
   
</p>

<blockquote class="sparql-error"
            tal:condition="options/error|nothing"
            tal:content="options/error"/>

</div>
</body>
</html>
