[xsl] XPath related query

Subject: [xsl] XPath related query
From: Vineet Chaoji <vineetc@xxxxxxxxx>
Date: Sun, 23 Jan 2011 16:24:43 +0530
Hello All,

The following sample XML document is generated from an RDF graph:

<DBLP>
<Book rdf:about="Book1">
  <chapter>
    <Chapter rdf:about="Introduction">
       <section>
          <Section rdf:about="Section1">
             <cites rdf:resource="Article2"/>
             <figure>"Example RDF graph"</figure>
          </Section>
       </section>
    </Chapter>
  </chapter>
</Book>

<Article rdf:about="Article2">
  <chapter>
    <Chapter rdf:about="Proof">
       <section>
          <Section rdf:about="Semi-joins">
             <cites rdf:resource="Book3"/>
             <figure>"Example Semi-join"</figure>
          </Section>
       </section>
    </Chapter>
  </chapter>
</Article>
</DBLP>

I am trying to understand if a path query on an RDF graph can be
represented as an XPath query over the corresponding XML structure.

So the query that I am trying to represent is: Is there a Book "Book1"
that has a chapter 'c1' that cites some article 'a' and does this
article 'a' have a chapter 'c2' which has a section 's' which has a
figure 'f' which is called "Example semi-joins". This is a binary
yes/no type of query.
'c1', 'c2', 'a', 's' and 'f' are introduced for the sake of explaining
the query. In the XML above, c1=Introduction, a="Article 2",
c2="Proof", s="Semi-Joins".

Since I am new to XPath, I am finding it hard to express this query.I
am not even sure if this can be expressed in XPath.

I have just broken down a single query to explain my line of thinking.
This is how far I could come:
If X =  //*[@rdf:about='Book1']//Chapter//cites@ref:resource  ---- I
expect this to give me all the ref:resource attribute nodes?
//Article[@ref:about==X]//Chapter//Section//figure[text() == "Example
semi-joins"]  ---- Can I match the attribute nodes above with the
ref:about attribute in Article?

Any ideas how I could do this?

Thanks in anticipation,
Vineet

Current Thread