Created
September 18, 2014 14:11
-
-
Save juleschevalier/4bd3410cf14bd51e9811 to your computer and use it in GitHub Desktop.
Generate subClassOf ontologies, only made of successive subClassOf relations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $# -ne 1 ]]; then | |
echo "usage : $0 <size>"; | |
exit -1; | |
fi; | |
if [[ $1 -le 2 ]]; then | |
echo "usage : $0 <size>"; | |
echo "size must be at least 2" | |
exit -1; | |
fi; | |
name=subClassOf$1; | |
author=$USER; | |
prefix="http://www.semanticweb.org/$author/ontologies/2014/0/$name"; | |
Type="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; | |
Class="http://www.w3.org/2002/07/owl#Class"; | |
Ontology="http://www.w3.org/2002/07/owl#Ontology"; | |
SubClassOf="http://www.w3.org/2000/01/rdf-schema#subClassOf"; | |
i=2; | |
echo "<$prefix> <$Type> <$Ontology> ." > $name.nt; | |
echo "<$prefix#1> <$Type> <$Class> ." >> $name.nt; | |
while [[ $i -le $1 ]]; do | |
echo "<$prefix#$i> <$Type> <$Class> ." >> $name.nt; | |
echo "<$prefix#$i> <$SubClassOf> <$prefix#"$(($i-1))"> ." >> $name.nt; | |
i=$(($i+1)); | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment