xsl-list
[Top] [All Lists]

[xsl] XPath related query

2011-01-23 04:55:16
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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