Ejemplo n.º 1
0
    def __new__(cls, value=None, # only store implementations should pass in a value
                _sn_gen=_serial_number_generator(), _prefix=_unique_id()):
        if value==None:
            # so that BNode values do not
            # collide with ones created with a different instance of this module
            # at some other time.
            bNodeLock.acquire()
            node_id = _sn_gen.next()
            bNodeLock.release()
            value = "%s%s" % (_prefix, node_id)
        else:
            # TODO: check that value falls within acceptable bnode value range
            # for RDF/XML needs to be something that can be serialzed as a nodeID
            # for N3 ??
            # Unless we require these constraints be enforced elsewhere?
            pass #assert is_ncname(unicode(value)), "BNode identifiers must be valid NCNames"

        return Identifier.__new__(cls, value)
Ejemplo n.º 2
0
    def __new__(
        cls,
        value=None,  # only store implementations should pass in a value
        _sn_gen=_serial_number_generator(),
        _prefix=_unique_id()):
        if value == None:
            # so that BNode values do not
            # collide with ones created with a different instance of this module
            # at some other time.
            bNodeLock.acquire()
            node_id = _sn_gen.next()
            bNodeLock.release()
            value = "%s%s" % (_prefix, node_id)
        else:
            # TODO: check that value falls within acceptable bnode value range
            # for RDF/XML needs to be something that can be serialzed as a nodeID
            # for N3 ??
            # Unless we require these constraints be enforced elsewhere?
            pass  #assert is_ncname(unicode(value)), "BNode identifiers must be valid NCNames"

        return Identifier.__new__(cls, value)
Ejemplo n.º 3
0
 def __new__(cls, value=None):
     if value==None:
         global node_id
         node_id += 1
         value = "_:%s%s" % (prefix, node_id)
     return Identifier.__new__(cls, value)
Ejemplo n.º 4
0
 def __new__(cls, value):
     return Identifier.__new__(cls, value)
Ejemplo n.º 5
0
 def __new__(cls, value):
     return Identifier.__new__(cls, value)
Ejemplo n.º 6
0
 def __new__(cls, value, lang='', datatype=''):
     value = unicode(value)        
     return Identifier.__new__(cls, value)        
Ejemplo n.º 7
0
 def __new__(cls, value, lang='', datatype=''):
     value = unicode(value)
     return Identifier.__new__(cls, value)
Ejemplo n.º 8
0
 def __new__(cls, value=None):
     if value == None:
         global node_id
         node_id += 1
         value = "_:%s%s" % (prefix, node_id)
     return Identifier.__new__(cls, value)