W3C home > Mailing lists > Public > www-archive@w3.org > September 2001

updated Python RDF query SOAP client (thanks Aaron :)

From: Dan Brickley <danbri@w3.org>
Date: Mon, 3 Sep 2001 15:05:25 -0400 (EDT)
To: <www-archive@w3.org>
Message-ID: <Pine.LNX.4.30.0109031502080.8261-100000@tux.w3.org>

Here's a snapshot of the Python client, fixed up to accept hashtables
serialised as Maps, so it works alongside the Axis/Java stuff now.

The 3rd arg to squish() is a flag to tell the server to use the new form
of serialization. Since all client code (Python/Perl/Java) now understands
this, I'll remove that from server.

Dan

---------- Forwarded message ----------
Date: Mon, 3 Sep 2001 21:08:46 +0100

#!/usr/bin/python
#
# experimental rdf query client in SOAP
#
# By danbri@w3.org with help from Aaron Swartz

import SOAP

query = """SELECT 	?x, ?title, ?a, ?moddate, ?createddate, ?name, ?creatormail
FROM 	http://rdfweb.org/people/danbri/2001/06/dcarch-test/dc3.rdf
WHERE
	(dc::title ?x ?title)
	(dcq::abstract ?x ?a)
	(dcq::modified ?x ?m)
	(dcq::created ?x ?cd)
	(rdf::value ?m ?moddate)
	(rdf::value ?cd ?createddate)
	(dc::creator ?x ?cr)
	(vcard::FN ?cr ?name)
	(vcard::EMAIL ?cr ?creatormail)
USING 	dcq for http://dublincore.org/2000/03/13/dcq#
	rdf for http://www.w3.org/1999/02/22-rdf-syntax-ns#
	vcard for http://www.w3.org/2001/vcard-rdf/3.0#
	dc for http://purl.org/dc/elements/1.1/"""

data = """http://rdfweb.org/people/danbri/2001/06/dcarch-test/dc3.rdf""";

server = SOAP.SOAPProxy("http://fireball.dyndns.org/cgi-bin/soap",
	namespace = "http://rdfweb.org/RDF/RDFWeb/SOAPDemo")

rs = server.squish(query, data, 1)

for row in rs:
  for item in row._aslist:
   print item._aslist[0] + ':' + item._aslist[1]

# see also:
#  SOAP.py from http://sourceforge.net/projects/pywebsvcs/
#  Article at http://www.onlamp.com/pub/a/python/2001/06/14/pysoap.html
#
# related hacks:
# sean's python stuff
# http://infomesh.net/2001/swipt/
Received on Monday, 3 September 2001 15:05:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 November 2012 14:17:14 GMT