xmldb (version 1.0, Feb 07 2002)
index
/home/garzogli/tmp/xmldb_client/src/python/xmldb.py

This little python script is a client wrapper for talking to a  Xindice
Server using XMLRPC

 
Modules
            
xmlrpclib

 
Classes
            
XUpdateBuilder
xmldb

 
class XUpdateBuilder
      This utility class builds an XUpdate modification string
 
  
build(self, operation, xpath, elements)
Build a XUpdate modification string
convert_quote(self, s)
Replace " with " for a given string 
 
s = String

 
class xmldb
      This class abstracts a Xindice Client
 
Client that talks to Xindice Server 1.1
 
  
AppendToDocument(self, collection, name, Xpath, appendstring)
 Paeend arbitary xml string to a document
 
collection   - Collection name
Xpath        - XPath to parent tag 
sppendstring - XML String to append
return Update status
CreateCollection(self, collection, name, filer=None)
 Create a Collection
 
collection -  Collection Context
name - Collection Name to be created
filer - Specific filer. Default HashFiler
return collection list
CreateIndexer(self, collection, name, pattern)
 Create a Indexer for a Collection
 
collection -  Collection Name
name - Indexer name to be created
pattern -
Pattern          Description
========         =============
elem             The value of the named element
elem@attr        The value of the attribute for the named element
*                The value of all elements
*@attr           The value of the named attribute for all elements
elem@*           The value of all attributes for the named element
*@*              The value of all attributes for all elements        
return Operation status
GetApiVersion(self)
 Print the API Name and API Version of the software
 
return API Name_Version
GetCollectionCount(self, collection)
  Get the Collection count in a given Collection
 
collection -  Collection Name
return Collection count
GetDocument(self, collection, name)
 Get a  document 
 
collection -  collection 
name - Name (or) Key associated with the document
return Document string
NOW deprecated !!! use GetResource instead
GetDocumentCount(self, collection)
  Get the Document count in a given Collection
 
collection -  Collection Name
return Collection count
GetResource(self, collection, name)
 Get a  document 
 
collection -  collection 
name - Name (or) Key associated with the document
return Document string
GetServerVersion(self)
 Print the Server Version 
 
result = self.xdbServer.run ({"message":"GetServerVersion"})
return Server version
GetUrl(self)
 Retrieves current url of the XML DB server
InsertDocument(self, collection, name, document)
 Insert document in a Collection
 
collection -  Collection 
name - Name (or) Key associated with the document
document - Document String
return Status of the operation
IsCollection(self, collection)
 Returns positive if a collection exist
 
collection - Collection Name
return 1 if collection exist (or) 0 otherwise
IsDocument(self, collection, document)
 Returns positive if a document exist in the collection
 
collection - Collection Name
document - Name of the document
return 1 if document exist (or) 0 otherwise
ListCollections(self, collection)
 List of the Collections
 
collection -  Collection Context
return list of collections
ListDocuments(self, collection)
 List of Documents 
 
collection -  Collection context
return list of Documents
ListIndexers(self, collection)
  List the Indexers in a given Collection
 
collection -  Collection Name
return List of Indexers
Query(self, collection, type, query, name=None, namespaces={})
 Query (or) Update a document (or) collection
 
collection -  Collection
type - XPath (or) XUpdate
query - Query String for XPath type and Modification string for XUpdate
name - Name (or) Key associated with the document; None - if query is for a collection
namespaces - 
return Query result
QueryCollection(self, collection, query)
 Query a collection
 
collection -  Collection name
query - XPath query
return Query result
QueryDocument(self, collection, name, query)
 Query a document
 
collection -  Collection name
name - Name (or) Key associated with the document
query - XPath query
return Query result
RemoveCollection(self, collection, name)
 Delete a Collection
 
collection -  Collection Context
name - Collection Name to be deleted
return Status of operation
RemoveDocument(self, collection, name)
 Delete document in a Collection
 
collection -  Collection 
name - Name (or) Key associated with the document
return Status of the operation
RemoveIndexer(self, collection, name)
 Remove a Indexer for a Collection
 
collection -  Collection Name
name - Indexer name to be deleted
return Operation status
UpdateCollection(self, collection, mod_string)
 Update a collection
 
collection -  Collection name
mod_string - XUpdate Modification String
return Update status
UpdateDocument(self, collection, name, mod_string)
 Update a document
 
collection -  Collection name
name - Name (or) Key associated with the document
mod_string - XUpdate Modification String
return Update status
__init__(self, url=None)
Constructor - Create a Xindice Client
 
url - eg. http://samadams.fnal.gov:9080/Xindice
returns Server instance

 
Data
             __author__ = 'Vijay Murthi <murthi@fnal.gov>'
__date__ = ' Feb 07 2002'
__file__ = './xmldb.pyc'
__name__ = 'xmldb'
__version__ = '1.0'

 
Author
             Vijay Murthi <murthi@fnal.gov>