Exemplo n.º 1
0
    def build(task):
        logger.info('Building new core dist')
        roald = Roald()
        roald.load('src/', format='roald2', language='nb')
        roald.set_uri_format('http://data.ub.uio.no/%s/c{id}' % config['basename'], 'REAL')
        roald.save('%s.json' % config['basename'])
        logger.info('Wrote %s.json', config['basename'])

        includes = [
            '%s.scheme.ttl' % config['basename'],
            'src/ub-onto.ttl',
            # 'src/nynorsk.ttl'
        ]

        # 1) MARC21
        # marc21options = {
        #     'vocabulary_code': 'noubomn',
        #     'created_by': 'NO-TrBIB',
        #     'mappings_from': ['src/lambda.rdf']
        # }
        # roald.export('dist/%s.marc21.xml' %
        #              config['basename'], format='marc21', **marc21options)
        # logger.info('Wrote dist/%s.marc21.xml', config['basename'])

        # 2) RDF (core)
        roald.export('dist/%s.ttl' % config['basename'],
                     format='rdfskos',
                     include=includes
                     )
        logger.info('Wrote dist/%s.core.ttl', config['basename'])
Exemplo n.º 2
0
    def build(task):
        logger.info('Building new core dist')
        roald = Roald()
        roald.load('src/', format='roald2', language='nb')
        roald.set_uri_format('http://data.ub.uio.no/%s/c{id}' % config['basename'], 'REAL')
        roald.save('%s.json' % config['basename'])
        logger.info('Wrote %s.json', config['basename'])

        includes = [
            '%s.scheme.ttl' % config['basename'],
            'src/ub-onto.ttl',
            # 'src/nynorsk.ttl'
        ]

        # 1) MARC21
        # marc21options = {
        #     'vocabulary_code': 'noubomn',
        #     'created_by': 'NO-TrBIB',
        #     'mappings_from': ['src/lambda.rdf']
        # }
        # roald.export('dist/%s.marc21.xml' %
        #              config['basename'], format='marc21', **marc21options)
        # logger.info('Wrote dist/%s.marc21.xml', config['basename'])

        # 2) RDF (core)
        roald.export('dist/%s.ttl' % config['basename'],
                     format='rdfskos',
                     include=includes
                     )
        logger.info('Wrote dist/%s.core.ttl', config['basename'])
Exemplo n.º 3
0
    def build(task):
        logger.info('Building extras')
        roald = Roald()
        roald.load('src/', format='roald2', language='nb')
        roald.set_uri_format(
            'http://data.ub.uio.no/%s/c{id}' % config['basename'])

        includes = [
            '%s.scheme.ttl' % config['basename'],
            'src/ub-onto.ttl',
            # 'src/nynorsk.ttl'
        ]

        mappings = [
            'src/mumapper.rdf',
            'src/lambda.rdf'
        ]

        # 1) MARC21
        marc21options = {
            'vocabulary_code': 'noubomn',
            'created_by': 'NoOU',
            'mappings_from': ['src/lambda.rdf']
        }
        roald.export('dist/%s.marc21.xml' %
                     config['basename'], format='marc21', **marc21options)
        logger.info('Wrote dist/%s.marc21.xml', config['basename'])

        # 3) RDF (core + mappings)
        roald.export('dist/%s.complete.ttl' % config['basename'],
                     format='rdfskos',
                     include=includes,
                     mappings_from=mappings
                     )
        logger.info('Wrote dist/%s.complete.ttl', config['basename'])
Exemplo n.º 4
0
    def build(task):
        logger.info('Building extras')
        roald = Roald()
        roald.load('src/', format='roald2', language='nb')
        roald.set_uri_format('http://data.ub.uio.no/%s/c{id}' % config['basename'], 'REAL')

        roald.load('src/categories_and_mappings.ttl', format='skos')  # From soksed
        roald.load('src/real_hume_mappings.ttl', format='skos')  # Humord mappings from mymapper

        # 1) MARC21 with $9 fields for CCMapper
        marc21options = {
            'vocabulary_code': 'noubomn',
            'created_by': 'NO-TrBIB',
            'include_extras': True,
            'include_memberships': True,
        }
        roald.export('dist/%s.ccmapper.marc21.xml' %
                     config['basename'], format='marc21',
                     **marc21options)
        logger.info('Wrote dist/%s.ccmapper.marc21.xml', config['basename'])

        roald.load('src/real_tekord_mappings.ttl', format='skos')  # Tekord mappings
        roald.load('src/real_agrovoc_mappings.ttl', format='skos')  # Agrovoc mappings
        roald.load('src/ccmapper_mappings.ttl', format='skos')  # Mappings from CCMapper
        roald.load('src/msc-ubo.mappings.nt', format='skos')  # MSC mappings

        # 1) MARC21 for Alma and general use
        marc21options = {
            'vocabulary_code': 'noubomn',
            'created_by': 'NO-TrBIB',
            'include_extras': False,
            'include_memberships': False,
        }
        roald.export('dist/%s.marc21.xml' %
                     config['basename'], format='marc21', **marc21options)
        logger.info('Wrote dist/%s.marc21.xml', config['basename'])

        # 3) RDF (core + mappings)
        prepared = roald.prepare_export(format='rdfskos',
            include=[
                '%s.scheme.ttl' % config['basename'],
                'src/ub-onto.ttl',
                'src/categories_and_mappings.ttl',
            ],
            with_ccmapper_candidates=True,
            infer=True
        )
        prepared.write('dist/%s.complete.ttl' % config['basename'], format='turtle')
        logger.info('Wrote dist/%s.complete.ttl', config['basename'])
        prepared.write('dist/%s.complete.nt' % config['basename'], format='nt')
        logger.info('Wrote dist/%s.complete.nt', config['basename'])
