XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Generating New Knowledge by Deductive Reasoning usingSchematron

 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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS