def test_find_case_sensitive(self): trees = DictionaryProvider( {"id": "TREES", "default_language": "nl"}, [larch, chestnut, species], case_insensitive=False ) self.assertEqual( trees.find({"label": "The Lar"}), [{"id": "1", "uri": "http://id.trees.org/1", "type": "concept", "label": "De Lariks"}], ) self.assertEqual(trees.find({"label": "lar"}), [])
def test_find_case_sensitive(self): trees = DictionaryProvider({ 'id': 'TREES', 'default_language': 'nl' }, [larch, chestnut, species], case_insensitive=False) self.assertEqual(trees.find({'label': 'The Lar'}), [{ 'id': '1', 'uri': 'http://id.trees.org/1', 'type': 'concept', 'label': 'De Lariks' }]) self.assertEqual(trees.find({'label': 'lar'}), [])
def test_find_kastanje(self): trees = DictionaryProvider({ 'id': 'TREES', 'default_language': 'nl' }, [larch, chestnut, species]) concepts = trees.find({'label': 'De Paardekastanje'}) assert len(concepts) == 1
def test_find_kastanje(self): trees = DictionaryProvider( {'id': 'TREES', 'default_language': 'nl'}, [larch, chestnut, species] ) concepts = trees.find({'label': 'De Paardekastanje'}) assert len(concepts) == 1
def test_find_case_sensitive(self): trees = DictionaryProvider( {'id': 'TREES', 'default_language': 'nl'}, [larch, chestnut, species], case_insensitive=False ) self.assertEqual( trees.find({'label': 'The Lar'}), [ { 'id': '1', 'uri': 'http://id.trees.org/1', 'type': 'concept', 'label': 'De Lariks' } ] ) self.assertEqual( trees.find({'label': 'lar'}), [] )
concept_scheme=ConceptScheme('http://id.trees.org') ) # Get a concept or collection by id print(provider.get_by_id(1).label().label) # Get a concept or collection by uri print(provider.get_by_uri('http://id.trees.org/types/1')) # Get all concepts and collections in a provider # If possible, show a Dutch(as spoken in Belgium) label # Order them ascending by label print(provider.get_all(language='nl-BE', sort='label', sort_order='asc')) # Get the top concepts in a provider print(provider.get_top_concepts()) # Find anything that has a label of horse print(provider.find({'label': 'The Larch'})) # Get the top of a display hierarchy print(provider.get_top_display()) # Get the children to display in a hierarchy concept 1 # If possible, show a French(as spoken in Belgium) label # Order them descending by id print(provider.get_children_display(3, language='fr-BE', sort='id', sort_order='desc')) # Get all concepts underneath a concept or collection print(provider.expand(3))
def test_find_kastanje(self): trees = DictionaryProvider({"id": "TREES", "default_language": "nl"}, [larch, chestnut, species]) concepts = trees.find({"label": "De Paardekastanje"}) assert len(concepts) == 1