- From: Irene Polikoff <irene@topquadrant.com>
- Date: Tue, 10 Aug 2021 12:11:20 -0400
- To: Joy lix <joylix4112@outlook.com>
- Cc: Holger Knublauch <holger@topquadrant.com>, "public-shacl@w3.org" <public-shacl@w3.org>
- Message-Id: <8BE80BCD-6A71-4D4D-8EB1-8C34F6CDF00B@topquadrant.com>
If you are using TopBraid EDG, there are a few templated rule options, including count: Then You can use it to create the rule and then use the Source Code panel to see RDF e.g.,: sh:values [ sh:count [ sh:path example:myProperty ; ] ; ] ; > On Aug 10, 2021, at 11:19 AM, Joy lix <joylix4112@outlook.com> wrote: > > Dear Holger: > Thank you very much for your reply. > I have implemented the function I need according to the method you said. > The rule is: > if Student's Test score between [90-100] then get a "A" grade, likewise [75-90) --> "B" ; [60-75) -->"C"; [0-60)-->"D". > and I use: > shaclinfer.bat -datafile D:\data-test.ttl -shapesfile D:\shacl-test.ttl>D:\report.txt, the output in report.txt is: > :Test1 :grade "A" . > :Test2 :grade "A" . > :Test3 :grade "A" . > :Test4 :grade "C" . > :Test5 :grade "D" . > Please check if my code can be simplified (see attached file). > Now I want to add a rule that says if count("A") >=3 then Student.rating= "Outstanding", so the SHACL inference engine should output: > :Bob :rating "Outstanding" > But I don't know how to write the count statement in this shacl shape file. > This is an interesting example, I think it should be very helpful for people who learn shacl. > In addition, it would be nice to have a more detailed instance of sh:if in the Test Suite. > Thanks again for your help. > > Kind regards, > Joylix > > > > 发件人: Holger Knublauch <holger@topquadrant.com <mailto:holger@topquadrant.com>> > 发送时间: 2021年8月10日 16:23 > 收件人: public-shacl@w3.org <mailto:public-shacl@w3.org> <public-shacl@w3.org <mailto:public-shacl@w3.org>> > 主题: Re: about SHACL rules engine > > > On 2021-08-10 5:38 pm, Joy lix wrote: >> Hi, there, I'm reading SHACL Advanced Features 1.1 specification, https://w3c.github.io/shacl/shacl-af/#rules-examples <https://w3c.github.io/shacl/shacl-af/#rules-examples> , In 8.1 it mentions: >> >> For the data graph above, a SHACL rules engine will produce the following inferred triples: >> ex:SquareRectangle rdf:type ex:Square . >> >> I ran this example with shacl.org <http://shacl.org/> and https://github.com/TopQuadrant/shacl <https://github.com/TopQuadrant/shacl> , >> but I only get a Validation Report with several results (confirm false), >> would anyone please tell me which SHACL rules engine I can use to get this inferred triples? > See https://github.com/TopQuadrant/shacl/blob/master/src/test/java/org/topbraid/shacl/RuleExample.java <https://github.com/TopQuadrant/shacl/blob/master/src/test/java/org/topbraid/shacl/RuleExample.java> > and the shaclinfer command line tool there https://github.com/TopQuadrant/shacl/tree/master/src/main/command <https://github.com/TopQuadrant/shacl/tree/master/src/main/command> >> Also, does the new version of SHACL specification support RDF-star and SPARQL-star? > The SHACL spec predates RDF-star by several years, so it cannot yet support that. A future version may. > Meanwhile see https://github.com/w3c/rdf-star/issues/122 <https://github.com/w3c/rdf-star/issues/122> > > Holger > >> >> Thanks in advance. >> Joylix > <shacl-test.ttl><data-test.ttl>
Attachments
- text/html attachment: stored
- image/png attachment: PastedGraphic-3.png
- image/png attachment: PastedGraphic-4.png
Received on Tuesday, 10 August 2021 16:11:36 UTC