You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Jindřich Mynarz <my...@gmail.com> on 2016/06/20 17:17:38 UTC

Riot CMD: parsing invalid data returns exit code 0

Hi,

parsing invalid data data with Riot command-line tool (
https://jena.apache.org/documentation/io/#command-line-tools) returns exit
code 0 (i.e. success) instead of an error exit code:

riot --validate invalid.ttl; echo $?
# => 0

Is that an intentional design choice?

My Riot version information:

riot --version
Jena:       VERSION: 3.1.0
Jena:       BUILD_DATE: 2016-05-10T11:59:39+0000
RIOT:       VERSION: 3.1.0
RIOT:       BUILD_DATE: 2016-05-10T11:59:39+0000

- Jindřich

-- 
Jindřich Mynarz
http://mynarz.net/#jindrich

Re: Riot CMD: parsing invalid data returns exit code 0

Posted by Andy Seaborne <an...@apache.org>.
On 21/06/16 10:16, Andy Seaborne wrote:
> An exit code would be good - a contribution maybe?

Recorded as:
https://issues.apache.org/jira/browse/JENA-1197



Re: Riot CMD: parsing invalid data returns exit code 0

Posted by Andy Seaborne <an...@apache.org>.
On 20/06/16 22:06, Jind\u0159ich Mynarz wrote:
> On Mon, Jun 20, 2016 at 10:39 PM, Andy Seaborne <an...@apache.org> wrote:
>>
>> Shell magic are be applied:
>>
>> capture the output and test it.
>>
>> If in a subshell, the exit here will set the out $?
>>
>> -------------
>> #!/bin/bash
>>
>> (
>>     X="$(riot --validate ... 2&>1)"
>>     if [[ -n "$X" ]]
>>     then
>>        exit 99
>>     fi
>> )
>> echo $?
>> -------------
>
>
> Yes. I'm already using a similar approach to validate Turtle files:
>
> find . \
>       -type f \
>       -name "*.ttl" e
>       -exec sh \
>       -c 'if [[ $(riot --validate "{}" 2>&1) ]]; then echo "{}"; fi' \;
>
> I was just thinking if there is simpler way.

An exit code would be good - a contribution maybe?

(adding an error handler that notes when it is called and otherwise 
passes through to the one that logs the messages would be my first line 
of investigation).

	Andy

>
> - Jind\u0159ich
>


Re: Riot CMD: parsing invalid data returns exit code 0

Posted by Jindřich Mynarz <my...@gmail.com>.
On Mon, Jun 20, 2016 at 10:39 PM, Andy Seaborne <an...@apache.org> wrote:
>
> Shell magic are be applied:
>
> capture the output and test it.
>
> If in a subshell, the exit here will set the out $?
>
> -------------
> #!/bin/bash
>
> (
>    X="$(riot --validate ... 2&>1)"
>    if [[ -n "$X" ]]
>    then
>       exit 99
>    fi
> )
> echo $?
> -------------


Yes. I'm already using a similar approach to validate Turtle files:

find . \
     -type f \
     -name "*.ttl" e
     -exec sh \
     -c 'if [[ $(riot --validate "{}" 2>&1) ]]; then echo "{}"; fi' \;

I was just thinking if there is simpler way.

- Jindřich

Re: Riot CMD: parsing invalid data returns exit code 0

Posted by Andy Seaborne <an...@apache.org>.
On 20/06/16 21:15, Jind\u0159ich Mynarz wrote:
> On Mon, Jun 20, 2016 at 9:54 PM, Andy Seaborne <an...@apache.org> wrote:
>
>> The "--validate" is a command line tool for checking data and producing a
>> report. It does multiple files in one run.
>>
>
> OK, I see. Is there another way to run Riot command line tool so that it
> produces an error exit status when provided with syntactically invalid
> input?

Shell magic are be applied:

capture the output and test it.

If in a subshell, the exit here will set the out $?

-------------
#!/bin/bash

(
    X="$(riot --validate ... 2&>1)"
    if [[ -n "$X" ]]
    then
       exit 99
    fi
)
echo $?
-------------


>
> But what errors/warnings do you get?
>
>
> Just a regular (and correct) ERROR because of invalid syntax of my input.
>
> - Jind\u0159ich
>


Re: Riot CMD: parsing invalid data returns exit code 0

Posted by Jindřich Mynarz <my...@gmail.com>.
On Mon, Jun 20, 2016 at 9:54 PM, Andy Seaborne <an...@apache.org> wrote:

> The "--validate" is a command line tool for checking data and producing a
> report. It does multiple files in one run.
>

OK, I see. Is there another way to run Riot command line tool so that it
produces an error exit status when provided with syntactically invalid
input?

But what errors/warnings do you get?


Just a regular (and correct) ERROR because of invalid syntax of my input.

- Jindřich

Re: Riot CMD: parsing invalid data returns exit code 0

Posted by Andy Seaborne <an...@apache.org>.
On 20/06/16 18:17, Jind\u0159ich Mynarz wrote:
> Hi,
>
> parsing invalid data data with Riot command-line tool (
> https://jena.apache.org/documentation/io/#command-line-tools) returns exit
> code 0 (i.e. success) instead of an error exit code:
>
> riot --validate invalid.ttl; echo $?
> # => 0
>
> Is that an intentional design choice?

Not intentional.

The "--validate" is a command line tool for checking data and producing 
a report. It does multiple files in one run.


But what errors/warnings do you get?

     Andy

>
> My Riot version information:
>
> riot --version
> Jena:       VERSION: 3.1.0
> Jena:       BUILD_DATE: 2016-05-10T11:59:39+0000
> RIOT:       VERSION: 3.1.0
> RIOT:       BUILD_DATE: 2016-05-10T11:59:39+0000
>
> - Jind\u0159ich
>