Skip to content

Commit

Permalink
html output: added metadata validation rating in table view and on sp…
Browse files Browse the repository at this point in the history
…ecific software pages (CLARIAH/clariah-plus#50)
  • Loading branch information
proycon committed Aug 22, 2022
1 parent 79582da commit 0abd8a2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion codemeta/serializers/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def serialize_to_html( g: Graph, res: Union[Sequence,URIRef,None], args: AttribD
else:
index = get_index(g)
template = env.get_template(template)
return template.render(g=g,res=res, SDO=SDO,CODEMETA=CODEMETA, CODEMETAPY=CODEMETAPY, RDF=RDF,RDFS=RDFS,STYPE=SOFTWARETYPES, REPOSTATUS=REPOSTATUS, SKOS=SKOS, get_triples=get_triples, type_label=type_label, css=args.css, contextgraph=contextgraph, URIRef=URIRef, get_badge=get_badge, now=datetime.now().strftime("%Y-%m-%d %H:%M:%S"), index=index, get_interface_types=get_interface_types,baseuri=args.baseuri,baseurl=args.baseurl, toolstore=args.toolstore, get_last_component=get_last_component, is_resource=is_resource, int=int, range=range, **kwargs)
return template.render(g=g,res=res, SDO=SDO,CODEMETA=CODEMETA, CODEMETAPY=CODEMETAPY, RDF=RDF,RDFS=RDFS,STYPE=SOFTWARETYPES, REPOSTATUS=REPOSTATUS, SKOS=SKOS, get_triples=get_triples, type_label=type_label, css=args.css, contextgraph=contextgraph, URIRef=URIRef, get_badge=get_badge, now=datetime.now().strftime("%Y-%m-%d %H:%M:%S"), index=index, get_interface_types=get_interface_types,baseuri=args.baseuri,baseurl=args.baseurl, toolstore=args.toolstore, get_last_component=get_last_component, is_resource=is_resource, int=int, range=range, Literal=Literal, **kwargs)



19 changes: 4 additions & 15 deletions codemeta/templates/item_softwaresourcecode.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,10 @@
<span class="negative" title="No development status was provided nor could be extracted automatically">unknown</span>
{% endif %}

{% for _,_,review in g.triples((res, SDO.review,None)) %}
{% if (review, SDO.name, Literal("Automatic software metadata validation report") in g %}
{% set rating = int(g.value(review, SDO.rating)) %}
<br/>
<span class="rating{{ rating }}" title="Automatic software metadata rating, click to inspect validation report">
<a href="{{ review }}">
{% for _ in range(0, rating) %}
&starf;
{% endfor %}
{% for _ in range(rating, 5) %}
&star;
{% endfor %}
</a>
</span>
{% endif %}
{% if g.value(sscres, SDO.review) %}
{% set sscres = res %}
<br/>
{% include 'validationrating.html' %}
{% endif %}

{% if (res, CODEMETAPY.errors, None) in g and int(g.value(res, CODEMETAPY.errors)) > 0 %}
Expand Down
8 changes: 8 additions & 0 deletions codemeta/templates/softwaresourcecode.html
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,13 @@ <h3>Properties</h3>
</dd>
{% endif %}

{% if g.value(sscres, SDO.review) %}
<dt class="review" title="Rating of the quality and completeness of this software metadata, based on automatic validation. Click the stars for the full validation report. Note that this is not a judgement on the suitability of the software for any particular task.">Metadata validation</dt>
<dd class="review">
{% include 'validationrating.html' %}
</dd>
{% endif %}

{% if g.value(sscres, SDO.dateCreated) %}
<dt class="dateCreated" title="The date and time at which the software (all versions) was first created">Created</dt>
<dd class="dateCreated">
Expand All @@ -425,6 +432,7 @@ <h3>Properties</h3>
</dd>
{% endif %}


</dl>
</div>

Expand Down
17 changes: 17 additions & 0 deletions codemeta/templates/validationrating.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% for _,_,review in g.triples((sscres, SDO.review,None)) %}
{% if (review, SDO.name, Literal("Automatic software metadata validation report")) in g %}
{% if g.value(review, SDO.reviewRating) %}
{% set rating = int(g.value(review, SDO.reviewRating)) %}
<span class="rating{{ rating }}" title="Automatic software metadata rating, click to inspect validation report">
<a href="{{ review }}">
{% for _ in range(0, rating) %}
&starf;
{% endfor %}
{% for _ in range(rating, 5) %}
&star;
{% endfor %}
</a>
</span>
{% endif %}
{% endif %}
{% endfor %}

0 comments on commit 0abd8a2

Please sign in to comment.