%run -i ../startup.py
ENTITY_TYPE = 'release-group'
endpoint='http://data.bnf.fr/sparql'
Last notebook update: 2021-02-08
Importing libs
Defining database parameters
Defining *sql* helper function
Last database update: 2021-01-13
Defining *sparql* helper function
# linked to MB RG
bnf_entity_count(ENTITY_TYPE)
205
links_from_bnf = sparql(f"""
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT (?rg AS ?bnf) ?mbid ?name
WHERE
""", endpoint='http://data.bnf.fr/sparql')
print('Count:', len(links_from_bnf))
display_df(links_from_bnf.head())
Count: 205
bnf | mbid | name | |
---|---|---|---|
0 | cb121110184 | da9d7460-395c-3b3a-92fa-4b15e8680bb3 | Zur Psychopathologie des Alltagslebens |
1 | cb13915256q | dca4865a-9d5e-3bf1-acd0-13cfe8f6f8f7 | Don Giovanni. KV 527 |
2 | cb119446876 | 5fc2d466-e22d-4460-806a-76cb08c893f5 | The Canterbury tales |
3 | cb16599036w | 0611a3fa-2e9d-3bbf-871f-f264c6bf1561 | StarCraft : jeu vidéo |
4 | cb13177432m | 6d1a8775-9814-393d-91ca-e6fc46945eb1 | Le cinquième élément : film |
links_to_add_to_mb = links_from_bnf
links_to_add_to_mb['edit_link'] = links_to_add_to_mb.apply(
mb_releasegroup_edit_bnf_link, axis=1)
print('Count:', len(links_to_add_to_mb))
display_df(links_to_add_to_mb.head())
Count: 205
bnf | mbid | name | edit_link | |
---|---|---|---|---|
0 | cb121110184 | da9d7460-395c-3b3a-92fa-4b15e8680bb3 | Zur Psychopathologie des Alltagslebens | edit |
1 | cb13915256q | dca4865a-9d5e-3bf1-acd0-13cfe8f6f8f7 | Don Giovanni. KV 527 | edit |
2 | cb119446876 | 5fc2d466-e22d-4460-806a-76cb08c893f5 | The Canterbury tales | edit |
3 | cb16599036w | 0611a3fa-2e9d-3bbf-871f-f264c6bf1561 | StarCraft : jeu vidéo | edit |
4 | cb13177432m | 6d1a8775-9814-393d-91ca-e6fc46945eb1 | Le cinquième élément : film | edit |
import jinja2
template = jinja2.Template("""
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Alignment of MusicBrainz and BNF Release Groups</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body style="margin: 20px;">
<h1>Alignment of MusicBrainz and BNF Release Groups</h1>
<p>Latest MB database update: </p>
<p>Latest update: </p>
<ol>
<li>
<a href="#bnf2mb">Add missing BNF links to MusicBrainz</a>
( rows)
</li>
</ol>
<h2 id="bnf2mb">Add missing BNF links to MusicBrainz</h2>
</body>
</html>
""")
with open('../docs/bnf-releasegroups-report.html', 'w') as f:
f.write(template.render(**globals())
.replace('<', '<').replace('>', '>')
.replace('class="dataframe"', 'class="table table-striped table-hover table-sm"')
.replace('thead', 'thead class="thead-light"'))