home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / python-support / python-rdflib / rdflib / sparql / Unbound.py < prev   
Encoding:
Python Source  |  2007-04-04  |  746 b   |  25 lines

  1. from rdflib.sparql import _questChar
  2.  
  3.  
  4. class Unbound :
  5.     """A class to encapsulate a query variable. This class should be used in conjunction with L{BasicGraphPattern<graphPattern.BasicGraphPattern>}."""
  6.     def __init__(self,name) :
  7.         """
  8.         @param name: the name of the variable (without the '?' character)
  9.         @type name: unicode or string
  10.         """
  11.         if isinstance(name,basestring) :
  12.             self.name     = _questChar + name
  13.             self.origName = name
  14.         else :
  15.             raise SPARQLError("illegal argument, variable name must be a string or unicode")
  16.  
  17.     def __repr__(self) :
  18.         retval  = "?%s" % self.origName
  19.         return retval
  20.  
  21.     def __str__(self) :
  22.         return self.__repr__()
  23.  
  24.  
  25.