Esempio n. 1
0
 def __init__(self, db, mapping_db):
     self.mime_types = dict(
         [('html', 'text/html'), ('pretty-xml', 'application/rdf+xml'), ('turtle', 'text/turtle'),
          ('nt', 'text/plain'), ('json-ld', 'application/ld+json'), ('sparql', 'application/sparql-results+xml'
              ), ('json-sparql', 'application/sparql-results+json')])
     self.mime_ext = dict(
         [('html','.html'), ('pretty-xml', '.rdf'), ('turtle', '.ttl'), ('nt', '.nt')])
     self.wordnet_context = WNRDF.WNRDFContext(db, mapping_db)
     self.header = open(resolve("header")).read()
     self.footer = open(resolve("footer")).read()
Esempio n. 2
0
 def test_synset(self):
     context = WNRDF.WNRDFContext("wordnet_3.1+.db")
     graph = WNRDF.synset(context, 100001740)
     print graph.serialize()
     assert (graph)
Esempio n. 3
0
 def test_sample(self):
     context = WNRDF.WNRDFContext("wordnet_3.1+.db")
     graph = WNRDF.synset(context, 100003993)
     serialization = graph.serialize()
     assert ("American shopkeeper" in serialization)
Esempio n. 4
0
 def test_fail(self):
     context = WNRDF.WNRDFContext("wordnet_3.1+.db")
     graph = WNRDF.synset(context, 0)
     assert (graph is None)
Esempio n. 5
0
 def test_morphs(self):
     context = WNRDF.WNRDFContext("wordnet_3.1+.db")
     graph = WNRDF.entry(context, "abhor", "v")
     serialization = graph.serialize()
     assert ("abhorred" in serialization)
     assert ("abhorring" in serialization)
Esempio n. 6
0
 def test_adjposition(self):
     context = WNRDF.WNRDFContext("wordnet_3.1+.db")
     graph = WNRDF.entry(context, "inclined", "a")
     serialization = graph.serialize()
     assert ("adjposition" in serialization)
Esempio n. 7
0
 def test_entry(self):
     context = WNRDF.WNRDFContext("wordnet_3.1+.db")
     graph = WNRDF.entry(context, "cat", "n")
     print graph.serialize()
     assert (graph)