today | current | recent | random ... categories | search ... who ... syndication

The so-called “w5” config file

<!-- my kingdom for the necessary fu to make
     rdflib read N3 files... -->

<rdf:RDF 
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns="x-urn:asc:w5#">

 <service rdf:about="http://www.foobar.com/xml/">
  <protocol rdf:resource = "http://xmlrpc.com/" />
  <login>hello word</login>
  <filter><![CDATA[ ... ]]></filter>
  <dc:title>Foo Bar Pictures</dc:title>
 </service>
 
 <service rdf:about="http://www.barfoo.net/xml/">
  <protocol rdf:resource = "http://xmlrpc.com/" />
 </service>
 
 <protocol rdf:about="http://xmlrpc.com/">
  <dc:title>XML-RPC</dc:title>
 </protocol>

</rdf:RDF>

And then...

#!/usr/local/bin/python

from rdflib.Namespace import Namespace
from random           import choice
from xmlrpclib        import Server
from rConfig          import rConfig

w5 = Namespace("x-urn:asc:w5#")
      
cfg = rConfig()
cfg.Load("/path/to/config.xml")

# insert idle speculation about the ability
# to overload an object's stringify method
# in python...
      
service = choice(cfg.ListServices(["http://www.xmlrpc.com/"]))
attrs   = cfg.DescribeService(service)
      
# this actually yields empty values but
# you get the idea — insert hand-waving
# about potentially non-existent keys here.
# maybe add some kind of helper method...
      
args = {"login"  : attrs[ w5["login"] ],
        "filter" : attrs[ w5["filter"] ]}

server   = Server(service)
response = server.w5.RandomImage(args)

Please remember that this is still a (slow) moving target.

refers to

meta

[x]

permalink

http://www.aaronland.info/weblog/2004/04/17/5449

pubdate

http://www.aaronland.info/weblog/2004/04/17

created

2004-04-17T13:27:25-04:00

last modified

2004-04-18T13:14:28-04:00

revision

1.9

changes

http://www.aaronland.info/weblog/2004/04/17/5449/changes.html

license

http://creativecommons.org/licenses/by-nd-nc/1.0/

external links

[x]
 
The so-called “w5” application ←  → “RecipeRPC is a protocol for supplying recipes to clients over a network”