Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate proper redirects for specification links that previously existed #172

Open
metatoaster opened this issue Aug 13, 2023 · 0 comments

Comments

@metatoaster
Copy link
Collaborator

Given that the previous site (based on the version from this archive), and that I've been informed by @nickerso that this is an ongoing problem that is being reported (e.g. #170) such that it should be addressed at some point, I've took a cursory look at the framework being used and found relevant documentation.

Given that the site is powered by wowchemy hugo plugin, I assume the netlify can be enabled such that the redirects may happen (as per documentation).

So if all that works as documented, the following redirect configuration should be used so that requests to the currently dead specification links (which has been undoubtedly used in past citations by various published works - hence this problem) be redirected to the intended version on identifiers.org:

# This is a redirect file generated for the Netlify wowchemy plugin for
# the co.mbine.org website.  The following is a list of specifications
# that do not have a corresponding new destination at the GitHub repo:
#
# standards/omex/RC-1
# standards/omex/RC-2
# standards/sed-ml/level-1/version-2/RC2
# standards/sed-ml/level-1/version-2/RC
# standards/sed-ml/proposal/nested-simulations/
# standards/sed-ml/proposal/nested-simulations/FB/version-1
# standards/sed-ml/proposal/nested-simulations/FB/version-2
# standards/sed-ml/proposal/nested-simulations/FB/version-3
# standards/sed-ml/proposal/kisao/RA/version-1
#
# The redirects follow
/standards/biopax                                                     https://identifiers.org/combine.specifications:biopax
/standards/biopax/level-1                                             https://identifiers.org/combine.specifications:biopax.level-1
/standards/biopax/level-2                                             https://identifiers.org/combine.specifications:biopax.level-2
/standards/biopax/level-3                                             https://identifiers.org/combine.specifications:biopax.level-3
/standards/cellml                                                     https://identifiers.org/combine.specifications:cellml
/standards/cellml/1/0                                                 https://identifiers.org/combine.specifications:cellml.1.0
/standards/cellml/1/1                                                 https://identifiers.org/combine.specifications:cellml.1.1
/standards/omex                                                       https://identifiers.org/combine.specifications:omex
/standards/omex/version-1                                             https://identifiers.org/combine.specifications:omex.version-1
/standards/omex-manifest                                              https://identifiers.org/combine.specifications:omex-manifest
/standards/omex-metadata                                              https://identifiers.org/combine.specifications:omex-metadata
/standards/omex-metadata/1/0                                          https://identifiers.org/combine.specifications:omex-metadata.1.0
/standards/gpml                                                       https://identifiers.org/combine.specifications:gpml
/standards/sbgn                                                       https://identifiers.org/combine.specifications:sbgn
/standards/sbgn/af                                                    https://identifiers.org/combine.specifications:sbgn.af
/standards/sbgn/af/level-1/version-1/2                                https://identifiers.org/combine.specifications:sbgn.af.level-1.version-1.2
/standards/sbgn/af/level-1/version-1/2                                https://identifiers.org/combine.specifications:sbgn.af.level-1.version-1.2
/standards/sbgn/af/level-1/version-1/0                                https://identifiers.org/combine.specifications:sbgn.af.level-1.version-1.0
/standards/sbgn/af/level-1/version-1/2                                https://identifiers.org/combine.specifications:sbgn.af.level-1.version-1.2
/standards/sbgn/er                                                    https://identifiers.org/combine.specifications:sbgn.er
/standards/sbgn/er/level-1/version-2                                  https://identifiers.org/combine.specifications:sbgn.er.level-1.version-2
/standards/sbgn/er/level-1/version-1/2                                https://identifiers.org/combine.specifications:sbgn.er.level-1.version-1.2
/standards/sbgn/er/level-1/version-1/0                                https://identifiers.org/combine.specifications:sbgn.er.level-1.version-1.0
/standards/sbgn/er/level-1/version-1/1                                https://identifiers.org/combine.specifications:sbgn.er.level-1.version-1.1
/standards/sbgn/er/level-1/version-1/2                                https://identifiers.org/combine.specifications:sbgn.er.level-1.version-1.2
/standards/sbgn/er/level-1/version-2                                  https://identifiers.org/combine.specifications:sbgn.er.level-1.version-2
/standards/sbgn/pd                                                    https://identifiers.org/combine.specifications:sbgn.pd
/standards/sbgn/pd/level-1/version-1/3                                https://identifiers.org/combine.specifications:sbgn.pd.level-1.version-1.3
/standards/sbgn/pd/level-1/version-1/3                                https://identifiers.org/combine.specifications:sbgn.pd.level-1.version-1.3
/standards/sbgn/pd/level-1/version-1/0                                https://identifiers.org/combine.specifications:sbgn.pd.level-1.version-1.0
/standards/sbgn/pd/level-1/version-1/1                                https://identifiers.org/combine.specifications:sbgn.pd.level-1.version-1.1
/standards/sbgn/pd/level-1/version-1/2                                https://identifiers.org/combine.specifications:sbgn.pd.level-1.version-1.2
/standards/sbgn/pd/level-1/version-1/3                                https://identifiers.org/combine.specifications:sbgn.pd.level-1.version-1.3
/standards/sbml                                                       https://identifiers.org/combine.specifications:sbml
/standards/sbml/level-1/version-2                                     https://identifiers.org/combine.specifications:sbml.level-1.version-2
/standards/sbml/level-1/version-1                                     https://identifiers.org/combine.specifications:sbml.level-1.version-1
/standards/sbml/level-1/version-2                                     https://identifiers.org/combine.specifications:sbml.level-1.version-2
/standards/sbml/level-2/version-5/release-1                           https://identifiers.org/combine.specifications:sbml.level-2.version-5.release-1
/standards/sbml/level-2/version-1                                     https://identifiers.org/combine.specifications:sbml.level-2.version-1
/standards/sbml/level-2/version-2                                     https://identifiers.org/combine.specifications:sbml.level-2.version-2
/standards/sbml/level-2/version-3/release-2                           https://identifiers.org/combine.specifications:sbml.level-2.version-3.release-2
/standards/sbml/level-2/version-3/release-1                           https://identifiers.org/combine.specifications:sbml.level-2.version-3.release-1
/standards/sbml/level-2/version-3/release-2                           https://identifiers.org/combine.specifications:sbml.level-2.version-3.release-2
/standards/sbml/level-2/version-4/release-1                           https://identifiers.org/combine.specifications:sbml.level-2.version-4.release-1
/standards/sbml/level-2/version-4/release-1                           https://identifiers.org/combine.specifications:sbml.level-2.version-4.release-1
/standards/sbml/level-2/version-5/release-1                           https://identifiers.org/combine.specifications:sbml.level-2.version-5.release-1
/standards/sbml/level-2/version-5/RC-1                                https://identifiers.org/combine.specifications:sbml.level-2.version-5.RC-1
/standards/sbml/level-2/version-5/release-1                           https://identifiers.org/combine.specifications:sbml.level-2.version-5.release-1
/standards/sbml/level-3/version-2/core/release-2                      https://identifiers.org/combine.specifications:sbml.level-3.version-2.core.release-2
/standards/sbml/level-3/version-1/core/release-3                      https://identifiers.org/combine.specifications:sbml.level-3.version-1.core.release-3
/standards/sbml/level-3/version-1/core/release-3                      https://identifiers.org/combine.specifications:sbml.level-3.version-1.core.release-3
/standards/sbml/level-3/version-1/core/release-1                      https://identifiers.org/combine.specifications:sbml.level-3.version-1.core.release-1
/standards/sbml/level-3/version-1/core/release-2                      https://identifiers.org/combine.specifications:sbml.level-3.version-1.core.release-2
/standards/sbml/level-3/version-1/core/release-3                      https://identifiers.org/combine.specifications:sbml.level-3.version-1.core.release-3
/standards/sbml/level-3/version-2/                                    https://identifiers.org/combine.specifications:sbml.level-3.version-2.core
/standards/sbml/level-3/version-2/core/release-1                      https://identifiers.org/combine.specifications:sbml.level-3.version-2.core.release-1
/standards/sbml/level-3/version-2/core/release-2                      https://identifiers.org/combine.specifications:sbml.level-3.version-2.core.release-2
/specifications/sbml.level-3.version-1.distrib                        https://identifiers.org/combine.specifications:sbml.level-3.version-1.distrib
/specifications/sbml.level-3.version-1.distrib.version-1              https://identifiers.org/combine.specifications:sbml.level-3.version-1.distrib.version-1
/specifications/sbml.level-3.version-1.distrib.version-1.release-1    https://identifiers.org/combine.specifications:sbml.level-3.version-1.distrib.version-1.release-1
/standards/sbml/level-3/version-1/fbc/version-1/release-1             https://identifiers.org/combine.specifications:sbml.level-3.version-1.fbc.version-1.release-1
/standards/sbml/level-3/version-1/fbc/version-1/release-1             https://identifiers.org/combine.specifications:sbml.level-3.version-1.fbc.version-1.release-1
/standards/sbml/level-3/version-1/fbc/version-1/release-1             https://identifiers.org/combine.specifications:sbml.level-3.version-1.fbc.version-1.release-1
/standards/sbml/level-3/version-1/fbc/version-2/release-1             https://identifiers.org/combine.specifications:sbml.level-3.version-1.fbc.version-2.release-1
/standards/sbml/level-3/version-1/fbc/version-2/release-1             https://identifiers.org/combine.specifications:sbml.level-3.version-1.fbc.version-2.release-1
/standards/sbml/level-3/version-1/groups/version-1/release-1          https://identifiers.org/combine.specifications:sbml.level-3.version-1.groups.version-1.release-1
/standards/sbml/level-3/version-1/groups/version-1/release-1          https://identifiers.org/combine.specifications:sbml.level-3.version-1.groups.version-1.release-1
/standards/sbml/level-3/version-1/groups/version-1/release-1          https://identifiers.org/combine.specifications:sbml.level-3.version-1.groups.version-1.release-1
/standards/sbml/level-3/version-1/comp/version-1/release-2            https://identifiers.org/combine.specifications:sbml.level-3.version-1.comp.version-1.release-2
/standards/sbml/level-3/version-1/comp/version-1/release-2            https://identifiers.org/combine.specifications:sbml.level-3.version-1.comp.version-1.release-2
/standards/sbml/level-3/version-1/comp/version-1/release-1            https://identifiers.org/combine.specifications:sbml.level-3.version-1.comp.version-1.release-1
/standards/sbml/level-3/version-1/comp/version-1/release-2            https://identifiers.org/combine.specifications:sbml.level-3.version-1.comp.version-1.release-2
/standards/sbml/level-3/version-1/layout/version-1/release-1          https://identifiers.org/combine.specifications:sbml.level-3.version-1.layout.version-1.release-1
/standards/sbml/level-3/version-1/layout/version-1/release-1          https://identifiers.org/combine.specifications:sbml.level-3.version-1.layout.version-1.release-1
/standards/sbml/level-3/version-1/layout/version-1/release-1          https://identifiers.org/combine.specifications:sbml.level-3.version-1.layout.version-1.release-1
/standards/sbml/level-3/version-1/multi                               https://identifiers.org/combine.specifications:sbml.level-3.version-1.multi
/standards/sbml/level-3/version-1/multi/version-1                     https://identifiers.org/combine.specifications:sbml.level-3.version-1.multi.version-1
/standards/sbml/level-3/version-1/multi/version-1/release-1           https://identifiers.org/combine.specifications:sbml.level-3.version-1.multi.version-1.release-1
/standards/sbml/level-3/version-1/multi/version-1/release-2           https://identifiers.org/combine.specifications:sbml.level-3.version-1.multi.version-1.release-2
/standards/sbml/level-3/version-1/qual/version-1/release-1            https://identifiers.org/combine.specifications:sbml.level-3.version-1.qual.version-1.release-1
/standards/sbml/level-3/version-1/qual/version-1/release-1            https://identifiers.org/combine.specifications:sbml.level-3.version-1.qual.version-1.release-1
/standards/sbml/level-3/version-1/qual/version-1/release-1            https://identifiers.org/combine.specifications:sbml.level-3.version-1.qual.version-1.release-1
/standards/sbml/level-3/version-1/render/version-1/release-1          https://identifiers.org/combine.specifications:sbml.level-3.version-1.render.version-1.release-1
/standards/sbml/level-3/version-1/render/version-1/release-1          https://identifiers.org/combine.specifications:sbml.level-3.version-1.render.version-1.release-1
/standards/sbml/level-3/version-1/render/version-1/release-1          https://identifiers.org/combine.specifications:sbml.level-3.version-1.render.version-1.release-1
/standards/sbol                                                       https://identifiers.org/combine.specifications:sbol
/standards/sbol/version-1.1.0                                         https://identifiers.org/combine.specifications:sbol.version-1.1.0
/standards/sbol/version-2.0.0                                         https://identifiers.org/combine.specifications:sbol.version-2.0.0
/standards/sbol/version-2.0.1                                         https://identifiers.org/combine.specifications:sbol.version-2.0.1
/standards/sbol/version-2.1.0                                         https://identifiers.org/combine.specifications:sbol.version-2.1.0
/standards/sbol/version-2.2.0                                         https://identifiers.org/combine.specifications:sbol.version-2.2.0
/standards/sbol-visual                                                https://identifiers.org/combine.specifications:sbol-visual
/standards/sbol-visual/version-1.0.0                                  https://identifiers.org/combine.specifications:sbol-visual.version-1.0.0
/standards/sbol-visual/version-2.0                                    https://identifiers.org/combine.specifications:sbol-visual.version-2.0.0
/standards/sed-ml                                                     https://identifiers.org/combine.specifications:sed-ml
/standards/sed-ml/level-1/version-3                                   https://identifiers.org/combine.specifications:sed-ml.level-1.version-3
/standards/sed-ml/level-1/version-1                                   https://identifiers.org/combine.specifications:sed-ml.level-1.version-1
/standards/sed-ml/level-1/version-2                                   https://identifiers.org/combine.specifications:sed-ml.level-1.version-2
/standards/sed-ml/level-1/version-3                                   https://identifiers.org/combine.specifications:sed-ml.level-1.version-3
/standards/teddy                                                      https://identifiers.org/combine.specifications:teddy
/standards/teddy/rel-2014-04-24                                       https://identifiers.org/combine.specifications:teddy.rel-2014-04-24

