Re: How do I write this N3 statement correctly

Hi Joy,

In eye you can use the low level built-in
http://eulersharp.sourceforge.net/2003/03swap/log-rules.html#derive
and write

PREFIX math: <http://www.w3.org/2000/10/swap/math#>
PREFIX log: <http://www.w3.org/2000/10/swap/log#>
PREFIX e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>
PREFIX : <http://example.org/ns#>

:temperature1 :value -20.
:temperature2 :value 42.
:temperature3 :value 21.

{   ?temperature :value ?value.
    ("if_then_else"
        {?value math:notLessThan -10. ?value math:notGreaterThan 40}
        {?state log:equalTo :normal}
        {?state log:equalTo :abnormal}
    ) e:derive true.
}
=>
{?temperature :state ?state}.

When you execute this in http://ppr.cs.dal.ca:3002/n3/editor/s/CcH7TiZG
it indeed outputs the results of --pass-all and with --pass-only-new you
would only get

:temperature1 :state :abnormal.
:temperature2 :state :abnormal.
:temperature3 :state :normal.

but I am not sure whether William could provide such an option.

Jos

-- https://josd.github.io


On Sat, Oct 23, 2021 at 10:27 AM Joy lix <joylix4112@outlook.com> wrote:

> Dear, all,
> I wrote a N3 statement as follows:
>
> *PREFIX math: <http://www.w3.org/2000/10/swap/math#
> <http://www.w3.org/2000/10/swap/math#>>*
>
> *:temperature1 :value -20.*
> *:temperature2 :value 42.*
>
> *{?temperature :value ?value. ?value math:lessThan -10} *
> * =>*
> *{?temperature :value :abnormal }.*
>
> *{?temperature :value ?value . ?value math:greaterThan 40}*
> *=>*
> *{?temperature :value :abnormal }.*
>
>
> Is there any way to  use "or" to simplify it into a single inference
> statement? And how do I use "else" to indicate that temperature values
> outside these ranges are "normal"?
> In addition, I use http://ppr.cs.dal.ca:3002/n3/editor/, in the deductive
> information of "eye", can I show only the inferred results alone?
>       Thanks for helping.
>
> Joylix
>
>

Received on Saturday, 23 October 2021 09:43:18 UTC