本文整理匯總了Python中extractor.Extractor.getBnodes方法的典型用法代碼示例。如果您正苦於以下問題:Python Extractor.getBnodes方法的具體用法?Python Extractor.getBnodes怎麽用?Python Extractor.getBnodes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類extractor.Extractor
的用法示例。
在下文中一共展示了Extractor.getBnodes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test
# 需要導入模塊: from extractor import Extractor [as 別名]
# 或者: from extractor.Extractor import getBnodes [as 別名]
def test():
g = Graph()
#g.parse("MAD_D.rdf", format="xml")
f = open("./testsuite/test_fixtures/MAD_D.rdf", 'rb')
st = f.read().decode('utf-8')
print type(st)
g.parse(StringIO.StringIO(st.encode('utf-8')), format="xml")
ext = Extractor(g)
uris = ext.getUris()
print ext.terms()
ext.getBnodes()
示例2: ext_result
# 需要導入模塊: from extractor import Extractor [as 別名]
# 或者: from extractor.Extractor import getBnodes [as 別名]
def ext_result():
rdfUrl = ''
if request.method == 'POST':
rdfUrl = request.form['url']
try:
r = requests.get(rdfUrl)
#rdfUrl = str(r.status_code)
g = Graph()
#g.parse("MAD.rdf", format="xml")
g.load(rdfUrl)
ext = Extractor(g)
uris = ext.getUris()
terms = ext.terms()
result = {}
result['uris'] = uris
result['terms'] = terms
result['bNodes'] =str(len(ext.getBnodes()))
result['uNodes'] = str(len(uris))
return render_template('index.html', result= result)
except requests.exceptions.ConnectionError:
X2Rwarning = 'X2R Warning: The requested URL raises ConnectionError~!!!'
return X2Rwarning