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")
def testSIOCminprops_v2(self): """Check we found at least 10 SIOC properties.""" sioc_spec = Vocab(dir='examples/sioc/', f='sioc.rdf', uri=SIOC) sioc_spec.index() c = len(sioc_spec.properties) self.failUnless( c > 10, "SIOC has more than 10 properties. count was " + str(c))
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))
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#')
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)
def testFOAFmin_classes(self): """Check we found at least 5 FOAF classes.""" foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT, uri=FOAF) foaf_spec.index() c = len(foaf_spec.classes) self.failUnless(c > 5, "FOAF has more than 10 classes. count was " + str(c))
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))
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")
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.")
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)
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.")
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)
def testSIOCmin_classes(self): """Check we found at least 5 SIOC classes.""" sioc_spec = Vocab(dir=SIOCSNAPSHOTDIR, f=SIOCSNAPSHOT, uri=SIOC) sioc_spec.index() c = len(sioc_spec.classes) self.failUnless(c > 5, "SIOC has more than 10 classes. count was " + str(c))
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)
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")
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))
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")
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)
def testTemplateLoader2(self): """Check we can load a template file thru constructors.""" foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri = FOAF) foaf_spec.index() page = VocabReport(foaf_spec, basedir='./examples/', temploc='template.html') tpl = page.template # print "Page template is: ", tpl self.failUnless(tpl != None)
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")
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")
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")
def testSIOCmaxprops(self): """sioc max props: not more than 500 properties in SIOC""" sioc_spec = Vocab(dir='examples/sioc/',f='sioc.rdf') sioc_spec.index() sioc_spec.uri = str(SIOC) c = len(sioc_spec.properties) #print "SIOC property count: ",c self.failUnless(c < 500 , "SIOC has less than 500 properties. count was "+str(c))
def testFOAFusingDCasExternal(self): """FOAF using external vocabs""" foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT) foaf_spec.index() foaf_spec.uri = str(FOAF) for t in foaf_spec.terms: # print "is term "+t+" external? ", t.is_external(foaf_spec) ''
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#')
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")
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))
def test_set_bad_uri_in_constructor(self): """v = Vocab( uri=something ) can be used to set the Vocab's URI to a bad URI (but should warn). """ u = 'notauri' foaf_spec = Vocab(FOAFSNAPSHOTDIR, FOAFSNAPSHOT, uri=u) foaf_spec.index() self.failUnless( foaf_spec.uri == u, "Vocab's URI was supposed to be " + u + " but was " + foaf_spec.uri)
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))
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")
def test_set_uri_in_constructor(self): """v = Vocab( uri=something ) can be used to set the Vocab's URI. """ u = 'http://example.com/test_set_uri_in_constructor' foaf_spec = Vocab(FOAFSNAPSHOTDIR, FOAFSNAPSHOT, uri=u) foaf_spec.index() self.failUnless( foaf_spec.uri == u, "Vocab's URI was supposed to be " + u + " but was " + foaf_spec.uri)
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")
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)
def testDOAPusingFOAFasExternal(self): """when DOAP mentions a FOAF class, the API should let us know it is external""" doap_spec = Vocab(dir='examples/doap/', f='doap.rdf') doap_spec.index() doap_spec.uri = str(DOAP) for t in doap_spec.classes: # print "is class "+t+" external? " # print t.is_external(doap_spec) ''
def testSIOCmaxprops(self): """sioc max props: not more than 500 properties in SIOC""" sioc_spec = Vocab(dir='examples/sioc/', f='sioc.rdf') sioc_spec.index() sioc_spec.uri = str(SIOC) c = len(sioc_spec.properties) #print "SIOC property count: ",c self.failUnless( c < 500, "SIOC has less than 500 properties. count was " + str(c))
def testDOAPusingFOAFasExternal(self): """when DOAP mentions a FOAF class, the API should let us know it is external""" doap_spec = Vocab(dir='examples/doap/',f='doap.rdf') doap_spec.index() doap_spec.uri = str(DOAP) for t in doap_spec.classes: # print "is class "+t+" external? " # print t.is_external(doap_spec) ''
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")
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")
def test_reindexing_not_fattening(self): "Indexing on construction and then a couple more times shouldn't affect property count." foaf_spec = Vocab(FOAFSNAPSHOTDIR, FOAFSNAPSHOT, uri=FOAF) foaf_spec.index() c = len(foaf_spec.properties) self.failUnless( c < 100, "After indexing 3 times, foaf property count should still be < 100: " + str(c))
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")
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")
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")
def testSimpleReport(self): """Use the template to generate a simple test report in txt.""" foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri = FOAF) foaf_spec.index() page = VocabReport(foaf_spec, basedir='./examples/', temploc='template.html') simple = page.report() print "Simple report: ", simple self.assertNotEqual(simple, "Nope!")
def testGenerateReport(self): """Use the template to generate our report page.""" foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR,f=FOAFSNAPSHOT, uri = FOAF) foaf_spec.index() page = VocabReport(foaf_spec, basedir='./examples/', temploc='template.html') tpl = page.template final = page.generate() rdfa = page.rdfa() self.assertNotEqual(final, "Nope!")
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'")
def testTemplateLoader2(self): """Check we can load a template file thru constructors.""" foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT, uri=FOAF) foaf_spec.index() page = VocabReport(foaf_spec, basedir='./examples/', temploc='template.html') tpl = page.template # print "Page template is: ", tpl self.failUnless(tpl != None)
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")
def test_getset_uri(self): """getting and setting a Vocab uri property""" foaf_spec = Vocab(FOAFSNAPSHOTDIR,FOAFSNAPSHOT,uri='http://xmlns.com/foaf/0.1/') foaf_spec.index() u = 'http://foaf.tv/example#' # print "a) foaf_spec.uri is: ", foaf_spec.uri foaf_spec.uri = u # print "b) foaf_spec.uri is: ", foaf_spec.uri # print self.failUnless( foaf_spec.uri == u, "Failed to change uri.")
def testSimpleReport(self): """Use the template to generate a simple test report in txt.""" foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT, uri=FOAF) foaf_spec.index() page = VocabReport(foaf_spec, basedir='./examples/', temploc='template.html') simple = page.report() print("Simple report: ", simple) self.assertNotEqual(simple, "Nope!")
def testGenerateReport(self): """Use the template to generate our report page.""" foaf_spec = Vocab(dir=FOAFSNAPSHOTDIR, f=FOAFSNAPSHOT, uri=FOAF) foaf_spec.index() page = VocabReport(foaf_spec, basedir='./examples/', temploc='template.html') tpl = page.template final = page.generate() rdfa = page.rdfa() self.assertNotEqual(final, "Nope!")
def test_getset_uri(self): """getting and setting a Vocab uri property""" foaf_spec = Vocab(FOAFSNAPSHOTDIR, FOAFSNAPSHOT, uri='http://xmlns.com/foaf/0.1/') foaf_spec.index() u = 'http://foaf.tv/example#' # print "a) foaf_spec.uri is: ", foaf_spec.uri foaf_spec.uri = u # print "b) foaf_spec.uri is: ", foaf_spec.uri # print self.failUnless(foaf_spec.uri == u, "Failed to change uri.")
def makeSpec(indir, uri, shortName,outdir,outfile, template, templatedir,indexrdfdir, ontofile): spec = Vocab( indexrdfdir, ontofile, uri) spec.addShortName(shortName) spec.index() # slurp info from sources out = VocabReport( spec, indir, template, templatedir ) filename = os.path.join(outdir, outfile) print "Printing to ",filename f = open(filename,"w") result = out.generate() f.write(result)
def makeSpec(indir, uri, shortName,outdir,outfile, template, templatedir, indexrdfdir, ontofile,specurl,name,addGroups): spec = Vocab( indexrdfdir, ontofile, uri) spec.addShortName(shortName) spec.index() # slurp info from sources #create a Report out = VocabReport( spec, indir, template, templatedir,specurl,name) #check template htmlgroups = None if (addGroups): if out.check_template_for_parameter('%groups%'): groups = Grouping(spec,uri) htmlgroups = groups.getHTMLGroups(); else: print "Template doesn't contain %groups% parameter -- skipping groups creation" filename = os.path.join(outdir, outfile) print "Printing to ",filename f = open(filename,"w") result = out.generate(htmlgroups) f.write(result)
import libvocab from libvocab import Vocab from libvocab import Term from libvocab import Class from libvocab import Property from libvocab import DOAP # Test DOAP spec fn = 'examples/doap/doap-en.rdf' # fn = 'examples/doap/doap.rdf' spec = Vocab( fn ) # Note: I separated out a doap-en since libvocab makes assumptions of 'en' # this avoids combinatorial explosion of spanish/french/eng labels vs comments # TODO: don't assume the main index.rdf is monolingual (whether 'en' or other) # spec = Vocab( DOAP ) spec.uri = DOAP spec.raw() spec.index() # slurp info from sources # print spec.report() for p in spec.properties: print "Got a property: " + p print p.simple_report().encode('UTF-8')
from rdflib import Namespace from rdflib.Graph import Graph from rdflib.Graph import ConjunctiveGraph from rdflib.sparql.sparqlGraph import SPARQLGraph from rdflib.sparql.graphPattern import GraphPattern from rdflib.sparql.bison import Parse from rdflib.sparql import Query # Test a SPARQL query against RDF data input # fn = 'examples/sioc/sioc.rdf' #fn = 'examples/foaf/index.rdf' #fn = 'examples/doap/doap-en.rdf' spec = Vocab( fn ) spec.uri = SIOC # spec.raw() spec.index() # slurp info from sources #print spec.report().encode('UTF-8') g = spec.graph q= 'SELECT ?x ?l ?c ?type WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type . FILTER (?type = owl:ObjectProperty || ?type = owl:DatatypeProperty || ?type = rdf:Property || ?type = owl:FunctionalProperty || ?type = owl:InverseFunctionalProperty) } ' q= 'SELECT distinct ?x ?l ?c WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type . FILTER (?type = <http://www.w3.org/2002/07/owl#ObjectProperty> || ?type = <http://www.w3.org/2002/07/owl#DatatypeProperty> || ?type = <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> || ?type = <http://www.w3.org/2002/07/owl#FunctionalProperty> || ?type = <http://www.w3.org/2002/07/owl#InverseFunctionalProperty>) } ' # Got type: http://www.w3.org/2002/07/owl#ObjectProperty # property: has_usergrouplabel: has_usergroup comment: Points to a Usergroup that has certain access to this Space.
def testDOAPns(self): doap_spec = Vocab('examples/doap/','doap-en.rdf') doap_spec.index() doap_spec.uri = str(DOAP) self.assertEqual(doap_spec.uri, 'http://usefulinc.com/ns/doap#')
# q= 'SELECT distinct ?x ?l ?c WHERE { ?x rdfs:label ?l . ?x rdfs:comment ?c . ?x a ?type . FILTER (?type = <http://www.w3.org/2002/07/owl#ObjectProperty> || ?type = <http://www.w3.org/2002/07/owl#DatatypeProperty> || ?type = <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> || ?type = <http://www.w3.org/2002/07/owl#FunctionalProperty> || ?type = <http://www.w3.org/2002/07/owl#InverseFunctionalProperty>) } ' import libvocab from libvocab import Vocab from libvocab import Term from libvocab import Class from libvocab import Property from libvocab import SIOC # Test SIOC spec fn = 'examples/sioc/sioc.rdf' spec = Vocab( fn ) spec.uri = SIOC spec.raw() spec.index() # slurp info from sources print spec.report().encode('UTF-8') for p in spec.properties: print "Got a property: " + p print p.simple_report().encode('UTF-8') for c in spec.classes: print "Got a class: " + c print c.simple_report().encode('UTF-8')
def testSIOCns(self): sioc_spec = Vocab('examples/sioc/','sioc.rdf') sioc_spec.index() sioc_spec.uri = str(SIOC) self.assertEqual(sioc_spec.uri, 'http://rdfs.org/sioc/ns#')
def testDOAPWrongns(self): doap_spec = Vocab('examples/doap/','doap-en.rdf') doap_spec.index() doap_spec.uri = str(DOAP) self.assertNotEqual(doap_spec.uri, 'http://example.com/DELIBERATE_MISTAKE_HERE')