#!/bin/sh

echo "###Script for counting classes and properties numbers in dumps###"

folder=$PWD
for entry in "$folder"/*
do
  #echo "Processing: $entry"
	file_name=$(basename $entry)
	FILE="$entry"/edgefile_sorted.tsv
	if [ -f "$FILE" ]; then
		folder="$entry"/prop_count.tsv

		if [ ! -f "$folder" ]; then
        echo "Counting instances and property usage in $entry"
        kgtk filter -i $FILE -p " ; P31 ; " / unique --column node2 -o "$entry"/class_count.tsv
        kgtk unique -i $FILE --column label -o "$entry"/prop_count.tsv
		fi

	fi
done


