<commit_before>#!/bin/sh

test $# -ne 1 && echo "usage: $0 doap" && exit 1

rdf="$1"

q="PREFIX doap: <http://usefulinc.com/ns/doap#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?home ?repo ?license ?maintainer ?maintainerhome ?lang
WHERE {
?p a doap:Project;
   doap:homepage ?home;
   doap:repository ?r;
   doap:license ?license;
   doap:programming-language ?lang;
   doap:maintainer ?m.
?r doap:location ?repo.
?m foaf:name ?maintainer;
   foaf:homepage ?maintainerhome.
}"

roqet -q -r csv -e "$q" -D /dev/stdin < $rdf | sed '/^Result/d' \
| while read r; do
	home=`echo $r | awk -F , '{print $2}'| sed -e 's/uri(\(.*\))/\1/'`
	repo=`echo $r | awk -F , '{print $3}'| sed -e 's/uri(\(.*\))/\1/'`
	licenseuri=`echo $r | awk -F , '{print $4}'| sed -e 's/uri(\(.*\))/\1/'`
	maint=`echo $r | awk -F , '{print $5}'| sed -e 's/"\(.*\)"/\1/'`
	mainthome=`echo $r | awk -F , '{print $6}'| sed -e 's/uri(\(.*\))/\1/'`
	lang=`echo $r | awk -F , '{print $7}'| sed -e 's/"\(.*\)"/\1/'`
	test "$licenseuri" = "http://www.gnu.org/licenses/gpl.html" && license="GPL"
	test "$licenseuri" = "http://www.gnu.org/licenses/agpl.html" && license="AGPL"
	test "$licenseuri" = "http://creativecommons.org/licenses/MIT/" && license="MIT"

	cat <<- _EOF_
- Project homepage: [$home]($home)
- Code repository: [$repo]($repo)
- Maintainer: [$maint]($mainthome)
- Language: $lang
- License: [$license]($licenseuri)
_EOF_
done<commit_msg>Don't show non-web repo as link<commit_after>#!/bin/sh

test $# -ne 1 && echo "usage: $0 doap" && exit 1

rdf="$1"

q="PREFIX doap: <http://usefulinc.com/ns/doap#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?home ?repo ?license ?maintainer ?maintainerhome ?lang
WHERE {
?p a doap:Project;
   doap:homepage ?home;
   doap:repository ?r;
   doap:license ?license;
   doap:programming-language ?lang;
   doap:maintainer ?m.
?r doap:location ?repo.
?m foaf:name ?maintainer;
   foaf:homepage ?maintainerhome.
}"

roqet -q -r csv -e "$q" -D /dev/stdin < $rdf | sed '/^Result/d' \
| while read r; do
	home=`echo $r | awk -F , '{print $2}'| sed -e 's/uri(\(.*\))/\1/'`
	repo=`echo $r | awk -F , '{print $3}'| sed -e 's/uri(\(.*\))/\1/'`
	licenseuri=`echo $r | awk -F , '{print $4}'| sed -e 's/uri(\(.*\))/\1/'`
	maint=`echo $r | awk -F , '{print $5}'| sed -e 's/"\(.*\)"/\1/'`
	mainthome=`echo $r | awk -F , '{print $6}'| sed -e 's/uri(\(.*\))/\1/'`
	lang=`echo $r | awk -F , '{print $7}'| sed -e 's/"\(.*\)"/\1/'`
	test "$licenseuri" = "http://www.gnu.org/licenses/gpl.html" && license="GPL"
	test "$licenseuri" = "http://www.gnu.org/licenses/agpl.html" && license="AGPL"
	test "$licenseuri" = "http://creativecommons.org/licenses/MIT/" && license="MIT"

	cat <<- _EOF_
- Project homepage: [$home]($home)
- Code repository: git clone $repo
- Maintainer: [$maint]($mainthome)
- Language: $lang
- License: [$license]($licenseuri)
_EOF_
done
{'fraction_non_alphanumeric': 0.2551627581379069, 'fraction_numerical': 0.012600630031501575, 'mean_word_length': 3.4586583463338534, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1713762', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1194, 'n_words': 292}