Use labels instead of local names in build script and template

This commit is contained in:
Peter Desmet 2017-10-12 12:26:07 -04:00
parent f48b137f8f
commit 20b9d8a0d0
2 changed files with 14 additions and 16 deletions

View File

@ -136,10 +136,10 @@ class DwcDigester(object):
". Terms only in terms_config.csv: ", cf_terms]))
@staticmethod
def split_iri(term_iri):
"""split an iri field into the namespace url and the term itself"""
"""split an iri field into the namespace url and the local name of the term"""
prog = re.compile("(.*/)([^/]*$)")
namespace, term = prog.findall(term_iri)[0]
return namespace, term
namespace, local_name = prog.findall(term_iri)[0]
return namespace, local_name
@staticmethod
def resolve_namespace_abbrev(namespace):
@ -160,9 +160,8 @@ class DwcDigester(object):
vs_term = self._select_versions_term(term_iri)
term_data = {}
_, term_data["name"] = self.split_iri(term_iri)
term_data["iri"] = term_iri
term_data["label"] = vs_term['label']
term_data["iri"] = term_iri
term_data["class"] = cf_term['organized_in']
term_data["definition"] = self.convert_link(vs_term['definition'])
term_data["comments"] = self.convert_link(self.convert_code(cf_term['comments']))
@ -213,9 +212,8 @@ class DwcDigester(object):
in_class = "Record-level"
# sequence matters in config and it starts with Record-level which we populate here ad-hoc
class_group = {}
class_group["name"] = "Record-level"
class_group["iri"] = None
class_group["label"] = "Record-level"
class_group["iri"] = None
class_group["class"] = None
class_group["definition"] = None
class_group["comments"] = None
@ -267,7 +265,7 @@ class DwcDigester(object):
term_data = self.get_term_definition(term['term_iri'])
if (term_data["rdf_type"] == "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" and
term["flags"] == "simple"):
properties.append(term_data["name"])
properties.append(term_data["label"])
return properties
def create_dwc_list(self, file_output="../dist/simple_dwc_vertical.csv"):

View File

@ -49,7 +49,7 @@
<ul class="nav flex-md-column nav-pills">
#for $group in $groups
<li class="nav-item">
<a class="nav-link py-1" href="#$group.name">$group.name</a><!-- anchor to group -->
<a class="nav-link py-1" href="#$group.label">$group.label</a><!-- anchor to group -->
</li>
#end for
</ul>
@ -61,11 +61,11 @@
<p class="lead">This page provides a list of all currently recommended terms of the Darwin Core standard. Categories such as <code>Occurrence</code>, <code>Event</code> correspond to Darwin Core classes, which group other terms. Convenient <a href="https://github.com/tdwg/dwc/tree/master/dist"> files of these terms</a> and <a href="https://github.com/tdwg/dwc/blob/master/vocabulary/term_versions.csv"> their full history</a> can be found in the <a href="https://github.com/tdwg/dwc">Darwin Core repository</a>.</p>
#for $group in $groups
<section id="$group.name" class="anchor mb-4"><!-- anchor to group -->
<h2>$group.name</h2>
<div class="my-4 group-terms">
<section id="$group.label" class="anchor mb-4"><!-- anchor to group -->
<h2>$group.label</h2>
<div class="my-4">
#for $term in $group.terms
<a class="btn btn-sm btn-outline-dark m-1" href="#$term.namespace:$term.name">$term.name</a><!-- link to term -->
<a class="btn btn-sm btn-outline-dark m-1" href="#$term.namespace:$term.label">$term.label</a><!-- link to term -->
#end for
</div>
@ -73,7 +73,7 @@
## The above will exclude the Record-level group
<table class="table table-sm border mb-3">
<tbody>
<tr class="table-primary"><th colspan="2">$group.name <span class="badge badge-primary float-right">Class</span></th></tr>
<tr class="table-primary"><th colspan="2">$group.label <span class="badge badge-primary float-right">Class</span></th></tr>
<tr><td class="label">Identifier</td><td><a href="$group.iri">$group.iri</a></td></tr>
<tr><td class="label">Definition</td><td>$group.definition</td></tr>
<tr><td class="label">Comments</td><td>$group.comments</td></tr>
@ -82,10 +82,10 @@
#end if
#for $term in $group.terms
<a id="$term.namespace:$term.name" class="anchor"></a><!-- anchor to term -->
<a id="$term.namespace:$term.label" class="anchor"></a><!-- anchor to term -->
<table class="table table-sm border mb-3">
<tbody>
<tr class="table-secondary"><th colspan="2">$term.name <span class="badge badge-secondary float-right">Property</span></th></tr>
<tr class="table-secondary"><th colspan="2">$term.label <span class="badge badge-secondary float-right">Property</span></th></tr>
<tr><td class="label">Identifier</td><td><a href="$group.iri">$term.iri</a></td></tr>
<tr><td class="label">Definition</td><td>$term.definition</td></tr>
<tr><td class="label">Comments</td><td>$term.comments</td></tr>