summaryrefslogtreecommitdiff
path: root/bibtotxt.sh
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2010-05-07 00:34:05 +0100
committerNick White <git@njw.me.uk>2010-05-07 00:34:05 +0100
commit49084e37468953793aed48c4be3d66e852cad031 (patch)
tree41476de708b3fe6299bc629988428040ce13a014 /bibtotxt.sh
parentae3a2c07a68cb94a197c453d7c674e1deb313316 (diff)
downloadnjw-website-49084e37468953793aed48c4be3d66e852cad031.tar.bz2
njw-website-49084e37468953793aed48c4be3d66e852cad031.zip
Add some publications
Diffstat (limited to 'bibtotxt.sh')
-rwxr-xr-xbibtotxt.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/bibtotxt.sh b/bibtotxt.sh
new file mode 100755
index 0000000..3b7a24e
--- /dev/null
+++ b/bibtotxt.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+rdf="$1"
+
+echo "Publications"
+echo "======================================================================="
+echo ""
+
+# do this with awk
+for uri in `roqet -q -e 'SELECT ?s WHERE { ?s a <http://purl.org/ontology/bibo/Article> }' -D $rdf |awk '{print $2}'|sed -e 's/^\[s=uri<//' -e 's/>]$//'`; do
+ reluri=`echo $uri | sed 's/.*\/\([^\/]\)/\1/'`
+ title=`roqet -q -e "SELECT ?o WHERE { <${uri}> <http://purl.org/dc/elements/1.1/title> ?o }" -D $rdf |sed -e 's/result: \[o=string("//' -e 's/")]//'`
+ artdate=`roqet -q -e "SELECT ?o WHERE { <${uri}> <http://purl.org/dc/elements/1.1/date> ?o }" -D $rdf |sed -e 's/result: \[o=string("//' -e 's/")]//'`
+ stat=`roqet -q -e "SELECT ?o WHERE { <${uri}> <http://purl.org/ontology/bibo/status> ?o }" -D $rdf |awk '{print $2}'|sed -e 's/^\[s=uri<//' -e 's/>]$//'| sed 's/.*\/\([^\/]\)/\1/'`
+ #should be done with smarter queries
+ journalurn=`roqet -q -e "SELECT ?o WHERE { <${uri}> <http://purl.org/dc/elements/1.1/isPartOf> ?o }" -D $rdf |awk '{print $2}'|sed -e 's/^\[o=uri<//' -e 's/>]$//'| sed 's/.*\/\([^\/]\)/\1/'`
+ journaltitle=`roqet -q -e "SELECT ?o WHERE { <${journalurn}> <http://purl.org/dc/elements/1.1/title> ?o }" -D $rdf |sed -e 's/result: \[o=string("//' -e 's/")]//'`
+ journaluri=`roqet -q -e "SELECT ?o WHERE { <${journalurn}> <http://purl.org/ontology/bibo/uri> ?o }" -D $rdf |sed -e 's/result: \[o=string("//' -e 's/")]//'`
+
+ echo "- [${title}](${reluri})"
+ echo " [[PDF]](${shorturi}.pdf) (${artdate})"
+ echo " *[${journaltitle}](${journaluri})*"
+ echo " [${stat}]"
+done