Re: question about N3 inference

Hi Joy,

What kind of graph database are you referring to? Since N3 is building on top of RDF, you will need an RDF store, with N3 support, to persist the data. 

Currently a version of Apache Jena with N3 support is in the works - but a stable release will likely only be for 2022.


Kind regards,

William


> On Sep 13, 2021, at 10:40 AM, Joy lix <joylix4112@outlook.com> wrote:
> 
> Dear Jos,
>     Thank you very much for your  swift response and your perfect solution.  It's pretty cool and works well in Notation3 Editor.
>      Another point I would like to ask is whether the data of Annotation 3 (including rules) can be saved in the graph database?  as to say, by named graph,  graphA  :implys graphB, The entire N3 diagram is then read from the graph database and run when needed.  I don't know if that's possible.
> 
> Kind regards,
> Joylix
>  
> 
> 发件人: Jos De Roo <josderoo@gmail.com>
> 发送时间: 2021年9月13日 20:18
> 收件人: Joy lix <joylix4112@outlook.com>
> 抄送: public-n3-dev@w3.org <public-n3-dev@w3.org>
> 主题: 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# <http://www.w3.org/2000/10/swap/math#>>
> PREFIX : <http://example.org/test# <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 <https://josd.github.io/>
> 
> On Mon, Sep 13, 2021 at 2:16 PM Jos De Roo <josderoo@gmail.com <mailto:josderoo@gmail.com>> wrote:
> Hi Joy,
> 
> For multiplication you can use mah:product
> 
> PREFIX math: <http://www.w3.org/2000/10/swap/math# <http://www.w3.org/2000/10/swap/math#>>
> PREFIX : <http://example.org/test# <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 <https://josd.github.io/>
> 
> On Mon, Sep 13, 2021 at 12:22 PM Joy lix <joylix4112@outlook.com <mailto: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 <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 <http://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 <http://www.w3.org/>

Received on Monday, 13 September 2021 17:51:18 UTC