當前位置: 首頁>>代碼示例>>Python>>正文


Python URIRef.find方法代碼示例

本文整理匯總了Python中rdflib.URIRef.find方法的典型用法代碼示例。如果您正苦於以下問題:Python URIRef.find方法的具體用法?Python URIRef.find怎麽用?Python URIRef.find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rdflib.URIRef的用法示例。


在下文中一共展示了URIRef.find方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: fixit

# 需要導入模塊: from rdflib import URIRef [as 別名]
# 或者: from rdflib.URIRef import find [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.find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。