示例#1
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'rero_id': 'http://data.rero.ch/01-R1234'
     }
     converted = record2jsonld(record, book_context)
     assert converted[0].get('@id') == 'http://doc.rero.ch/record/1234'
示例#2
0
def test_jsonld(book_context):
    record = {'recid': '1234', 'isbn10': '2-88147-009-2'}
    converted = record2jsonld(record, book_context)
    assert converted == [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://purl.org/ontology/bibo/isbn10': [{
            '@value': '2-88147-009-2'
        }]
    }]
示例#3
0
def test_jsonld(book_context):
    record = {'recid': '1234', 'isbn': '9782882250209'}
    converted = record2jsonld(record, book_context)
    assert converted == [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://purl.org/ontology/bibo/isbn13': [{
            '@value': '9782882250209'
        }]
    }]
示例#4
0
 def test_jsonld(self, book_context):
     record = {"recid": "1234", "other_title": {"maintitle": "Other Title", "lang": "en", "full": "Other Title"}}
     converted = record2jsonld(record, book_context)
     jsonld = [
         {
             "@id": "http://doc.rero.ch/record/1234",
             "http://purl.org/dc/terms/alternative": [{"@value": "Other Title", "@language": "en"}],
         }
     ]
     assert converted == jsonld
示例#5
0
def test_jsonld(book_context):
    record = {'recid': '1234', 'language': 'en'}
    converted = record2jsonld(record, book_context)
    jsonld = [{
        '@id': 'http://doc.rero.ch/record/1234',
        'http://purl.org/dc/terms/language': [{
            '@value': 'en'
        }]
    }]
    assert converted == jsonld
示例#6
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'isbn10': '2-88147-009-2'
     }
     converted = record2jsonld(record, book_context)
     assert converted == [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://purl.org/ontology/bibo/isbn10': [{
             '@value': '2-88147-009-2'
         }]
     }]
示例#7
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'media_type': 'http://rdvocab.info/termList/RDAMediaType/1003'
     }
     converted = record2jsonld(record, book_context)
     assert converted == [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://rdaregistry.info/Elements/u/mediaType': [{
             '@id': 'http://rdvocab.info/termList/RDAMediaType/1003'
         }]
     }]
示例#8
0
def test_jsonld(book_context):
    record = {'recid': '1234', 'reroid': 'http://data.rero.ch/01-R1234'}
    converted = record2jsonld(record, book_context)
    jsonld = [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://purl.org/dc/terms/hasFormat': [{
            '@id':
            'http://data.rero.ch/01-R1234'
        }]
    }]
    assert converted == jsonld
示例#9
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'rero_id': 'http://data.rero.ch/01-R1234'
     }
     converted = record2jsonld(record, book_context)
     jsonld = [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://purl.org/dc/terms/hasFormat': [{
             '@id': 'http://data.rero.ch/01-R1234'
         }]
     }]
     assert converted == jsonld
示例#10
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'language': 'en'
     }
     converted = record2jsonld(record, book_context)
     jsonld = [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://purl.org/dc/terms/language': [{
             '@value': 'en'
         }]
     }]
     assert converted == jsonld
示例#11
0
def test_jsonld(book_context):
    record = {'recid': '1234', 'type': ['bibrec', 'book', 'text']}
    converted = record2jsonld(record, book_context)
    jsonld = [{
        '@id':
        'http://doc.rero.ch/record/1234',
        '@type': [
            'http://purl.org/dc/terms/BibliographicResource',
            'http://purl.org/ontology/bibo/Book',
            'http://purl.org/dc/dcmitype/Text',
        ]
    }]
    assert converted == jsonld
示例#12
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'corporate': ['Corporate name', 'Corporate name2']
     }
     converted = record2jsonld(record, book_context)
     assert converted == [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://purl.org/dc/elements/1.1/contributor': [{
             '@value': 'Corporate name'
         }, {
             '@value': 'Corporate name2'
         }]
     }]
示例#13
0
def test_jsonld(book_context):
    record = {
        'recid': '1234',
        'media_type': 'http://rdvocab.info/termList/RDAMediaType/1003'
    }
    converted = record2jsonld(record, book_context)
    assert converted == [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://rdaregistry.info/Elements/u/mediaType': [{
            '@id':
            'http://rdvocab.info/termList/RDAMediaType/1003'
        }]
    }]
