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


Python libvocab.Vocab类代码示例

本文整理汇总了Python中libvocab.Vocab的典型用法代码示例。如果您正苦于以下问题:Python Vocab类的具体用法?Python Vocab怎么用?Python Vocab使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testHTMLazlistExists

  def testHTMLazlistExists(self):
    """Check we have some kind of azlist. Note that this shouldn't really be HTML from Vocab API ultimately."""
    foaf_spec = Vocab(FOAFSNAPSHOTDIR, FOAFSNAPSHOT, uri = FOAF)
    foaf_spec.index()
    az = foaf_spec.azlist()   
#    print "AZ list is ", az
    self.assertNotEqual (az != None, "We should have an azlist.")
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例2: testCanUseNonStrURI

 def testCanUseNonStrURI(self):
   """If some fancy object used with a string-oriented setter, we just take the string."""
   doap_spec = Vocab('examples/doap/','doap-en.rdf')
   print "[1]"
   doap_spec.index()
   doap_spec.uri = Namespace('http://usefulinc.com/ns/doap#')  # likely a common mistake
   self.assertEqual(doap_spec.uri, 'http://usefulinc.com/ns/doap#')
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例3: testFOAFminprops

 def testFOAFminprops(self):
   """Check we found at least 50 FOAF properties."""
   foaf_spec = Vocab('examples/foaf/','index-20081211.rdf')
   foaf_spec.index()
   foaf_spec.uri = str(FOAF)
   c = len(foaf_spec.properties)
   self.failUnless(c > 50 , "FOAF has more than 50 properties. count: "+str(c))
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例4: testSIOCminprops

 def testSIOCminprops(self):
   """Check we found at least 20 SIOC properties (which means matching OWL properties)"""
   sioc_spec = Vocab('examples/sioc/','sioc.rdf')
   sioc_spec.index()
   sioc_spec.uri = str(SIOC)
   c = len(sioc_spec.properties)
   self.failUnless(c > 20 , "SIOC has more than 20 properties. count was "+str(c))
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例5: testSIOCminprops_v3

 def testSIOCminprops_v3(self):
   """Check we found at least 5 SIOC properties."""
   # sioc_spec = Vocab(dir='examples/sioc/',f='sioc.rdf', uri = SIOC)
   sioc_spec = Vocab(dir=SIOCSNAPSHOTDIR,f=SIOCSNAPSHOT, uri = SIOC)
   sioc_spec.index()
   c = len(sioc_spec.properties)
   self.failUnless(c > 5 , "SIOC has more than 10 properties. count was "+str(c))
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例6: test_label_for_foaf_Person

 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")
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例7: test_label_for_foaf_workplaceHomepage

 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")
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例8: testTemplateLoader3

 def testTemplateLoader3(self):
   """Check loaded template isn't default string."""
   foaf_spec = Vocab(FOAFSNAPSHOTDIR,FOAFSNAPSHOT, uri = FOAF)
   foaf_spec.index()
   page = VocabReport(foaf_spec, basedir='./examples/', temploc='template.html')
   tpl = page.template
   self.assertNotEqual(tpl, "no template loaded")
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例9: test_lookup_Person

 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")
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例10: testniceName_1foafmyprop

 def testniceName_1foafmyprop(self):
   """simple test of nicename for a known namespace (FOAF), unknown property"""
   foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT)
   u = 'http://xmlns.com/foaf/0.1/myprop'
   nn = foaf_spec.niceName(u)
   # print "nicename for ",u," is: ",nn
   self.failUnless(nn == 'foaf:myprop', "Didn't extract nicename. input is"+u+"output was"+nn)
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例11: testGotRDFa

 def testGotRDFa(self):
   """Check HTML output formatter rdfa method returns some text"""
   foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri = FOAF)
   foaf_spec.index()
   page = VocabReport(foaf_spec)
   rdfa = page.rdfa()
   self.failUnless(rdfa)
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例12: testOutputHTML

 def testOutputHTML(self):
   """Check HTML output formatter does something"""
   foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri = FOAF)
   foaf_spec.index()
   page = VocabReport(foaf_spec)
   az = page.az()
   self.failUnless(az)
开发者ID:foaf,项目名称:foaftown,代码行数:7,代码来源:run_tests.py

示例13: testniceName_3baduri

 def testniceName_3baduri(self):
   """niceName should return same string if passed a non-URI (but log a warning?)"""
   foaf_spec = Vocab(FOAFSNAPSHOTDIR,FOAFSNAPSHOT)
   foaf_spec.index()
   u = 'thisisnotauri'
   nn = foaf_spec.niceName(u)
   #  print "nicename for ",u," is: ",nn
   self.failUnless(nn == u, "niceName didn't return same string when given a non-URI")
开发者ID:foaf,项目名称:foaftown,代码行数:8,代码来源:run_tests.py

示例14: testniceName_3mystery

 def testniceName_3mystery(self):
   """simple test of nicename for an unknown namespace"""
   foaf_spec = Vocab(FOAFSNAPSHOTDIR,FOAFSNAPSHOT)
   foaf_spec.index()
   u = 'http:/example.com/mysteryns/myprop'
   nn = foaf_spec.niceName(u)
   # print "nicename for ",u," is: ",nn
   self.failUnless(nn == 'http:/example.com/mysteryns/:myprop', "Didn't extract verbose nicename")
开发者ID:foaf,项目名称:foaftown,代码行数:8,代码来源:run_tests.py

示例15: testniceName_2foafhomepage

 def testniceName_2foafhomepage(self):
   """simple test of nicename for a known namespace (FOAF), known property."""
   foaf_spec = Vocab(FOAFSNAPSHOTDIR,FOAFSNAPSHOT)
   foaf_spec.index()
   u = 'http://xmlns.com/foaf/0.1/homepage'
   nn = foaf_spec.niceName(u)
   # print "nicename for ",u," is: ",nn
   self.failUnless(nn == 'foaf:homepage', "Didn't extract nicename")
开发者ID:foaf,项目名称:foaftown,代码行数:8,代码来源:run_tests.py


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