本文整理汇总了Python中libvocab.Vocab.lookup方法的典型用法代码示例。如果您正苦于以下问题:Python Vocab.lookup方法的具体用法?Python Vocab.lookup怎么用?Python Vocab.lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libvocab.Vocab
的用法示例。
在下文中一共展示了Vocab.lookup方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_label_for_foaf_workplaceHomepage
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import lookup [as 别名]
def test_label_for_foaf_workplaceHomepage(self):
"""check we can get the label for foaf's workplaceHomepage property"""
foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT,uri='http://xmlns.com/foaf/0.1/')
foaf_spec.index()
l = foaf_spec.lookup('http://xmlns.com/foaf/0.1/workplaceHomepage').label
# print "Label for foaf workplaceHomepage is "+l
self.assertEqual(l,"workplace homepage")
示例2: test_label_for_foaf_Person
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import lookup [as 别名]
def test_label_for_foaf_Person(self):
"""check we can get the label for foaf's Person class"""
foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri='http://xmlns.com/foaf/0.1/')
foaf_spec.index()
l = foaf_spec.lookup('http://xmlns.com/foaf/0.1/Person').label
# print "Label for foaf Person is "+l
self.assertEqual(l,"Person")
示例3: test_lookup_Person
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import lookup [as 别名]
def test_lookup_Person(self):
"""find a term given it's uri"""
foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri='http://xmlns.com/foaf/0.1/')
foaf_spec.index()
p = foaf_spec.lookup('http://xmlns.com/foaf/0.1/Person')
# print "lookup for Person: ",p
self.assertNotEqual(p.uri, None, "Couldn't find person class in FOAF")
示例4: test_got_sioc
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import lookup [as 别名]
def test_got_sioc(self):
sioc_spec = Vocab(SIOCSNAPSHOTDIR,SIOCSNAPSHOT, uri = SIOC)
sioc_spec.index()
cr = sioc_spec.lookup('http://rdfs.org/sioc/ns#creator_of')
示例5: test_status_for_doap_Repository
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import lookup [as 别名]
def test_status_for_doap_Repository(self):
"""check we can get the computed 'unknown' status for doap's Repository class"""
doap_spec = Vocab(dir=DOAPSNAPSHOTDIR,f=DOAPSNAPSHOT, uri='http://usefulinc.com/ns/doap#')
doap_spec.index()
s = doap_spec.lookup('http://usefulinc.com/ns/doap#Repository').status
self.assertEqual(s,"unknown", "if vs:term_status isn't used, we set t.status to 'unknown'")
示例6: test_status_for_foaf_Person
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import lookup [as 别名]
def test_status_for_foaf_Person(self):
"""check we can get the status for foaf's Person class"""
foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri='http://xmlns.com/foaf/0.1/')
foaf_spec.index()
s = foaf_spec.lookup('http://xmlns.com/foaf/0.1/Person').status
self.assertEqual(s,"stable")
示例7: test_label_for_sioc_Community
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import lookup [as 别名]
def test_label_for_sioc_Community(self):
"""check we can get the label for sioc's Community class"""
sioc_spec = Vocab(dir=SIOCSNAPSHOTDIR,f=SIOCSNAPSHOT, uri=SIOC)
sioc_spec.index()
l = sioc_spec.lookup(SIOC+'Community').label
self.assertEqual(l,"Community")
示例8: test_lookup_Wombat
# 需要导入模块: from libvocab import Vocab [as 别名]
# 或者: from libvocab.Vocab import lookup [as 别名]
def test_lookup_Wombat(self):
"""fail to a bogus term given it's uri"""
foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri='http://xmlns.com/foaf/0.1/')
foaf_spec.index()
p = foaf_spec.lookup('http://xmlns.com/foaf/0.1/Wombat') # No Wombats in FOAF yet.
self.assertEqual(p, None, "lookup for Wombat should return None")