- From: Jos De Roo <josderoo@gmail.com>
- Date: Mon, 13 Sep 2021 14:16:58 +0200
- To: Joy lix <joylix4112@outlook.com>
- Cc: "public-n3-dev@w3.org" <public-n3-dev@w3.org>
- Message-ID: <CAJbsTZf=+2SSZsxviOOu_LxWgYjvs5h4oE5+DXQcwkqaZiHhGg@mail.gmail.com>
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:17:22 UTC