- From: Eric Prud'hommeaux <eric@w3.org>
- Date: Tue, 12 Jun 2007 10:40:05 -0400
- To: Lee Feigenbaum <feigenbl@us.ibm.com>
- Cc: public-rdf-dawg@w3.org
- Message-ID: <20070612144005.GA6160@w3.org>
* Lee Feigenbaum <feigenbl@us.ibm.com> [2007-06-12 03:06-0400]
> ACTION: ericP to walk through one full example of representing an
> algebraic expression using the XPath-based facet stuff
chimezie and i went over this at the end of the telecon. i just
noticed that i had said i'd do this for everyone. i think it's
slightly more useful for the audience if i don't couch it terms of the
folded algebraic expressions but instead a simple "does SPARQL do X?"
question.
Suppose you want to find the tests for { A OPT B OPT C }. Go to
http://www.w3.org/2005/01/yacker/uploads/SPARQL and dream up a query:
SELECT *
WHERE { ?s1 ?p1 ?o1
OPTIONAL { ?s1 ?p1 ?o1 }
OPTIONAL { ?s1 ?p1 ?o1 }
}
stick it in the "Input some text to test" box and submit Submit SUBMIT!!!
http://w3.org/brief/NDY=
A trimmed view of the parse tree (as XML) looks like:
<Query>
<SelectQuery>
<WhereClause>
<GroupGraphPattern>
<TriplesBlock>
</TriplesBlock>
<GraphPatternNotTriples>
<OptionalGraphPattern>
<GroupGraphPattern>
<TriplesBlock>
</TriplesBlock>
</GroupGraphPattern>
</OptionalGraphPattern>
</GraphPatternNotTriples>
<GraphPatternNotTriples>
<OptionalGraphPattern>
<GroupGraphPattern>
<TriplesBlock>
</TriplesBlock>
</GroupGraphPattern>
</OptionalGraphPattern>
</GraphPatternNotTriples>
</GroupGraphPattern>
</WhereClause>
</SelectQuery>
</Query>
http://www.w3.org/2007/06/12-A-OPT-B-OPT-C.xml
The pattern
/Query/SelectQuery/WhereClause/GroupGraphPattern
[TriplesBlock]
[GraphPatternNotTriples[1]/OptionalGraphPattern]
[GraphPatternNotTriples[2]/OptionalGraphPattern]
will detect that pattern.
An XSLT like
http://www.w3.org/2007/06/12-A-OPT-B-OPT-C.xsl
http://www.w3.org/2005/08/online_xslt/xslt?xslfile=++http%3A%2F%2Fwww.w3.org%2F2007%2F06%2F12-A-OPT-B-OPT-C.xsl&xmlfile=++http%3A%2F%2Fwww.w3.org%2F2007%2F06%2F12-A-OPT-B-OPT-C.xml&content-type=&submit=transform
(or, briefly, http://w3.org/brief/NDc= )
shows the match.
--
-eric
office: +1.617.258.5741 NE43-344, MIT, Cambridge, MA 02144 USA
mobile: +1.617.599.3509
(eric@w3.org)
Feel free to forward this message to any list for any purpose other than
email address distribution.
Received on Tuesday, 12 June 2007 14:40:08 UTC