class DefaultConceptSchemeUrnGeneratorTest(unittest.TestCase): def setUp(self): self.urigen = DefaultConceptSchemeUrnGenerator() def tearDown(self): del self.urigen def test_simple(self): self.assertEqual('urn:x-skosprovider:typologie', self.urigen.generate(id='TYPOLOGIE')) def test_missing_argument(self): self.assertRaises(KeyError, self.urigen.generate)
class DefaultConceptSchemeUrnGeneratorTest(unittest.TestCase): def setUp(self): self.urigen = DefaultConceptSchemeUrnGenerator() def tearDown(self): del self.urigen def test_simple(self): self.assertEqual( 'urn:x-skosprovider:typologie', self.urigen.generate(id='TYPOLOGIE') ) def test_missing_argument(self): self.assertRaises(KeyError, self.urigen.generate)
def _cs_from_graph(self, metadata): cslist = [] for sub in self.graph.subjects(RDF.type, SKOS.ConceptScheme): uri = self.to_text(sub) cs = ConceptScheme(uri=uri, labels=self._create_from_subject_typelist( sub, Label.valid_types), notes=self._create_from_subject_typelist( sub, Note.valid_types), sources=self._create_sources(sub), languages=self._create_languages(sub)) cslist.append(cs) if len(cslist) == 0: return ConceptScheme( uri=DefaultConceptSchemeUrnGenerator().generate( id=metadata.get('id'))) elif len(cslist) == 1: return cslist[0] else: raise RuntimeError( 'This RDF file contains more than one ConceptScheme.')
def setUp(self): self.urigen = DefaultConceptSchemeUrnGenerator()
def setUp(self): self.urigen = DefaultConceptSchemeUrnGenerator()