Note the beginning of the file - there are specifications that do not seem to map to a corresponding specification as per that repository, so that's been left alone for now, but the rest should work. The above file was produced using this hacked together Python script:

from bs4 import BeautifulSoup
from os import listdir
import requests

spec_id_fix = {
    'sbol-visual.version-2.0': 'sbol-visual.version-2.0.0',
    'sbml.level-3.version-2.': 'sbml.level-3.version-2.core',
}

def normlink(link):
    spec_id = link.split('/', 2)[2].replace('/', '.')
    return spec_id_fix.get(spec_id, spec_id)

r = requests.get("http://old_co.mbine.org/standards/specifications")
soup = BeautifulSoup(r.content, features="lxml")
anchors = soup.select("div#content table td a.freelinking")

# prepared using:
# git clone https://github.com/combine-org/combine-specifications
files = set(listdir("combine-specifications/specifications/"))

# not found in the github repo
missing_spec = []
redirect_map = []
new_prefix = 'https://identifiers.org/combine.specifications:'
maxlen = 0

for anchor in anchors:
    link = anchor['href']
    normalised = normlink(link)
    if normalised + '.md' not in files:
        missing_spec.append(anchor.text)
    else:
        maxlen = max(maxlen, len(link))
        redirect_map.append((link, new_prefix + normalised))

print(f"""
# This is a redirect file generated for the Netlify wowchemy plugin for
# the co.mbine.org website.  The following is a list of specifications
# that do not have a corresponding new destination at the GitHub repo:
#
{ chr(10).join('# %s' % target for target in missing_spec) }
#
# The redirects follow
{ chr(10).join(orig.ljust(maxlen + 4) + dest for orig, dest in redirect_map) }
""")

Hopefully this gets far enough for whoever that has the ability to build/deploy the website to generate those redirects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant