xsl-list
[Top] [All Lists]

Re: [xsl] Compare logical expressions with XPath/XSLT

2019-03-07 10:11:12
I'm a bit confused by the sentence

{ A OR C } is not a subset of { (!A OR !B) AND !C }

because intuitively these expressions are boolean predicates, not sets. Perhaps 
I should be reading "X is not a subset of Y" as "Y implies not X"?

Is this the same as (or closely related to) the boolean satisfiability problem 
https://en.wikipedia.org/wiki/Boolean_satisfiability_problem ?

Would it be a good idea to focus on finding an algorithm first, and then 
thinking about how to code it in XPath?

Michael Kay
Saxonica

On 7 Mar 2019, at 15:53, Michael Müller-Hillebrand mmh(_at_)docufy(_dot_)de 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Hi, 

I have a problem at hand that (I think) I understood on the whiteboard, but 
have no initial idea how to best tackle this using our beloved tools 
(currently limited to XSLT/XPath 2).

We have larger objects (documents) and many child objects (chapters), and 
both can have a property, let's call it "Project Name". The task is to find 
conflicts between the document's and the chapter's project setting. Behind 
each project name there is a configurable boolean expression using AND, OR 
and NOT, which defines whether two projects may match or not.

The definition of project names looks like this (with required="false" 
describing the NOT logic):

<defs>
 <def name="project-1">
   <set>
     <AND>
       <OR>
         <item required="false">A</item>
         <item required="false">B</item>
       </OR>
       <item required="false">C</item>
     </AND>
   </set>
 </def>
 <def name="project-2">
   <set>
     <OR>
       <item required="true">A</item>
       <item required="true">C</item>
     </OR>
   </set>
 </def>
 <def name="project-3">
   <set>
     <item required="false">C</item>
   </set>
 </def>
</defs>

If the document uses "project-1", a chapter with "project-2" would be in 
conflict with project-1, because { A OR C } is not a subset of { (!A OR !B) 
AND !C }.

A chapter with "project-3" would be okay, because { !C } is a subset of { (!A 
OR !B) AND !C }.

I simply hope for some pointers to similar problems.

Thanks a lot for your time,

- Michael Müller-Hillebrand

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>