示例#14
0
def test_jsonld(book_context):
    record = {
        'recid': '1234',
        'publication_date': {
            'from': 2015,
            'to': 2016,
            'full': '2015-2016'
        }
    }
    converted = record2jsonld(record, book_context)
    assert converted == [{
        '@id': 'http://doc.rero.ch/record/1234',
        'http://purl.org/dc/terms/issued': [{
            '@value': '2015-2016'
        }]
    }]
示例#15
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'series': {
             'name': 'Name',
             'volume': '3',
             'full': 'Name ; 3'
         }
     }
     converted = record2jsonld(record, book_context)
     assert converted == [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://purl.org/dc/terms/bibliographicCitation': [{
             '@value': 'Name ; 3'
         }]
     }]
示例#16
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'publication_date': {
             'from': 2015,
             'to': 2016,
             'full': '2015-2016'
         }
     }
     converted = record2jsonld(record, book_context)
     assert converted == [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://purl.org/dc/terms/issued': [{
             '@value': '2015-2016'
         }]
     }]
示例#17
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'edition': {
             'name': 'Name',
             'remainder': 'Remainder',
             'full': 'Name Remainder'
         }
     }
     converted = record2jsonld(record, book_context)
     assert converted == [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://purl.org/ontology/bibo/edition': [{
             '@value': 'Name Remainder'
         }]
     }]
示例#18
0
def test_jsonld(book_context):
    record = {
        'recid': '1234',
        'corporate': ['Corporate name', 'Corporate name2']
    }
    converted = record2jsonld(record, book_context)
    assert converted == [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://purl.org/dc/elements/1.1/contributor': [{
            '@value':
            'Corporate name'
        }, {
            '@value':
            'Corporate name2'
        }]
    }]
示例#19
0
 def test_jsonld(self, book_context):
     record = {
         "recid": "1234",
         "collation": {
             "pages": "100 p.",
             "other": "ill.",
             "dimension": "25 x 30 cm",
             "full": "100 p. ill. 25 x 30 cm",
         },
     }
     converted = record2jsonld(record, book_context)
     assert converted == [
         {
             "@id": "http://doc.rero.ch/record/1234",
             "http://purl.org/dc/elements/1.1/format": [{"@value": "100 p. ill. 25 x 30 cm"}],
         }
     ]
示例#20
0
def test_jsonld(book_context):
    record = {
        'recid': '1234',
        'edition': {
            'name': 'Name',
            'remainder': 'Remainder',
            'full': 'Name Remainder'
        }
    }
    converted = record2jsonld(record, book_context)
    assert converted == [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://purl.org/ontology/bibo/edition': [{
            '@value': 'Name Remainder'
        }]
    }]
示例#21
0
def test_jsonld(book_context):
    record = {
        'recid': '1234',
        'series': {
            'name': 'Name',
            'volume': '3',
            'full': 'Name ; 3'
        }
    }
    converted = record2jsonld(record, book_context)
    assert converted == [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://purl.org/dc/terms/bibliographicCitation': [{
            '@value': 'Name ; 3'
        }]
    }]
示例#22
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'meeting': {
             'name': 'Name',
             'location': 'Location',
             'date': '2015',
             'number': '34',
             'full': 'Name 34 2015 Location'
         }
     }
     converted = record2jsonld(record, book_context)
     assert converted == [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://purl.org/dc/elements/1.1/contributor': [{
             '@value': 'Name 34 2015 Location'
         }]
     }]
示例#23
0
def test_first_author_jsonld(book_context):
    record = {
        'recid': '1234',
        'contributor': [{
            'name': 'LastName, FirstName',
            'date': '1971-',
            'role': 'Dir.',
            'affilation': 'Affiliation',
            'full': 'LastName, FirstName 1971-'
        }]
    }
    converted = record2jsonld(record, book_context)
    jsonld = [{
        '@id': 'http://doc.rero.ch/record/1234',
        'http://purl.org/dc/elements/1.1/creator': [{
            '@value': 'LastName, FirstName 1971-'
        }]
    }]
    assert converted == jsonld
示例#24
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'publication': {
             'location': 'Location',
             'publisher': 'Publisher',
             'date': '2015-',
             'print_location': 'Print Location',
             'printer': 'Printer',
             'full': 'Location Publisher 2015- Print Location Printer'
         }
     }
     converted = record2jsonld(record, book_context)
     assert converted == [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://rdaregistry.info/Elements/u/publicationStatement': [{
             '@value': 'Location Publisher 2015- Print Location Printer'
         }]
     }]
