Re: question about N3 inference

and it should give

$ eye --quiet --nope /tmp/bmi.n3 --pass 2>/dev/null
PREFIX math: <http://www.w3.org/2000/10/swap/math#>
PREFIX : <http://example.org/test#>

:Bob a :Person.
:Joe a :Person.
:Jos a :Person.
:Bob :weight 80 .
:Joe :weight 70 .
:Jos :weight 73 .
:Bob :height 1.78 .
:Joe :height 1.7 .
:Jos :height 1.8 .
:Bob :bmi 25.24933720489837 .
:Joe :bmi 24.221453287197235 .
:Jos :bmi 22.530864197530864 .
:Joe :bodyType :Medium.
:Jos :bodyType :Medium.
:Bob :bodyType :Fat.

-- https://josd.github.io


On Mon, Sep 13, 2021 at 2:16 PM Jos De Roo <josderoo@gmail.com> wrote:

> Hi Joy,
>
> For multiplication you can use mah:product
>
> PREFIX math: <http://www.w3.org/2000/10/swap/math#>
>> PREFIX : <http://example.org/test#>
>
>
> :Bob a :Person ;
>     :weight 80 ;     # ( kg )
>     :height 1.78 .   # ( m  )
> :Joe a :Person ;
>     :weight 70 ;
>     :height 1.7 .
>
> {
>     ?PERSON a :Person ;
>         :weight ?WEIGHT ;
>         :height ?HEIGHT .
>     (?HEIGHT ?HEIGHT) math:product ?HEIGHTSQUARE .
>     (?WEIGHT ?HEIGHTSQUARE) math:quotient ?BMI .
> }
>     =>
> {
>     ?PERSON :bmi ?BMI .
> }.
>
> {
>     ?PERSON :bmi ?BMI.
>     ?BMI math:lessThan 19 .
> }
>     =>
> {
>     ?PERSON :bodyType :Thin .
> }.
>
> {
>     ?PERSON :bmi ?BMI.
>     ?BMI math:notLessThan 19 .
>     ?BMI math:lessThan 25 .
> }
>     =>
> {
>     ?PERSON :bodyType :Medium .
> }.
>
> {
>     ?PERSON :bmi ?BMI.
>     ?BMI math:notLessThan 25 .
> }
>     =>
> {
>     ?PERSON :bodyType :Fat .
> }.
>
>
> -- https://josd.github.io
>
>
> On Mon, Sep 13, 2021 at 12:22 PM Joy lix <joylix4112@outlook.com> wrote:
>
>> *Dear* all,  I'm not very familiar with the syntax of the N3 EYE, please
>> take a look at the data below:
>>
>> *PREFIX math: <http://www.w3.org/2000/10/swap/math#
>> <http://www.w3.org/2000/10/swap/math#>>*
>>
>> *:Bob a :Person ;*
>> *       :weight  80 ;            # ( kg )*
>> *       :hight   1.78 .           # ( m**  ) *
>> *:Joe a :Person ;*
>> *       :weight  70 ;        *
>> *       :hight   1.7 .           *
>>
>> *Suppose the rules for calculating body type are as follows:  *
>>
>> *BodyMassIndex = weight/height^2   # or weight/(height*height)*
>> *if   BodyMassIndex<19   then *
>> *      :Person  :bodyType :Thin ;*
>> *else if  BodyMassIndex >=19 &&  BodyMassIndex <25 then*
>> *      :Person  :bodyType :Medium ;*
>> *else                  # BodyMassIndex>=25*
>> *      :Person  :bodyType :Fat ;   *
>>
>> Therefore, I expect the following inference results:
>>
>> :Bob  :bodyType :Fat   .            # BodyMassIndex=25.25
>> :Joe  :bodyType :Medium  .       # BodyMassIndex=24.22
>>
>> I didn't find an expression for multiplication in
>> http://www.w3.org/2000/10/swap/math, does anyone who can help me with
>> this N3 inference formula? Thanks in advance.
>>
>> Best,
>> joylix
>>
>>
>> W3 <http://www.w3.org/2000/10/swap/math>
>> A math:Function is unique in terms of math:EqualTo. Function The class of
>> things that are DAML lists were all of the members are math:Value items.
>> List a logical operator allows evaluation eihter way, or testing
>> relationship between two values A math:ReverseFunction is unambiguous in
>> terms of math:EqualTo. StrictProperty This is the class of things that are
>> math lists with only two members.
>> www.w3.org
>>
>> W3 <http://www.w3.org/2000/10/swap/math>
>> A math:Function is unique in terms of math:EqualTo. Function The class of
>> things that are DAML lists were all of the members are math:Value items.
>> List a logical operator allows evaluation eihter way, or testing
>> relationship between two values A math:ReverseFunction is unambiguous in
>> terms of math:EqualTo. StrictProperty This is the class of things that are
>> math lists with only two members.
>> www.w3.org
>>
>>
>>

Received on Monday, 13 September 2021 12:19:00 UTC