diff options
Diffstat (limited to 'bibtotxt.sh')
-rwxr-xr-x | bibtotxt.sh | 24 |
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 |