示例#25
0
 def test_first_author_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'authors': [{
             'name': 'LastName, FirstName',
             'date': '1971-',
             'role': 'Dir.',
             'affilation': 'Affiliation',
             'full': 'LastName, FirstName 1971-'
         }]
     }
     converted = record2jsonld(record, book_context)
     jsonld = [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://purl.org/dc/elements/1.1/creator': [{
             '@value': 'LastName, FirstName 1971-'
         }]
     }]
     assert converted == jsonld
示例#26
0
def test_jsonld(book_context):
    record = {
        'recid': '1234',
        'collation': {
            'pages': '100 p.',
            'other': 'ill.',
            'dimension': '25 x 30 cm',
            'full': '100 p. ill. 25 x 30 cm'
        }
    }
    converted = record2jsonld(record, book_context)
    assert converted == [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://purl.org/dc/elements/1.1/format': [{
            '@value':
            '100 p. ill. 25 x 30 cm'
        }]
    }]
示例#27
0
def test_jsonld(book_context):
    record = {
        'recid': '1234',
        'other_title': {
            'maintitle': 'Other Title',
            'lang': 'en',
            'full': 'Other Title'
        }
    }
    converted = record2jsonld(record, book_context)
    jsonld = [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://purl.org/dc/terms/alternative': [{
            '@value': 'Other Title',
            '@language': 'en'
        }]
    }]
    assert converted == jsonld
示例#28
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'title': {
             'maintitle': 'Main Title',
             'subtitle': 'Subtitle',
             'lang': 'en',
             'full': 'Main Title Subtitle'
         }
     }
     converted = record2jsonld(record, book_context)
     jsonld = [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://purl.org/dc/terms/title': [{
             '@value': 'Main Title Subtitle',
             '@language': 'en'
         }]
     }]
     assert converted == jsonld
示例#29
0
 def test_jsonld(self, book_context):
     record = {
         'recid': '1234',
         'udc': {
             'code': '004',
             'en': 'Computer science',
             'fr': 'Informatique',
             'de': 'Informatik',
             'it': "Informatique",
             'uri': ['http://udcdata.info/013566']
         }
     }
     converted = record2jsonld(record, book_context)
     jsonld = [{
         '@id': 'http://doc.rero.ch/record/1234',
         'http://purl.org/dc/terms/subject': [{
             '@id': 'http://udcdata.info/013566'
         }]
     }]
     assert converted == jsonld
示例#30
0
def test_jsonld(book_context):
    record = {
        'recid': '1234',
        'meeting': {
            'name': 'Name',
            'location': 'Location',
            'date': '2015',
            'number': '34',
            'full': 'Name 34 2015 Location'
        }
    }
    converted = record2jsonld(record, book_context)
    assert converted == [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://purl.org/dc/elements/1.1/contributor': [{
            '@value':
            'Name 34 2015 Location'
        }]
    }]
示例#31
0
def test_jsonld(book_context):
    record = {
        'recid': '1234',
        'publication': {
            'location': 'Location',
            'publisher': 'Publisher',
            'date': '2015-',
            'print_location': 'Print Location',
            'printer': 'Printer',
            'full': 'Location Publisher 2015- Print Location Printer'
        }
    }
    converted = record2jsonld(record, book_context)
    assert converted == [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://rdaregistry.info/Elements/u/publicationStatement': [{
            '@value':
            'Location Publisher 2015- Print Location Printer'
        }]
    }]
示例#32
0
def test_jsonld(book_context):
    record = {
        'recid': '1234',
        'udc': {
            'code': '004',
            'en': 'Computer science',
            'fr': 'Informatique',
            'de': 'Informatik',
            'it': "Informatique",
            'uri': ['http://udcdata.info/013566']
        }
    }
    converted = record2jsonld(record, book_context)
    jsonld = [{
        '@id':
        'http://doc.rero.ch/record/1234',
        'http://purl.org/dc/terms/subject': [{
            '@id':
            'http://udcdata.info/013566'
        }]
    }]
    assert converted == jsonld
示例#33
0
def test_jsonld(book_context):
    record = {'recid': '1234', 'rero_id': 'http://data.rero.ch/01-R1234'}
    converted = record2jsonld(record, book_context)
    assert converted[0].get('@id') == 'http://doc.rero.ch/record/1234'