You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mrql.apache.org by Eldon Carman <ec...@ucr.edu> on 2014/06/13 01:40:49 UTC
XPath with Multiple Predicates
I have a XML data source that I could filter with two XPath
predicates. Does MRQL support this type of XPath expression?
For example: [f='foo' and b='bar']
Re: XPath with Multiple Predicates
Posted by Leonidas Fegaras <fe...@cse.uta.edu>.
Hi Eldon,
MRQL doesn't contain XPath. It can simulate XML paths but the rest are
done using select queries.
From http://wiki.apache.org/mrql/LanguageDescription:
MRQL also provides syntax to navigate through XML data. The projection
operation e.A has been overloaded to work on XML data. Given an
expression e of type XML or list(XML), e.A returns a list(XML) that
contains the subelements of e with tagname A (much like e/A in XPath).
Similarly, the syntax e.*, e.@A, and e.@* correspond to the XPaths e/*,
e/@A, and e/@*, respectively.
You can simulate XPath predicates using predicates in select queries:
select text(a.title)
from a in source(xml,"dblp.xml",{"incollection"})
where text(a.author) = "Daniel Brandon" and text(a.year) = "2005";
which is equivalent to the XPath:
//incollection[author = "Daniel Brandon" and year = "2005"]/title
Leonidas
On 06/13/2014 02:40 AM, Eldon Carman wrote:
> I have a XML data source that I could filter with two XPath
> predicates. Does MRQL support this type of XPath expression?
>
> For example: [f='foo' and b='bar']