本文整理汇总了Python中extractor.Extractor.terms方法的典型用法代码示例。如果您正苦于以下问题:Python Extractor.terms方法的具体用法?Python Extractor.terms怎么用?Python Extractor.terms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类extractor.Extractor
的用法示例。
在下文中一共展示了Extractor.terms方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from extractor import Extractor [as 别名]
# 或者: from extractor.Extractor import terms [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 terms [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