Esempio n. 1
0
 def test_get_all_default_language(self):
     trees = DictionaryProvider({'id': 'TREES'}, [larch])
     self.assertEqual(trees.get_all(), [{
         'id': '1',
         'uri': 'http://id.trees.org/1',
         'type': 'concept',
         'label': 'The Larch'
     }])
Esempio n. 2
0
 def test_get_all_default_language(self):
     trees = DictionaryProvider(
         {'id': 'TREES'},
         [larch]
     )
     self.assertEquals(
         trees.get_all(),
         [
             {
                 'id': '1',
                 'uri': 'http://id.trees.org/1',
                 'type': 'concept',
                 'label': 'The Larch'
             }
         ]
     )
Esempio n. 3
0
 def test_get_all_default_language(self):
     trees = DictionaryProvider({"id": "TREES"}, [larch])
     self.assertEquals(
         trees.get_all(), [{"id": "1", "uri": "http://id.trees.org/1", "type": "concept", "label": "The Larch"}]
     )
Esempio n. 4
0
    },
    [larch, chestnut, species],
    uri_generator=UriPatternGenerator('http://id.trees.org/types/%s'),
    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'))
Esempio n. 5
0
 def test_get_all_default_language(self):
     trees = DictionaryProvider({"id": "TREES"}, [larch])
     self.assertEquals(trees.get_all(), [{"id": "1", "label": "The Larch"}])