sample SOAP RDF query client in Python

Dan Brickley daniel.brickley at b...
Wed Aug 8 20:45:23 UTC 2001


A quick demo of rdfquery over soap, this time in Python (see #rdfig logs
for Perl, Java-in-progress).

thanks to Aaron for help with the Python learning curve :)

Inspired by http://www.onlamp.com/pub/a/python/2001/06/14/pysoap.html
I tried the SOAP.py library. Below is a sample script that talks to my
experimental rdf query SOAP service.

Dan

---------- Forwarded message ----------
Date: Wed, 8 Aug 2001 22:45:00 +0100
To: danbri at r...

#!/usr/bin/python
#
# experimental rdf query client in SOAP
#
# By danbri at w... 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)

# print "result set is ", rs

for row in rs:
for item in row._asdict.items():
print item[0] + ':' + item[1]

# TODO: need to look into how we want the server
# to serialise hashes, and how SOAP.py deals with these, compared to java
# and perl implementations
#
# 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/





More information about the foaf-dev mailing list