Skip to content

Commit 6217d76

Browse files
committed
Refactor SPARQL updates for kingdom assignments and introduce new scripts for propagation
1 parent 1047c57 commit 6217d76

File tree

5 files changed

+42
-75
lines changed

5 files changed

+42
-75
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,17 @@ jobs:
4747
4848
tdb2.tdbloader --loc=./tdbstore col.nt
4949
rm col.nt
50-
tdb2.tdbupdate --loc=./tdbstore --update=add-kingdoms.sparql
50+
51+
echo "Running add-kingdoms-root.sparql"
52+
tdb2.tdbupdate --loc=./tdbstore --update=add-kingdoms-root.sparql
53+
54+
for i in {1..6}; do
55+
echo "Running propagate-kingdoms.sparql (iteration $i)"
56+
tdb2.tdbupdate --loc=./tdbstore --update=propagate-kingdoms.sparql
57+
done
58+
59+
echo "Running propagate-kingdoms-acceptedname.sparql"
60+
tdb2.tdbupdate --loc=./tdbstore --update=propagate-kingdoms-acceptedname.sparql
5161
5262
tdb2.tdbdump --loc=./tdbstore | gzip > col.nt.gz
5363

add-kingdoms-root.sparql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
PREFIX dwc: <http://rs.tdwg.org/dwc/terms/>
2+
3+
INSERT {
4+
?taxon dwc:kingdom ?kingdom .
5+
} WHERE {
6+
?taxon dwc:taxonRank "kingdom" ;
7+
dwc:scientificName ?full_name .
8+
OPTIONAL { ?taxon dwc:scientificNameAuthorship ?authority . }
9+
BIND(REPLACE(?full_name, CONCAT(" ", COALESCE(?authority, ""), "$"), "") AS ?kingdom)
10+
# In some cases (8 of 23), the kingdom has an authority. the above should trim it.
11+
};

add-kingdoms.sparql

Lines changed: 0 additions & 74 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
PREFIX dwc: <http://rs.tdwg.org/dwc/terms/>
2+
3+
INSERT {
4+
?taxon dwc:kingdom ?kingdom .
5+
} WHERE {
6+
?taxon dwc:acceptedName ?an .
7+
?an dwc:kingdom ?kingdom .
8+
FILTER NOT EXISTS { ?taxon dwc:kingdom ?any }
9+
};
10+

propagate-kingdoms.sparql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
PREFIX dwc: <http://rs.tdwg.org/dwc/terms/>
2+
3+
INSERT {
4+
?taxon dwc:kingdom ?kingdom .
5+
} WHERE {
6+
?taxon dwc:parent ?parent .
7+
?parent dwc:kingdom ?kingdom .
8+
FILTER NOT EXISTS { ?taxon dwc:kingdom ?any }
9+
};
10+

0 commit comments

Comments
 (0)