Skip to content

Commit

Permalink
Expand conceptscheme endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
koenedaele committed Oct 22, 2014
1 parent f1aeb70 commit 5090fa2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
- Compatibility with skosprovider 0.4.0
- Drop support for Python 2.6 and Python 3.2.
- Expose notes on collections.
- Integrate concept scheme information. Concepts and collections passed through
the service now contain the uri of the concept scheme they belong to. The
concept scheme endpoint now also exposes information like a uri, a list of
labels and notes.

0.3.0 (2014-06-24)
------------------
Expand Down
8 changes: 7 additions & 1 deletion pyramid_skosprovider/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ def get_conceptscheme(self):
provider = self.skos_registry.get_provider(scheme_id)
if not provider:
return HTTPNotFound()
return {'id': provider.get_vocabulary_id()}
return {
'id': provider.get_vocabulary_id(),
'uri': provider.concept_scheme.uri,
'label': provider.concept_scheme.label().label if provider.concept_scheme.label() else None,
'labels': provider.concept_scheme.labels,
'notes': provider.concept_scheme.notes
}

@view_config(route_name='skosprovider.conceptscheme.tc', request_method='GET')
def get_conceptscheme_top_concepts(self):
Expand Down
11 changes: 10 additions & 1 deletion tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,16 @@ def test_get_conceptscheme(self):
request.matchdict = {'scheme_id': 'TREES'}
pv = self._get_provider_view(request)
cs = pv.get_conceptscheme()
self.assertEqual({'id': 'TREES'}, cs)
self.assertEqual(
{
'id': 'TREES',
'uri': 'urn:x-skosprovider:trees',
'label': None,
'labels': [],
'notes': []
},
cs
)

def test_get_unexisting_conceptscheme(self):
request = self._get_dummy_request()
Expand Down

0 comments on commit 5090fa2

Please sign in to comment.