コード例 #1
0
ファイル: BNode.py プロジェクト: KiranAjayakumar/python-dlp
    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
ファイル: Variable.py プロジェクト: AuroraSkywalker/watchdog
 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
ファイル: BNode.py プロジェクト: pointyael/random-news-reader
 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)