#/bin/sh 

mkdir data

for i in `ls ../core-i18n` ; do
	echo $i
   	CMD="sort -mu -T ./sorttmp "
	
	for a in `find ../core-i18n/$i -name "*.ttl.bz2"  | grep 'instance_types_transitive_wkd_uris\|geo_coordinates_wkd_uris\|geo_coordinates_mappingbased_wkd_uris\|labels_wkd_uris\|mappingbased_objects_wkd_uris\|mappingbased_literals_wkd_uris'` ; do
		CMD="$CMD <(lbzip2 -dc '$a') "
	
	done
	mkdir data/$i
	#eval  "$CMD" | gzip > data/$i/wkd_uris_selection.gz
done

WIKIDATA="../core-i18n/wikidata/mappingbased_objects_uncleaned_redirected_wikidata.ttl.bz2
../core-i18n/wikidata/instance_types_transitive_wikidata.ttl.bz2
../core-i18n/wikidata/geo_coordinates_wikidata.ttl.bz2
../core-i18n/wikidata/labels_wikidata.ttl.bz2"

CMD="sort -mu -T ./sorttmp "
for i in `echo $WIKIDATA` ; do
	echo $i
   	CMD="$CMD <(lbzip2 -dc '$a') "
	mkdir data/wikidata
	#eval  "$CMD" | gzip > data/$i/wkd_uris_selection.gz
done

