Re: How do I write this N3 statement correctly

Hi Joy

The ruleset I shared indeed requires two rules for each type of limit, i.e., depending on whether it is inclusive or not. I think you’d need Eye’s e:derive builtin<http://eulersharp.sourceforge.net/2003/03swap/log-rules.html#derive> and use the Prolog “if-then-else” construct to make the code more generic, as Jos had shown before. (However, this builtin is currently not part of the N3 standard, and the code will thus not be portable.)


Regards

William

From: Joy lix <joylix4112@outlook.com>
Date: Monday, November 8, 2021 at 10:41 AM
To: William Van Woensel <william.vanwoensel@gmail.com>, Jos De Roo <josderoo@gmail.com>
Subject: 回复: How do I write this N3 statement correctly
Dear William, Jos:
      It was a wonderful solution, and this example made me appreciate the power of the N3.    This also confirms that it is possible to store simple logical and conditional data in plain RDF, This allows me to take advantage of the various visualizations and graph database tools of RDF and further leverage the reasoning power of N3.
      But there's a little problem in this example that would be more general if we could solve it.
   :inclusive false (or true), here should be a variable,

?limit :type :Lower ;
           :inclusive ?inclusive ;
            rdf:value ?limitVal .
?property rdf:value ?prpVal .

so if  ?inclusive=true, then
    ?limitVal math:notGreaterThan ?prpVal
otherwise:
    ?limitVal math:lessThan ?prpVal
The same is  for upper limit.

How can we improve the N3 statement with this in mind?
Thank you very much for your valuable help.

Best regards,
Joyllix





________________________________
发件人: William Van Woensel <william.vanwoensel@gmail.com>
发送时间: 2021年11月6日 0:34
收件人: Jos De Roo <josderoo@gmail.com>
抄送: Joy lix <joylix4112@outlook.com>; public-n3-dev@w3.org <public-n3-dev@w3.org>
主题: Re: How do I write this N3 statement correctly


Thanks Jos :-) Indeed we can use the “math:not” builtins (I forgot about those!): http://ppr.cs.dal.ca:3002/n3/editor/s/A8rlaXpJ






W



From: Jos De Roo <josderoo@gmail.com>
Date: Friday, November 5, 2021 at 1:19 PM
To: William Van Woensel <william.vanwoensel@gmail.com>
Cc: Joy lix <joylix4112@outlook.com>, public-n3-dev@w3.org <public-n3-dev@w3.org>
Subject: Re: How do I write this N3 statement correctly

Very nice and greaterOrEqualTo can be done with math:notLessThan





Op vr 5 nov. 2021 14:12 schreef William Van Woensel <william.vanwoensel@gmail.com<mailto:william.vanwoensel@gmail.com>>:

Hi Joy



I drafted the following code for your example: http://ppr.cs.dal.ca:3002/n3/editor/s/lycuLUp2 (currently Eye does not support greaterOrEqualTo so we have to make do..). I slightly refactored your example to make the solution a bit more elegant – essentially, the rules first check whether individual limits are met, and, subsequently, whether a given rule has all its limits met.





William



From: Joy lix <joylix4112@outlook.com<mailto:joylix4112@outlook.com>>
Date: Monday, November 1, 2021 at 2:48 PM
To: William Van Woensel <william.vanwoensel@gmail.com<mailto:william.vanwoensel@gmail.com>>, public-n3-dev@w3.org<mailto:public-n3-dev@w3.org> <public-n3-dev@w3.org<mailto:public-n3-dev@w3.org>>
Subject: 回复: How do I write this N3 statement correctly

Dear Willian,

      Thank you very much!  The output options you added to the N3 Editor make the reasoning result look much more convenient.  Your example of N3 on general conditional reasoning also inspired me a lot.   Although It doesn't give us the final result we need, but there may be a way to do it.

please have a Look at this general example:

@prefix : <#> .

:decisionSystem :hasRule :rule1, :rule2, :rule3;

          :isAbout :PropertyA .

:rule1 :range [:lowerLimit :Low ;

                    :lowerInclusive "True" ;

                    :upperLimit :High ;

                    :upperInclusive "False" ];

       :conclusion "suitable".



:rule2 :range [:upperLimit :Low ;

                       :upperInclusive "False" ] ;

         :conclusion "tooLow".



:rule3 :range [:lowerLimit :High ;

                      :lowerInclusive "True" ] ;

        :conclusion "tooHigh".

     Let's say PropertyA is the temperature of the room, :Low=18, :High=28, so When entering the actual temperature of the room, the system should be able to deduce the current comfort level.  This is a practical example of how I want to use plain RDF to store simple conditional data,  This data can then be reconstituted into N3 for inference. This general example is useful for solving many practical problems in engineering.

In this example, I'm still a little confused about how to handle whether the boundary is inclusive or not.

    In addition, Ryan mentioned that you can store conditional data in strings, but I don't know how to handle this in N3.



Kind regards,

Joylix









________________________________

发件人: William Van Woensel <william.vanwoensel@gmail.com<mailto:william.vanwoensel@gmail.com>>
发送时间: 2021年10月31日 1:44
收件人: Joy lix <joylix4112@outlook.com<mailto:joylix4112@outlook.com>>; public-n3-dev@w3.org<mailto:public-n3-dev@w3.org> <public-n3-dev@w3.org<mailto:public-n3-dev@w3.org>>
主题: Re: How do I write this N3 statement correctly



Hi Joy



In addition to what Jos shares with you, you can try out the following “pure” N3 code (not relying on Eye-specific builtins) to arbitrarily combine logical conditions: http://ppr.cs.dal.ca:3002/n3/editor/s/mEWJDvxb (It relies on N3’s ability to write rules that themselves generate new rules, and embed variables directly in the data, for instance.)



Unfortunately, it only infers whether the condition of the subject “tempTest” is met (conditionMet = true), and not which resources led to it being true (e.g., temperature1 or temperature2). So, I don’t know whether it fully meets your needs. At any rate, maybe the plugin code can give you some other ideas :-)





William



From: Joy lix <joylix4112@outlook.com<mailto:joylix4112@outlook.com>>
Date: Saturday, October 23, 2021 at 5:27 AM
To: "public-n3-dev@w3.org<mailto:public-n3-dev@w3.org>" <public-n3-dev@w3.org<mailto:public-n3-dev@w3.org>>
Subject: How do I write this N3 statement correctly
Resent-From: <public-n3-dev@w3.org<mailto:public-n3-dev@w3.org>>
Resent-Date: Sat, 23 Oct 2021 08:27:46 +0000



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 Monday, 8 November 2021 20:53:54 UTC