<div about="{{ res }}" class="card softwaresourcecode" typeof="schema:SoftwareSourceCode">
    <div class="topbar">
        <div class="interface">
            <ul>
            {% for label, comment in get_interface_types(g, res, contextgraph,fallback=True) %}
            {% if label != "Unknown" %}
            <li{% if comment %} title="{{ comment }}"{% endif %}>{{ label }}</li>
            {% endif %}
            {% endfor %}
            </ul>
        </div>

        <div class="developmentStatus" property="codemeta:developmentStatus">
            <ul>
            {% for _,_, devstatres in g.triples((res, CODEMETA.developmentStatus, None)) %}
            {% include 'developmentstatus.html' %}
            {% endfor %}
            </ul>
        </div>
    </div>

    {% if (res, SDO.thumbnailUrl, None) in g %}
    <img class="thumbnail" src="{{ g.value(res, SDO.thumbnailUrl) }}" alt="thumbnail/logo" />
    {% endif %}

    <h2>
        <span class="name" property="schema:name">
        {% if baseuri and toolstore %}
        <a href="{{ res }}" title="Go to the overview page for this tool">
        {% endif %}
        {% if g.value(res, SDO.name) %}
        {{ g.value(res, SDO.name) }}
        {% else %}
        {{ g.value(res, SDO.identifier) }}
        {% endif %}
        {% if baseuri %}
        </a>
        {% endif %}
        </span>
        <span class="version">
            {% if  (res, SDO.version, None) in g %}
            {% if g.value(res, SDO.releaseNotes) %}
            <a rel="schema:releaseNotes" href="{{ g.value(res, SDO.releaseNotes) }}" title="release notes for this version">
            {% endif %}
            <span property="schema:version">{{ g.value(res, SDO.version) }}</a>
            {% if g.value(res, SDO.releaseNotes) %}
            </a>
            {% endif %}
            {% endif %}
        </span>
    </h2>

    {% if (res, SDO.author, None) in g %}
    <div class="author">
        <ul>
         {% for label, pores in get_triples(g, res, SDO.author) %}
         <li{% if (res, SDO.maintainer, pores) in g %} class="maintainer"{% endif %}>{% include 'person_or_org_minimal.html' %}</li>
         {% endfor %}
        </ul>
    </div>
    {% endif %}

    {% if (res, SDO.producer, None) in g %}
    <div class="producer">
        <ul>
         {% for label, pores in get_triples(g, res, SDO.producer) %}
         <li>{% include 'person_or_org.html' %}</li>
         {% endfor %}
        </ul>
    </div>
    {% endif %}

    <div class="description">
        {% if  (res, SDO.description, None) in g %}
        <em property="schema:description">{{ g.value(res, SDO.description) }}</em> {% if baseuri %}[<a href="{{ res }}">view more</a>]{% endif %}
        {% else %}
        <span class="negative">No description provided</span>
        {% endif %}

    </div>



    {% if (res, SDO.applicationCategory, None) in g %}
    <div class="category">
        <i class="fa fa-sitemap" title="Category"></i> <ul>
         {% for label, _ in get_triples(g, res, SDO.applicationCategory, abcsort=True) %}
            <li property="schema:applicationCategory">{{ label }}</li>
         {% endfor %}
        </ul>
    </div>
    {% endif %}

    {% if (res, SDO.keywords, None) in g %}
    <div class="keywords">
        <i class="fa fa-tags" title="Keywords"></i> <ul>
         {% for label, _ in get_triples(g, res, SDO.keywords, abcsort=True) %}
            <li property="schema:keywords">{{ label }}</li>
         {% endfor %}
         </ul>
    </div>
    {% endif %}

    {% if (res, SDO.targetPlatform, None) in g or (res, SDO.operatingSystem, None) in g %}
    <div class="targetplatforms">
        <i class="fa fa-cogs" title="Target platform"></i> <ul>
         {% for label in get_target_platforms(g, res) %}
            <li>{{ label }}</li>
         {% endfor %}
         </ul>
    </div>
    {% endif %}

    <div class="minilinks">
        {% for _,_, license in g.triples((res, SDO.license, None)) %}
        {% if (license, SDO.name, None) in contextgraph %}
            <a href="{{ license }}"><i class="fa fa-copyright" title="License: {{ contextgraph.value(license, SDO.name) }}"></i></a>
        {% elif license.startswith("http") %}
            <a href="{{ license }}"><i class="fa fa-copyright" title="License: {{ license }}"></i></a>
        {% else %}
            <i class="fa fa-copyright" title="License: {{ license }}"></i>
        {% endif %}
        {% endfor %}

        {% for _,_, readme in g.triples((res, CODEMETA.readme, None)) %}
            <a href="{{ readme }}"><i class="fa fa-file" title="Readme"></i></a>
        {% endfor %}
        {% for _,_, file in g.triples((res, CODEMETA.buildInstructions, None)) %}
            <a href="{{ file }}"><i class="fa fa-file" title="Build Instructions"></i></a>
        {% endfor %}
        {% for _,_, res2 in g.triples((res, SDO.softwareHelp, None)) %}
            {% if g.value(res2, SDO.name) and g.value(res2, SDO.url) %}
            <a href="{{ g.value(res2, SDO.url) }}"><i class="fa fa-book" title="Documentation: {{ g.value(res2, SDO.name) }}"></i></a>
            {% elif g.value(res2, SDO.url) %}
            <a href="{{ g.value(res2, SDO.url) }}"><i class="fa fa-book" title="Documentation: {{ g.value(res2, SDO.url) }}"></i></a>
            {% endif %}
        {% endfor %}
        {% for _,_, ciurl in g.triples((res, CODEMETA.contIntegration, None)) %}
            <a href="{{ ciurl }}"><i class="fa fa-check" title="Continuous Integration (icon not indicative of results!)"></i></a>
        {% endfor %}
        {% for _,_, res2 in g.triples((res, SDO.documentation, None)) %}
            {% if g.value(res2, SDO.name) and g.value(res2, SDO.url) %}
            <a href="{{ g.value(res2, SDO.url) }}"><i class="fa fa-book" title="Documentation: {{ g.value(res2, SDO.name) }}"></i></a>
            {% elif g.value(res2, SDO.url) %}
            <a href="{{ g.value(res2, SDO.url) }}"><i class="fa fa-book" title="Documentation: {{ g.value(res2, SDO.url) }}"></i></a>
            {% endif %}
        {% endfor %}
        {% for title, res2 in get_triples(g, res, CODEMETA.referencePublication) %}
            {% if res2 and g.value(res2, SDO.url) %}
            <a href="{{ g.value(res2, SDO.url) }}"><i class="fa fa-quote-right" title="Reference Publication: {{ title }}"></i></a>
            {% else %}
            <i class="fa fa-quote-right" title="Reference Publication: {{ title }}"></i>
            {% endif %}
        {% endfor %}
        {% for title, res2 in get_triples(g, res, SDO.citation) %}
            {% if res2 and g.value(res2, SDO.url) %}
            <a href="{{ g.value(res2, SDO.url) }}"><i class="fa fa-quote-right" title="Reference Publication: {{ title }}"></i></a>
            {% else %}
            <i class="fa fa-quote-right" title="Reference Publication: {{ title }}"></i>
            {% endif %}
        {% endfor %}
        {% for label, res2 in get_triples(g, res, CODEMETA.funding, abcsort=True) %}
            {% if res2 and g.value(res2, SDO.url) %}
                <a href="{{ g.value(res2, SDO.url) }}"><i class="fa fa-dollar-sign" title="Funding: {{ label }}"></i></a>
            {% else %}
                <i class="fa fa-dollar-sign" title="Funding: {{ label }}"></i>
            {% endif %}
        {% endfor %}
        {% for label, res2 in get_triples(g, res, SDO.funder, abcsort=True) %}
            {% if res2 and g.value(res2, SDO.url) %}
                <a href="{{ g.value(res2, SDO.url) }}"><i class="fa fa-dollar-sign" title="Funding: {{ label }}"></i></a>
            {% else %}
                <i class="fa fa-dollar-sign" title="Funding: {{ label }}"></i>
            {% endif %}
        {% endfor %}
        {% for _,_,review in g.triples((res, SDO.review,None)) %}
          {% if str(g.value(review, SDO.name)).startswith("Automatic software metadata validation report") %}
            {% set rating = int(g.value(review, SDO.reviewRating)) %}
            <span class="rating{{ rating }}" title="Automatic software metadata rating {{rating}}/5, click to inspect validation report">
            <a href="{{ review }}">
            <i class="fa fa-star"></i>
            </a>
            </span>
          {% endif %}
        {% endfor %}
    </div>

    <div class="links">
        <ul>
        {% for _,_, value in g.triples((res, SDO.url, None)) %}
        {% if str(value).find("/pypi.org") != -1 %} <li><i class="fa fa-box"></i>&nbsp;<a rel="schema:url" href="{{ value }}" title="This is the project's entry in the Python Package Index">Package website (Python Package Index)</a></li>
        {% elif str(value).find("/crates.io") != -1 %}
        <li><i class="fa fa-box"></i>&nbsp;<a rel="schema:url" href="{{ value }}" title="This is the project's entry on crates.io">Package website (crates.io)</a></li>
        {% elif str(value).find("npmjs.com") != -1 %}
        <li><i class="fa fa-box"></i>&nbsp;<a rel="schema:url" href="{{ value }}" title="This is the project's entry on npmjs.com">Package website (npm)</a></li>
        {% elif str(value).find("maven.org") != -1 %}
        <li><i class="fa fa-box"></i>&nbsp;<a rel="schema:url" href="{{ value }}" title="This is the project's entry on Maven Central">Package website (maven)</a></li>
        {% elif str(value).find("/readthedocs.io") != -1 or str(value).find("/readthedocs.org") != -1%}
        <li><i class="fa fa-book"></i>&nbsp;<a rel="schema:url" href="{{ value }}" title="This is the project's entry on readthedocs">Documentation website</a></li>
        {% elif value != g.value(res, SDO.codeRepository) %}
        <li><i class="fa fa-home"></i>&nbsp;<a rel="schema:url" href="{{ value }}" title="This is the project website associated with this software">Website</a></li>
        {% endif %}
        {% endfor %}
        {% if  (res, SDO.codeRepository, None) in g %}
        <li><i class="fa fa-code-branch"></i>&nbsp;<a rel="schema:codeRepository" href="{{ g.value(res, SDO.codeRepository) }}" title="Here you can find the source code of this software. This is geared towards technical users who want to install the software themselves.">Source code</a></li>
        {% endif %}

        {% for _,_,targetres in g.triples((res, SDO.targetProduct, None)) %}
        {% if g.value(targetres, SDO.name) or g.value(targetres, STYPE.executableName) or g.value(targetres, SDO.url) %}

            {% if (targetres, RDF.type, SDO.WebApplication) in g or
              (targetres, RDF.type, SDO.WebSite) in g or
              (targetres, RDF.type, SDO.NotebookApplication) in g or
              (targetres, RDF.type, SDO.WebPage) in g %}

                {% if (targetres, SDO.url, None) in g %}
                <li class="go">
                    <i class="fa fa-globe"></i>
                    <a rel="schema:url" href="{{ g.value(targetres, SDO.url) }}">
                        <strong>Go to {{ g.value(targetres, SDO.name) }}</strong> <em>({{ type_label(g, targetres) }})</em>
                        <tt>{{ g.value(targetres, SDO.url) }}</tt>
                    </a>
                    {% if (targetres, SDO.description, None) in g %}
                    <span class="description">{{ g.value(targetres, SDO.description) }}</span>
                    {% endif %}
                </li>
                {% endif %}

            {% elif (targetres, RDF.type, SDO.WebAPI) in g %}

                {% if (targetres, SDO.url, None) in g %}
                <li>
                    <i class="fa fa-cog"></i>
                    <a rel="schema:url" href="{{ g.value(targetres, SDO.url) }}">
                        Web API: {{ g.value(targetres, SDO.name) }}
                        <tt>{{ g.value(targetres, SDO.url) }}</tt>
                    </a>
                    {% if (targetres, SDO.description, None) in g %}
                    <span class="description">{{ g.value(targetres, SDO.description) }}</span>
                    {% endif %}
                </li>
                {% endif %}

            {% endif %}


        {% endif %}
        {% endfor %}

        </ul>
    </div>

    {% if  (res, SDO.dateCreated, None) in g %}
    <div class="dateCreated">
        Created: <span class="dateCreated" property="schema:dateCreated" title="Date at which the first verison was created">{{ g.value(res, SDO.dateCreated).split("T")[0]}}</span>
    </div>
    {% endif %}

    {% if  (res, SDO.dateModified, None) in g %}
    <div class="dateModified">
        Modified: <span class="dateModified" property="schema:dateModified" title="Date at which this version was last modified">{{ g.value(res, SDO.dateModified).split("T")[0] }}</span>
    </div>
    {% endif %}

</div>

