You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by bu...@apache.org on 2004/09/03 14:16:16 UTC

DO NOT REPLY [Bug 31037] New: - [Patch] for RDBMSExpressionFactory

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31037>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31037

[Patch] for RDBMSExpressionFactory

           Summary: [Patch] for RDBMSExpressionFactory
           Product: Slide
           Version: 2.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Search
        AssignedTo: slide-dev@jakarta.apache.org
        ReportedBy: gcasper@s-und-n.de


Using RDBMSexpressionFactory there is a problem with "ored" expressions.
For example:

<D:searchrequest xmlns:D="DAV:">
  <D:basicsearch>
    <D:select>
      <D:allprop />
    </D:select>
    <D:from>
      <D:scope>
        <D:href>/slide/files/repo/staging/documents</D:href>
        <D:depth>infinity</D:depth>
      </D:scope>
    </D:from>
    <D:where>
      <D:or>
        <D:eq> 
          <D:prop><D:prop1/></D:prop>
          <D:literal>value1</D:literal>
        </D:eq>
        <D:eq> 
          <D:prop><D:prop2/></D:prop>
          <D:literal>value2</D:literal>
        </D:eq>
      <D:or>
    </D:where>
  </D:basicsearch>
</D:searchrequest>

results in the following SQL query:

select u.URI_STRING, o.CLASS_NAME from
(((OBJECT o inner join URI u on u.URI_ID = o.URI_ID)
inner join VERSION_HISTORY vh on vh.URI_ID = u.URI_ID)
nner join PROPERTIES p0 on p0.VERSION_ID = vh.VERSION_ID)
where
(u.URI_STRING = '/files/repo/staging/documents' OR u.URI_STRING 
LIKE '/files/repo/staging/documents/%')
AND
(p0.PROPERTY_NAME = 'state' AND p0.PROPERTY_NAMESPACE = 'http://s-und-
n.de/sundance/props/1.0' AND p0.PROPERTY_VALUE = 'tobeprocessed')
or
(p0.PROPERTY_NAME = 'doctype-url' AND p0.PROPERTY_NAMESPACE = 'http://s-und-
n.de/sundance/props/1.0' AND p0.PROPERTY_VALUE = 'article')

which gives the wrong result (at least with a MySQL datebase). Since AND has a 
higher priority than OR, the scoping criteria is "anded" with the first 
selection criteria and the result is "ored" with the second selection criteria.

The SQL query should rather be

select u.URI_STRING, o.CLASS_NAME from
(((OBJECT o inner join URI u on u.URI_ID = o.URI_ID)
inner join VERSION_HISTORY vh on vh.URI_ID = u.URI_ID)
nner join PROPERTIES p0 on p0.VERSION_ID = vh.VERSION_ID)
where
(u.URI_STRING = '/files/repo/staging/documents' OR u.URI_STRING 
LIKE '/files/repo/staging/documents/%')
AND
(
(p0.PROPERTY_NAME = 'state' AND p0.PROPERTY_NAMESPACE = 'http://s-und-
n.de/sundance/props/1.0' AND p0.PROPERTY_VALUE = 'tobeprocessed')
or
(p0.PROPERTY_NAME = 'doctype-url' AND p0.PROPERTY_NAMESPACE = 'http://s-und-
n.de/sundance/props/1.0' AND p0.PROPERTY_VALUE = 'article')
)

which the attached patch produces.

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: DO NOT REPLY [Bug 31037] New: - [Patch] for RDBMSExpressionFactory

Posted by Guido Casper <gc...@s-und-n.de>.
bugzilla@apache.org wrote:
> DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
> RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
> <http://issues.apache.org/bugzilla/show_bug.cgi?id=31037>.
> ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
> INSERTED IN THE BUG DATABASE.
> 
> http://issues.apache.org/bugzilla/show_bug.cgi?id=31037
> 
> [Patch] for RDBMSExpressionFactory
> 
>            Summary: [Patch] for RDBMSExpressionFactory
>            Product: Slide
>            Version: 2.1
>           Platform: Other
>         OS/Version: Other
>             Status: NEW
>           Severity: Normal
>           Priority: Other
>          Component: Search
>         AssignedTo: slide-dev@jakarta.apache.org
>         ReportedBy: gcasper@s-und-n.de
> 
> 
> Using RDBMSexpressionFactory there is a problem with "ored" expressions.
> For example:
> 
> <D:searchrequest xmlns:D="DAV:">
>   <D:basicsearch>
>     <D:select>
>       <D:allprop />
>     </D:select>
>     <D:from>
>       <D:scope>
>         <D:href>/slide/files/repo/staging/documents</D:href>
>         <D:depth>infinity</D:depth>
>       </D:scope>
>     </D:from>
>     <D:where>
>       <D:or>
>         <D:eq> 
>           <D:prop><D:prop1/></D:prop>
>           <D:literal>value1</D:literal>
>         </D:eq>
>         <D:eq> 
>           <D:prop><D:prop2/></D:prop>
>           <D:literal>value2</D:literal>
>         </D:eq>
>       <D:or>
>     </D:where>
>   </D:basicsearch>
> </D:searchrequest>
> 
> results in the following SQL query:
> 
> select u.URI_STRING, o.CLASS_NAME from
> (((OBJECT o inner join URI u on u.URI_ID = o.URI_ID)
> inner join VERSION_HISTORY vh on vh.URI_ID = u.URI_ID)
> nner join PROPERTIES p0 on p0.VERSION_ID = vh.VERSION_ID)
> where
> (u.URI_STRING = '/files/repo/staging/documents' OR u.URI_STRING 
> LIKE '/files/repo/staging/documents/%')
> AND
> (p0.PROPERTY_NAME = 'state' AND p0.PROPERTY_NAMESPACE = 'http://s-und-
> n.de/sundance/props/1.0' AND p0.PROPERTY_VALUE = 'tobeprocessed')
> or
> (p0.PROPERTY_NAME = 'doctype-url' AND p0.PROPERTY_NAMESPACE = 'http://s-und-
> n.de/sundance/props/1.0' AND p0.PROPERTY_VALUE = 'article')

Of course that should be:

AND
(p0.PROPERTY_NAME = 'prop1' AND p0.PROPERTY_NAMESPACE = 'DAV:' AND 
p0.PROPERTY_VALUE = 'value1')
or
(p0.PROPERTY_NAME = 'prop2' AND p0.PROPERTY_NAMESPACE = 'DAV:' AND 
p0.PROPERTY_VALUE = 'value2')

:-)

Guido

> 
> which gives the wrong result (at least with a MySQL datebase). Since AND has a 
> higher priority than OR, the scoping criteria is "anded" with the first 
> selection criteria and the result is "ored" with the second selection criteria.
> 
> The SQL query should rather be
> 
> select u.URI_STRING, o.CLASS_NAME from
> (((OBJECT o inner join URI u on u.URI_ID = o.URI_ID)
> inner join VERSION_HISTORY vh on vh.URI_ID = u.URI_ID)
> nner join PROPERTIES p0 on p0.VERSION_ID = vh.VERSION_ID)
> where
> (u.URI_STRING = '/files/repo/staging/documents' OR u.URI_STRING 
> LIKE '/files/repo/staging/documents/%')
> AND
> (
> (p0.PROPERTY_NAME = 'state' AND p0.PROPERTY_NAMESPACE = 'http://s-und-
> n.de/sundance/props/1.0' AND p0.PROPERTY_VALUE = 'tobeprocessed')
> or
> (p0.PROPERTY_NAME = 'doctype-url' AND p0.PROPERTY_NAMESPACE = 'http://s-und-
> n.de/sundance/props/1.0' AND p0.PROPERTY_VALUE = 'article')
> )
> 
> which the attached patch produces.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-dev-help@jakarta.apache.org
> 
> 


-- 
Guido Casper
-------------------------------------------------
S&N AG              Tel.: 05251/1581-87
netBank solutions   Fax : 05251/1581-71
Klingenderstr. 5    <ma...@s-und-n.de>
D-33100 Paderborn   http://www.s-und-n.de
-------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org