summaryrefslogtreecommitdiff
path: root/bibtotxt.sh
blob: 681ab7cfe75c07693a2f82097ecc765f81855a0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh

rdf="$1"

echo "Publications"
echo "======================================================================="
echo ""

q="PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX bibo: <http://purl.org/ontology/bibo/>
SELECT ?a ?title ?artdate ?stat ?jtitle ?juri
WHERE {
?a a bibo:Article;
   dc:title ?title;
   dc:date ?artdate;
   bibo:status ?stat;
   dc:isPartOf ?j.
?j dc:title ?jtitle;
   bibo:uri ?juri.
}"

roqet -q -r csv -e "$q" -D /dev/stdin < $rdf | sed '/^Result/d' \
| while read r; do
	uri=`echo $r | awk -F , '{print $2}'| sed -e 's/uri(\(.*\))/\1/'`
	reluri=`echo $uri | sed 's/.*\/\([^\/]\)/\1/'`
	title=`echo $r | awk -F , '{print $3}'| sed -e 's/"\(.*\)"/\1/'`
	artdate=`echo $r | awk -F , '{print $4}'| sed -e 's/"\(.*\)"/\1/'`
	stat=`echo $r | awk -F , '{print $5}'| sed -e 's/uri(\(.*\))/\1/' -e 's/.*\/\([^\/]\)/\1/'`
	jtitle=`echo $r | awk -F , '{print $6}'| sed -e 's/"\(.*\)"/\1/'`
	juri=`echo $r | awk -F , '{print $7}'| sed -e 's/"\(.*\)"/\1/'`

	echo "- [${title}](${reluri})"
	echo "  [[PDF]](${reluri}.pdf) (${artdate})"
	echo "  *[${jtitle}](${juri})*"
	echo "  [${stat}]"
done