- From: Joy lix <joylix4112@outlook.com>
- Date: Sat, 23 Oct 2021 10:12:14 +0000
- To: "public-n3-dev@w3.org" <public-n3-dev@w3.org>
- Message-ID: <OSAPR01MB5201969B9411DD21E813A620DB819@OSAPR01MB5201.jpnprd01.prod.outlook.com>
________________________________
发件人: Joy lix <joylix4112@outlook.com>
发送时间: 2021年10月23日 18:09
收件人: Jos De Roo <josderoo@gmail.com>
主题: re: How do I write this N3 statement correctly
Dear Jos,
Thank you very much for your shift response. Your answer is very helpful to me. I haven't been able to find a detailed N3 tutorial, and the N3 specification has few detailed examples to refer to. Also, I don't know if N3 can be used with SHACL, it would be nice to have some examples.
All the best,
Joylix
________________________________
发件人: Jos De Roo <josderoo@gmail.com>
发送时间: 2021年10月23日 17:42
收件人: Joy lix <joylix4112@outlook.com>
抄送: public-n3-dev@w3.org <public-n3-dev@w3.org>
主题: 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<mailto:joylix4112@outlook.com>> wrote:
Dear, all,
I wrote a N3 statement as follows:
PREFIX 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 10:12:32 UTC