[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Generating New Knowledge by Deductive Reasoning usingSchem

  • From: rjelliffe <rjelliffe@allette.com.au>
  • To: <stephengreenubl@gmail.com>
  • Date: Tue, 23 Nov 2010 23:50:33 +1100

Re:  Generating New Knowledge by Deductive Reasoning usingSchem
 On Mon, 22 Nov 2010 12:34:41 +0000, Stephen Green 
 <stephengreenubl@gmail.com> wrote:
> I tried SVRL where I had the Schematron schema output escaped XML
> (conforming to the Robber.xml markup in Roger's example but escaped)
> in the 'text' of the report.

 There is now a more direct method to help exactly this kind of use: 
 properties.


 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"
 xmlns:xs="http://www.w3.org/2001/XMLSchema" queryBinding="xslt2">
 	<sch:pattern id="Check-Speeder-For-Relationship-To-Recent-Events">
 		<sch:rule context="driversLicenseNumber">
 			<sch:let name="speeder-driversLicenseNumber" value="."/>
 			<sch:let name="GunLicense"
                                    value="for $i in
 collection('GunLicenseFolder?select=*.xml;recurse=yes;on-error=ignore')
     return
 $i/GunLicense[.//Person/driversLicenseNumber eq
 $speeder-driversLicenseNumber]"/>

 	<sch:report test="($speeder-driversLicenseNumber eq
 $GunLicense//Person/driversLicenseNumber) and
             ($GunLicense/registeredGun/Gun/serial eq
 doc('Robbery.xml')/RobberyEvent/evidence/Gun/serial) and
             (count($GunLicense) eq 1) and
             (count($GunLicense//Person) eq 1)"
             properties="robber-details">
        A person is a robber if the drivers license and gun license 
 match, or something.
        </sch:report>
 </sch:rule>
 </sch:pattern>



 <sch:properties>
   <sch:property id="robber-details">
        <RobberyEvent>
            <datetime><sch:value-of
 select="doc('Robbery.xml')/RobberyEvent/datetime"/></datetime>
            <description><sch:value-of
 select="doc('Robbery.xml')/RobberyEvent/description"/></description>
            <evidence>
            <Gun>
            <serial><sch:value-of
 select="doc('Robbery.xml')/RobberyEvent/evidence/Gun/serial"/></serial>
            </Gun>
            </evidence>
            <robber>
            <Person> <sch:value-of
 select="parent::Person/child::name"/> </Person>
            </robber>
        </RobberyEvent>
   </sch:property>

 </sch:properties>
 </sch:schema>


 The properties declaration can be used by multiple reports if 
 necessary, and a report
 can have multiple properties. This allows PSVI-style annotations and 
 dynamic info but also keeps the
 structured information from "polluting" the natural language statements 
 in the reports
 or assertions. The natural language statements are from the POV of the 
 problem stater,
 the <diagnostics> are from the POV of a user, and the <properties> are 
 from the POV
 of the program consuming the Schematron output.

 What would be cool would be if XSLT2's XPath had functions to test 
 whether a variable had been declared or not:
   if variable-exists( evil-genius ) then  $evil-genius/name

 Cheers
 Rick Jelliffe



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.