W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > April to June 2005

Re: toward HTTP traces for SPARQL (fromUnionQuery, CONSTRUCT)

From: Dan Connolly <connolly@w3.org>
Date: Thu, 05 May 2005 17:27:16 -0500
To: RDF Data Access Working Group <public-rdf-dawg@w3.org>
Message-Id: <1115332036.28180.213.camel@localhost>

On Tue, 2005-05-03 at 16:09 -0500, Dan Connolly wrote:
> Summary: I can make traces of the protocols implemented
> by Dave and Andy's DawgShows, but not the protocol
> in the editor's WD, yet.

I think I got a CONSTRUCT trace that matches 1.35 of
 http://www.w3.org/2001/sw/DataAccess/proto-wd/

But after looking at that design and the
"here's mine in a screenful..."
http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0054.html

I prefer &data=... to &default-graph-uri=...

Hmm.... the 0054 design doesn't have a param for named/labelled
graphs, though. I'll have to think it over again once I
get that part going.

My trace is based on this query:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc:      <http://purl.org/dc/elements/1.1/>
construct {_:somebody foaf:name ?who; foaf:made ?book}
WHERE { ?book dc:creator ?who }

and the data in http://sparql.net/books


Client to server:

GET http://127.0.0.1:9001/sq?query=PREFIX+foaf%3A+%3Chttp%3A%2F%
2Fxmlns.com%2Ffoaf%2F0.1%2F%3E+PREFIX+dc%3A++++++%3Chttp%3A%2F%
2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E+construct+%7B_%3Asomebody+foaf%
3Aname+%3Fwho%3B+foaf%3Amade+%3Fbook%7D++WHERE+%7B+%3Fbook+dc%3Acreator
+%3Fwho+%7D&default-graph-uri=http%3A%2F%2Fsparql.net%2Fbooks HTTP/1.0
Host: 127.0.0.1:9001
User-agent: Python-urllib/2.1
Accept: application/rdf+xml

And the reply:

HTTP/1.0 200 result graph follows
Server: BaseHTTP/0.3 Python/2.3.5
Date: Thu, 05 May 2005 22:08:28 GMT
Content-type: application/rdf+xml




<rdf:RDF xmlns="http://xmlns.com/foaf/0.1/"
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

    <rdf:Description>
        <made rdf:resource="http://example.org/book/book2"/>
        <name rdf:nodeID="b1"/>
    </rdf:Description>

    <rdf:Description>
        <made rdf:resource="http://example.org/book/book1"/>
        <name>J.K. Rowling</name>
    </rdf:Description>

    <rdf:Description>
        <made rdf:resource="http://example.org/book/book3"/>
        <name rdf:nodeID="b1"/>
    </rdf:Description>
</rdf:RDF>
[00:00.545 - server closed]




For folks that want to play along at home, first start
TCPWatch going on port 9000 (it's been running for so long that
I forgot how, but the source etc. is
http://hathawaymix.org/Software/TCPWatch )

Then I have a toy server based on the swap code and N3QL...
 http://www.w3.org/2000/10/swap/dbork/sparqltoy.py
 v 1.6 2005/05/05 22:08:07

which I start thusly:

WWW/2000/10/swap/dbork$ PYTHONPATH=../.. python sparqltoy.py 9001 &
$Id: sparqltoy.py,v 1.6 2005/05/05 22:08:07 connolly Exp $
serving on port 9001 ...


and I have a little client...

  http://www.w3.org/2001/sw/DataAccess/proto-wd/sparcli.py
  v 1.4 2005/05/05 22:03:22

which I run thusly...

WWW/2000/10/swap/dbork$ HTTP_PROXY=http://127.0.0.1:9000 python
~/w3ccvs/WWW/2001/sw/DataAccess/proto-wd/sparcli.py  --local

And I get a bunch of diagnostics and stuff...

service: http://127.0.0.1:9001/sq?
construct...
@@getRDF http://127.0.0.1:9001/sq?query=PREFIX+foaf%3A+%3Chttp%3A%2F%
2Fxmlns.com%2Ffoaf%2F0.1%2F%3E+PREFIX+dc%3A++++++%3Chttp%3A%2F%
2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E+construct+%7B_%3Asomebody+foaf%
3Aname+%3Fwho%3B+foaf%3Amade+%3Fbook%7D++WHERE+%7B+%3Fbook+dc%3Acreator
+%3Fwho+%7D&default-graph-uri=http%3A%2F%2Fsparql.net%2Fbooks
@@got query: PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc:
<http://purl.org/dc/elements/1.1/> construct {_:somebody foaf:name ?who;
foaf:made ?book}  WHERE { ?book dc:creator ?who }
@@loaded http://sparql.net/books ; size= 12
@@query:      @prefix : <file:/#> .
     @prefix ql: <http://www.w3.org/2004/ql#> .

     @forAll :book,
                :who .
      [      ql:select {
              [      <http://xmlns.com/foaf/0.1/made> :book;
                     <http://xmlns.com/foaf/0.1/name> :who ].
            };
             ql:where {:book
<http://purl.org/dc/elements/1.1/creator> :who .
            } ].


dirk.dm93.org - - [05/May/2005 17:08:28] "GET /sq?query=PREFIX+foaf%3A+%
3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E+PREFIX+dc%3A++++++%3Chttp%3A
%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E+construct+%7B_%3Asomebody
+foaf%3Aname+%3Fwho%3B+foaf%3Amade+%3Fbook%7D++WHERE+%7B+%3Fbook+dc%
3Acreator+%3Fwho+%7D&default-graph-uri=http%3A%2F%2Fsparql.net%2Fbooks
HTTP/1.0" 200 -



<rdf:RDF xmlns="http://xmlns.com/foaf/0.1/"
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

    <rdf:Description>
        <made rdf:resource="http://example.org/book/book2"/>
        <name rdf:nodeID="b1"/>
    </rdf:Description>

    <rdf:Description>
        <made rdf:resource="http://example.org/book/book1"/>
        <name>J.K. Rowling</name>
    </rdf:Description>

    <rdf:Description>
        <made rdf:resource="http://example.org/book/book3"/>
        <name rdf:nodeID="b1"/>
    </rdf:Description>
</rdf:RDF>



Ask should be easy; I think I'll do that next.

Select isn't as straightforward, given my codebase. I'm not sure
where the variable binding API is in swap/llyn, so I'll have to
effectively do a stylized construct and use graph-tweezers
to get the variable bindings back.


-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E
Received on Thursday, 5 May 2005 22:27:22 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:23 GMT