当前位置: 首页>>代码示例>>Python>>正文


Python URIRef.startswith方法代码示例

本文整理汇总了Python中rdflib.URIRef.startswith方法的典型用法代码示例。如果您正苦于以下问题:Python URIRef.startswith方法的具体用法?Python URIRef.startswith怎么用?Python URIRef.startswith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rdflib.URIRef的用法示例。


在下文中一共展示了URIRef.startswith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: relativize

# 需要导入模块: from rdflib import URIRef [as 别名]
# 或者: from rdflib.URIRef import startswith [as 别名]
 def relativize(self, uri):
     base = URIRef(self.base)
     basedir = URIRef(self.base if base.endswith('/') else base.rsplit('/', 1)[0])
     if base is not None:
         if uri == base:
             uri = URIRef('')
         elif uri == basedir:
             uri = URIRef('.')
         elif uri.startswith(basedir + '/'):
             uri = URIRef(uri.replace(basedir + '/', "", 1))
     return uri
开发者ID:bodleian,项目名称:datafinder,代码行数:13,代码来源:serializers.py

示例2: convert

# 需要导入模块: from rdflib import URIRef [as 别名]
# 或者: from rdflib.URIRef import startswith [as 别名]
 def convert(self, name, qname, attrs):
     if name[0] is None:
         name = URIRef(name[1])
     else:
         name = URIRef("".join(name))
     atts = {}
     for (n, v) in attrs.items(): #attrs._attrs.iteritems(): #
         if n[0] is None:
             att = URIRef(n[1])
         else:
             att = URIRef("".join(n))
         if att.startswith(XMLNS) or att[0:3].lower()=="xml":
             pass
         elif att in UNQUALIFIED:
             #if not RDFNS[att] in atts:
             atts[RDFNS[att]] = v
         else:
             atts[URIRef(att)] = v
     return name, atts
开发者ID:AuroraSkywalker,项目名称:watchdog,代码行数:21,代码来源:RDFXMLHandler.py

示例3: fixit

# 需要导入模块: from rdflib import URIRef [as 别名]
# 或者: from rdflib.URIRef import startswith [as 别名]
 def fixit(current_object):
     """
     Read the def data structure and replace all string URIs with URIRef entities
     :param current_object: the piece of the data structure to be fixed
     :return current_object: the piece repaired in place
     """
     from rdflib import URIRef
     if isinstance(current_object, dict):
         for k in current_object.keys():
             current_object[k] = fixit(current_object[k])
     elif isinstance(current_object, list):
         for i in range(0, len(current_object)):
             current_object[i] = fixit(current_object[i])
     elif isinstance(current_object, basestring):
         if current_object.startswith("http://"):
             current_object = URIRef(current_object)
         elif current_object.startswith("xsd:"):
             current_object = cast_to_rdflib(current_object)
     return current_object
开发者ID:senrabc,项目名称:vivo-pump,代码行数:21,代码来源:vivopump.py

示例4: fixit

# 需要导入模块: from rdflib import URIRef [as 别名]
# 或者: from rdflib.URIRef import startswith [as 别名]
 def fixit(current_object, prefix_dictionary):
     """
     Read the def data structure and replace all string URIs with URIRef entities
     :param current_object: the piece of the data structure to be fixed
     :return current_object: the piece repaired in place
     """
     from rdflib import URIRef
     if isinstance(current_object, dict):
         for k in current_object.keys():
             current_object[k] = fixit(current_object[k], prefix_dictionary)
     elif isinstance(current_object, list):
         for i in range(0, len(current_object)):
             current_object[i] = fixit(current_object[i], prefix_dictionary)
     elif isinstance(current_object, basestring):
         if current_object.startswith("http://"):
             current_object = URIRef(current_object)
         elif current_object.startswith("xsd:"):
             current_object = cast_to_rdflib(current_object)
         elif ':' in current_object:
             k = current_object.find(':')
             tag = str(current_object[0:k + 1])
             if tag in prefix_dictionary:
                 current_object = URIRef(str(current_object).replace(tag, prefix_dictionary[tag]))
     return current_object
开发者ID:ctsit,项目名称:vivo-pump,代码行数:26,代码来源:vivopump.py


注:本文中的rdflib.URIRef.startswith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。