You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Ian Dickinson <i....@gmail.com> on 2013/11/12 15:42:50 UTC

Fuseki UI: validation conneg

Hi Andy,
Can we have the various /validate/* methods return JSON when
application/json is requested? I'm replicating the behaviour of the
current validation forms, but I'd like to do them as Ajax requests and
display the results in a codemirror box. So all a JSON API needs to
return is the validation output.

Thanks,
Ian

Re: Fuseki UI: validation conneg

Posted by Ian Dickinson <i....@gmail.com>.
On Wed, Nov 13, 2013 at 9:43 PM, Andy Seaborne <an...@apache.org> wrote:
> I've put in a new query validator (and only the query validator for now)
> that returns a JSON structure. It does all the parsing and formatting
> choices in one go so the UI can switch quickly between them.
Thanks Andy. I've updated the validation page to use the new API. A
bit quick & dirty on the error reporting side, but we can clean that
up later. At least validation is now functional again!

Ian

Re: Fuseki UI: validation conneg

Posted by Andy Seaborne <an...@apache.org>.
On 13/11/13 08:26, Andy Seaborne wrote:
> On 12/11/13 14:42, Ian Dickinson wrote:
>> Hi Andy,
>> Can we have the various /validate/* methods return JSON when
>> application/json is requested? I'm replicating the behaviour of the
>> current validation forms, but I'd like to do them as Ajax requests and
>> display the results in a codemirror box. So all a JSON API needs to
>> return is the validation output.
>>
>> Thanks,
>> Ian
>>
>
> Hi Ian,
>
> Sure - the error reports are just the outputs of the underlying parser
> for whatever is being validated so while it's big strings of the
> formatter and error message it's simple to do.  I might be able to grab
> the line/column as well (can't remember is that's separately available
> by the time the exception bubbles up).
>
>      Andy

I've put in a new query validator (and only the query validator for now) 
that returns a JSON structure. It does all the parsing and formatting 
choices in one go so the UI can switch quickly between them.

Example:

{ "algebra" : "(base <http://example/base/>\n  ...\n" ,
   "algebra-opt" : "(....)\n" ,
   "algebra-opt-quads" : "(..)\n" ,
   "algebra-quads" : "(...)\n" ,
   "formatted" : "PREFIX  :     <http://example/>\n\nSELECT  *\nWHERE\n 
  { :s :p ?o }\n" ,
   "input" : "PREFIX : <http://example/> \nSELECT * { :s :p ?o }"
}

Or for a parse error:

{ "input" : "SELECT * { :s :p ?o }" ,
   "parse-error" : "Line 1, column 12: Unresolved prefixed name: :s" ,
   "parse-error-column" : 12 ,
   "parse-error-line" : 1
}

If I set the output to text/plain it appears in the VALIDATION OUTPUT 
area.  It checked in as application/json (nothing appears - not 
surprisingly)

	Andy

Re: Fuseki UI: validation conneg

Posted by Andy Seaborne <an...@apache.org>.
On 12/11/13 14:42, Ian Dickinson wrote:
> Hi Andy,
> Can we have the various /validate/* methods return JSON when
> application/json is requested? I'm replicating the behaviour of the
> current validation forms, but I'd like to do them as Ajax requests and
> display the results in a codemirror box. So all a JSON API needs to
> return is the validation output.
>
> Thanks,
> Ian
>

Hi Ian,

Sure - the error reports are just the outputs of the underlying parser 
for whatever is being validated so while it's big strings of the 
formatter and error message it's simple to do.  I might be able to grab 
the line/column as well (can't remember is that's separately available 
by the time the exception bubbles up).

	Andy