예제 #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)
예제 #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)
예제 #3
0
파일: BNode.py 프로젝트: 200895045/NewsBlur
 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)
예제 #4
0
 def __new__(cls, value):
     return Identifier.__new__(cls, value)
예제 #5
0
 def __new__(cls, value):
     return Identifier.__new__(cls, value)
예제 #6
0
 def __new__(cls, value, lang='', datatype=''):
     value = unicode(value)        
     return Identifier.__new__(cls, value)        
예제 #7
0
 def __new__(cls, value, lang='', datatype=''):
     value = unicode(value)
     return Identifier.__new__(cls, value)
예제 #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)