def test_default_language_scottish_gaelic(self):
        provider_gd = HeritagedataProvider(
            {
                'id': 'Heritagedata',
                'default_language': 'gd'
            },
            scheme_uri='http://purl.org/heritagedata/schemes/1')
        concept = provider_gd.get_by_id('500614')
        concept = concept.__dict__
        self.assertEqual(
            concept['uri'],
            'http://purl.org/heritagedata/schemes/1/concepts/500614')

        result = provider_gd.find({'label': 'LOCH', 'type': 'concept'})
        for r in result:
            self.assertIn("LOCH", r['label'])
            self.assertTrue(r['lang'] in ('en', 'gd'))

        provider_en = HeritagedataProvider(
            {'id': 'Heritagedata'},
            scheme_uri='http://purl.org/heritagedata/schemes/1')
        concept = provider_en.get_by_id('500614')
        concept = concept.__dict__
        self.assertEqual(
            concept['uri'],
            'http://purl.org/heritagedata/schemes/1/concepts/500614')

        result = provider_en.find({'label': 'LOCH', 'type': 'concept'})
        for r in result:
            self.assertIn("LOCH", r['label'])
            self.assertTrue(r['lang'] in ('en', 'gd'))
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
This script demonstrates using the HeritagedataProvider to get the concept of
'POST MEDIEVAL'.
'''

from skosprovider_heritagedata.providers import HeritagedataProvider

periodprovider = HeritagedataProvider(
    {'id': 'Heritagedata'},
    scheme_uri='http://purl.org/heritagedata/schemes/eh_period'
)

pm = periodprovider.get_by_id('PM')

print('Labels')
print('------')
for l in pm.labels:
   print(l.language + ': ' + l.label + ' [' + l.type + ']')

print('Notes')
print('-----')
for n in pm.notes:
    print(n.language + ': ' + n.note + ' [' + n.type + ']')
Exemplo n.º 3
0
#!/usr/bin/python
'''
This script demonstrates using the HeritagedataProvider to get the concept of
'POST MEDIEVAL'.
'''

from skosprovider_heritagedata.providers import HeritagedataProvider

periodprovider = HeritagedataProvider(
    {'id': 'Heritagedata'},
    scheme_uri='http://purl.org/heritagedata/schemes/eh_period')

pm = periodprovider.get_by_id('PM')

print('Labels')
print('------')
for l in pm.labels:
    print(l.language + ': ' + l.label + ' [' + l.type + ']')

print('Notes')
print('-----')
for n in pm.notes:
    print(n.language + ': ' + n.note + ' [' + n.type + ']')