{% extends "prose.html" %}

{% block title %}Related{% endblock %}

{% macro render_circle(value) -%}
    {{ schema_status_map[value] }}
{% endmacro %}

{% block styles %}
    {{ super() }}
    <!-- DataTables, see: https://datatables.net/examples/styling/bootstrap4.html-->
    <link
            rel="stylesheet"
            href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css"
    />
{% endblock %}

{% block scripts %}
    {{ super() }}
    <!-- DataTables, see: https://datatables.net/examples/styling/bootstrap4.html-->
    <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
    <script>
        $(document).ready(function () {
            $("#comparison").DataTable({
                scrollX: true,
                "order": [[1, "desc"]]
            });
        });
    </script>
{% endblock %}

{% block content %}
    <h2>Comparison of Registry Schemata</h2>
    <p>
        An overview on registries covering biomedical ontologies, controlled vocabularies, and databases.
    </p>
    <p>
        A 🟢 means the field is required. A 🟡 means it is part of the schema, but not required or incomplete on some
        entries. A 🔴 means that it is not part of the metadata schema. The FAIR column denotes that a structured dump
        of the data is easily findable, accessible, and in a structured format in bulk. For lookup services, some fields
        (i.e., Example ID, Default Provider, Alternate Providers) are omitted because inclusion would be redundant. The
        search column means there is a URL into which a search query can be formatted to show a list of results. The
        provider column means there is a URL into which a prefix can be formatted to show a dedicated page for its
        metadata.</p>
    <p>
        <b>Caveats:</b> Several of Wikidata's fields can be accessed indirectly with alternative SPARQL queries.
        BioPortal's data is locked behind an API that requires a key and has rate limited access. The Crop Ontology
        Curation Tool does not list homepages because it is the homepage itself. Non-english language registries in the
        OntoPortal Alliance were not included.
    </p>
    <table id="comparison" class="table table-striped table-hover table-sm">
        <thead>
        <tr>
            <th>Registry</th>
            <th>Score</th>
            <th>Name</th>
            <th>Homepage</th>
            <th>Description</th>
            <th>Example</th>
            <th>Pattern</th>
            <th>Provider</th>
            <th>Alternate Providers</th>
            <th>Alternate Prefixes</th>
            <th>License</th>
            <th>Version</th>
            <th>Contact</th>
            <th>FAIR</th>
            <th>Search</th>
            <th>Provider</th>
            <th>Resolver</th>
            <th>Lookup</th>
        </tr>
        </thead>
        <tbody>
        {% for registry in registries %}
            <tr>
                <td><a href="{{ url_for('ui.metaresource', metaprefix=registry.prefix) }}">{{ registry.name }}</a></td>
                <td style="text-align: right;">{{ registry.score() }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.name) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.homepage) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.description) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.example) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.pattern) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.provider) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.alternate_providers) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.synonyms) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.license) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.version) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.contact) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.fair) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.availability.search) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.provider_uri_format is not none) }}</td>
                <td style="text-align: center;">{{ render_circle(registry.resolver_uri_format is not none and registry.resolver_type == "redirect") }}</td>
                <td style="text-align: center;">{{ render_circle(registry.resolver_uri_format is not none and registry.resolver_type == "lookup") }}</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

    <h2>Conversion between CURIEs and IRIs</h2>
    <p>
        The semantic web and ontology communities are bound to the use of IRIs as identifiers and therefore are very
        interested in the interconversion between compact identifiers (i.e., CURIEs) and IRIs. While the Bioregistry
        provides many tools for one way conversion from CURIEs to IRIs, there are several related packages that help
        parse CURIEs from IRIs:
    </p>
    <ul>
        <li>
            The <a href="https://www.npmjs.com/package/@geneontology/dbxrefs">@geneontogy/dbxrefs</a> Node.js package
            translates CURIEs into URLs using the Gene Ontology Registry.
        </li>
        <li>
            The <a href="https://github.com/geneontology/curie-util-py">curie-util-py</a> Python package more generally
            loads JSON-LD files to convert between IRIs and CURIEs.
        </li>
        <li>
            The <a href="https://github.com/prefixcommons/biocontext">BioContext</a> Python package generates URIs from
            CURIEs based on information from the OBO Registry, Identifiers.org, the Gene Ontology Registry, and from the
            Monarch Initiative. This package makes several assumptions about what the "correct" IRIs are in the
            "semantic web".
        </li>
    </ul>
{% endblock %}