Exemplo n.º 5
0
from roald import Roald
roald = Roald()

print 'Importing Roald 2 files'
roald.load('./riidata/', format='roald2')

print 'Saving JSON'
roald.save('realfagstermer.json')

print 'Converting to MARC21'
roald.export('realfagstermer.marc21.xml', format='marc21')

print 'Converting to RDF/SKOS'
roald.export('realfagstermer.ttl', format='rdfskos')
Exemplo n.º 6
0
    def build_dist(task):
        logger.info('Building new dist')
        roald = Roald()
        roald.load('src/usvd.xml', format='bibsys', language='nb', exclude_underemne=True)
        roald.set_uri_format(
            'http://data.ub.uio.no/%s/c{id}' % config['basename'])
        roald.save('%s.json' % config['basename'])
        logger.info('Wrote %s.json', config['basename'])

        includes = [
            '%s.scheme.ttl' % config['basename'],
            'ubo-onto.ttl'
        ]

        # 1) MARC21
        marc21options = {
            'vocabulary_code': 'usvd',
            'created_by': 'No-TrBIB'
        }
        roald.export('dist/%s.marc21.xml' %
                     config['basename'], format='marc21', **marc21options)
        logger.info('Wrote dist/%s.marc21.xml', config['basename'])

        # 2) RDF (core)
        roald.export('dist/%s.ttl' % config['basename'],
                     format='rdfskos',
                     include=includes
                     )
        logger.info('Wrote dist/%s.core.ttl', config['basename'])
Exemplo n.º 7
0
def make():

    roald = Roald()
    roald.load('src/', format='roald2', language='nb')
    roald.set_uri_format('http://data.ub.uio.no/realfagstermer/c{id}')
    roald.save('realfagstermer.json')

    marc21options = {
        'vocabulary_code': 'noubomn',
        'created_by': 'NoOU',
        'mappings_from': ['src/lambda.rdf']
    }
    roald.export('dist/realfagstermer.marc21.xml',
                 format='marc21',
                 **marc21options)
    roald.export('dist/realfagstermer.ttl',
                 format='rdfskos',
                 include=[
                     'realfagstermer.scheme.ttl', 'ubo-onto.ttl',
                     'src/nynorsk.ttl'
                 ],
                 mappings_from=['src/mumapper.rdf', 'src/lambda.rdf'])
Exemplo n.º 8
0
    def build_dist(task):
        logger.info('Building new dist')
        roald = Roald()
        roald.load('src/tekord.xml', format='bibsys', language='nb')
        roald.set_uri_format(
            'http://data.ub.uio.no/%s/c{id}' % config['basename'])
        roald.save('%s.json' % config['basename'])
        logger.info('Wrote %s.json', config['basename'])

        includes = [
            '%s.scheme.ttl' % config['basename'],
            'ubo-onto.ttl'
        ]

        mappings = [
            'src/real_tekord_mappings.ttl'
        ]

        # 1) MARC21
        marc21options = {
            'vocabulary_code': 'tekord',
            'created_by': 'NO-TrNTNU'
        }
        roald.export('dist/%s.marc21.xml' %
                     config['basename'], format='marc21', **marc21options)
        logger.info('Wrote dist/%s.marc21.xml', config['basename'])

        # 2) RDF (core)
        roald.export('dist/%s.ttl' % config['basename'],
                     format='rdfskos',
                     include=includes,
                     add_same_as=['http://ntnu.no/ub/data/tekord#{id}']
                     )
        logger.info('Wrote dist/%s.core.ttl', config['basename'])

        # 3) RDF (core + mappings)
        roald.export('dist/%s.complete.ttl' % config['basename'],
                     format='rdfskos',
                     include=includes,
                     mappings_from=mappings,
                     add_same_as=['http://ntnu.no/ub/data/tekord#{id}']
                     )
        logger.info('Wrote dist/%s.complete.ttl', config['basename'])
Exemplo n.º 9
0
def make():

    roald = Roald()
    roald.load('src/usvd.xml', format='bibsys', language='nb')
    roald.set_uri_format('http://data.ub.uio.no/usvd/c{id}')
    roald.save('usvd.json')

    marc21options = {
       'vocabulary_code': 'usvd',
       'created_by': 'NoOU'
    }
    roald.export('dist/usvd.marc21.xml', format='marc21', **marc21options)
    roald.export('dist/usvd.ttl', format='rdfskos',
             include=['usvd.scheme.ttl', 'ubo-onto.ttl'])
Exemplo n.º 10
0
    def build_dist(task):
        logger.info('Building new dist')
        roald = Roald()
        roald.load('src/', format='roald2', language='en')
        roald.set_uri_format('http://data.ub.uio.no/%s/c{id}' %
                             config['basename'])
        roald.save('%s.json' % config['basename'])
        logger.info('Wrote %s.json', config['basename'])

        marc21options = {'vocabulary_code': 'noubomr', 'created_by': 'NoOU'}
        roald.export('dist/%s.marc21.xml' % config['basename'],
                     format='marc21',
                     **marc21options)
        logger.info('Wrote dist/%s.marc21.xml', config['basename'])

        prepared = roald.prepare_export(format='rdfskos',
                                        include=[
                                            '%s.scheme.ttl' %
                                            config['basename'],
                                            'src/ub-onto.ttl',
                                        ])
        prepared.write('dist/%s.ttl' % config['basename'], format='turtle')
        logger.info('Wrote dist/%s.ttl', config['basename'])
        prepared.write('dist/%s.nt' % config['basename'], format='nt')
        logger.info('Wrote dist/%s.nt', config['basename'])
Exemplo n.º 11
0
    def build(task):
        logger.info('Building extras')
        roald = Roald()
        roald.load('src/', format='roald2', language='nb')
        roald.set_uri_format('http://data.ub.uio.no/%s/c{id}' % config['basename'], 'REAL')

        roald.load('src/categories_and_mappings.ttl', format='skos')  # From soksed
        roald.load('src/hume.rdf', format='skos')  # Humord mappings from mymapper

        # 1) MARC21 with $9 fields for CCMapper
        marc21options = {
            'vocabulary_code': 'noubomn',
            'created_by': 'NO-TrBIB',
            'include_extras': True,
            'include_memberships': True,
        }
        roald.export('dist/%s.ccmapper.marc21.xml' %
                     config['basename'], format='marc21',
                     **marc21options)
        logger.info('Wrote dist/%s.ccmapper.marc21.xml', config['basename'])

        roald.load('src/mumapper.rdf', format='skos')  # Tekord mappings
        roald.load('src/ddc.rdf', format='skos')  # Mappings from CCMapper

        # 1) MARC21 for Alma and general use
        marc21options = {
            'vocabulary_code': 'noubomn',
            'created_by': 'NO-TrBIB',
            'include_extras': False,
            'include_memberships': False,
        }
        roald.export('dist/%s.marc21.xml' %
                     config['basename'], format='marc21', **marc21options)
        logger.info('Wrote dist/%s.marc21.xml', config['basename'])

        # 3) RDF (core + mappings)
        roald.export('dist/%s.complete.ttl' % config['basename'],
                     format='rdfskos',
                     include=[
                        '%s.scheme.ttl' % config['basename'],
                        'src/ub-onto.ttl',
                        'src/categories_and_mappings.ttl',
                     ],
                     with_ccmapper_candidates=True,
                     infer=True)
        logger.info('Wrote dist/%s.complete.ttl', config['basename'])
Exemplo n.º 12
0
    def build_dist(task):
        logger.info('Building new dist')
        roald = Roald()
        roald.load('src/', format='roald2', language='en')
        roald.set_uri_format(
            'http://data.ub.uio.no/%s/c{id}' % config['basename'])
        roald.save('%s.json' % config['basename'])
        logger.info('Wrote %s.json', config['basename'])

        marc21options = {
            'vocabulary_code': 'noubomr',
            'created_by': 'NoOU'
        }
        roald.export('dist/%s.marc21.xml' %
                     config['basename'], format='marc21', **marc21options)
        logger.info('Wrote dist/%s.marc21.xml', config['basename'])

        roald.export('dist/%s.ttl' % config['basename'], format='rdfskos',
                     include=['%s.scheme.ttl' % config['basename'], 'src/ub-onto.ttl'])
        logger.info('Wrote dist/%s.ttl', config['basename'])