Clean table of figures and captions as TSV
Browse filesThis was generated from the query figures-and-captions.sparql by running the following:
```
blazegraph-runner --journal=treatments.jnl select figures-and-captions.sparql figures-and-captions.tsv
```
- .gitattributes +1 -0
- figures-and-captions.sparql +41 -0
- figures-and-captions.tsv +3 -0
.gitattributes
CHANGED
@@ -53,3 +53,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
+
figures-and-captions.tsv filter=lfs diff=lfs merge=lfs -text
|
figures-and-captions.sparql
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
2 |
+
PREFIX bibo: <http://purl.org/ontology/bibo/>
|
3 |
+
PREFIX dc: <http://purl.org/dc/elements/1.1/>
|
4 |
+
PREFIX fabio: <http://purl.org/spar/fabio/>
|
5 |
+
PREFIX trt: <http://plazi.org/vocab/treatment#>
|
6 |
+
|
7 |
+
# This query obtains a table of figures with their image URLs and captions.
|
8 |
+
# Each figure URI and figure representation URL should be unique in the
|
9 |
+
# resulting table.
|
10 |
+
# To provide an identifier that lends itself well to uniquely naming files
|
11 |
+
# (e.g., the downloaded images) that can easily be back-referenced to this
|
12 |
+
# table, an MD5-hash identifier is added as the first column.
|
13 |
+
SELECT DISTINCT
|
14 |
+
(MD5(STR(?figure)) AS ?figureID) # MD5 of figure URI as filename-friendly ID
|
15 |
+
?figure # figure URI
|
16 |
+
(STR(?figureURL) AS ?figURL) # URL of the figure's representation
|
17 |
+
(STR(?caption) AS ?figureCaption) # textual caption of the figure
|
18 |
+
WHERE {
|
19 |
+
?treatment a trt:Treatment ; # Taxonomic treatment
|
20 |
+
trt:publishedIn ?pub . # published in a publication
|
21 |
+
?pub fabio:hasPart ?figure . # which has a part
|
22 |
+
?figure a fabio:Figure ; # that is a figure
|
23 |
+
dc:description ?caption ; # and has a caption
|
24 |
+
fabio:hasRepresentation ?figureURL . # and a representation at a URL
|
25 |
+
#
|
26 |
+
# Consider only figures that have only one figure representation,
|
27 |
+
# and only one caption.
|
28 |
+
{
|
29 |
+
SELECT ?figure
|
30 |
+
WHERE {
|
31 |
+
?figure fabio:hasRepresentation ?fUrl .
|
32 |
+
?figure dc:description ?fCaption .
|
33 |
+
FILTER (strLen(?fCaption) > 0)
|
34 |
+
}
|
35 |
+
GROUP BY ?figure
|
36 |
+
HAVING (COUNT(DISTINCT ?fUrl) = 1 && COUNT(DISTINCT ?fCaption) = 1)
|
37 |
+
}
|
38 |
+
# Finally, disregard figures with an empty caption,
|
39 |
+
# and figures that don't seem to be locatable online.
|
40 |
+
FILTER (STRLEN(?caption) > 0 && ! strStarts(STR(?figure), "file:///"))
|
41 |
+
}
|
figures-and-captions.tsv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b8d6e804b4a959a50cdcc71a97af7f282ad2ec8bd4321a1e0938f304961030c8
|
3 |
+
size 122406336
|