owl:imports implementation - one step only...
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ontology/component-aggregations/aggregate.sh Tue Oct 04 11:58:53 2011 -0400
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+#3> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+#3> @prefix dcterms: <http://purl.org/dc/terms/> .
+#3> @prefix doap: <http://usefulinc.com/ns/doap#> .
+#3>
+#3> <> a doap:Project;
+#3> dcterms:description "Script to process one-step owl:imports of OWL components.";
+#3> dcterms:author "Tim Lebo";
+#3> rdfs:seeAlso <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations/aggregate.sh>;
+#3> .
+
+base="http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations"
+
+rm -f "_"`basename $0`*.tmp
+TEMP="_"`basename $0``date +%s`_$$.tmp
+
+for aggregation_file in `find . -name "*.ttl" | sed 's/^\.\///'`; do
+ aggregation_url="${base}/${aggregation_file}"
+ echo "$aggregation_url"
+ rm -f $TEMP
+ for component in `rapper -g -o ntriples $aggregation_url 2> /dev/null | awk '$2 == "<http://www.w3.org/2002/07/owl#imports>"{print $3}' | sed 's/<//;s/>//'`; do
+ genid=`md5 -s $component | awk '{print $4}'`
+ echo " += $component"
+ rapper -q -g -o ntriples $component | sed "s/_:genid/_:genid${genid}/g" >> $TEMP
+ done
+ aggregated=`echo $aggregation_file | sed 's/.ttl$/.owl/'`
+ if [[ "$aggregation" != "$aggregated" ]]; then
+ rapper -q -i ntriples -o rdfxml-abbrev $TEMP > $aggregated
+ echo " ==-> $aggregated"
+ echo "@prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> ." >> $aggregated.prov.ttl
+ echo "" >> $aggregated.prov.ttl
+ echo "<$aggregated> prov:wasDerivedFrom <$aggregation_url> ." >> $aggregated.prov.ttl
+ echo "" >> $aggregated.prov.ttl
+ fi
+ rm -f $TEMP
+done
--- a/ontology/component-aggregations/prov-variant-1.owl.prov.ttl Tue Oct 04 11:52:26 2011 -0400
+++ b/ontology/component-aggregations/prov-variant-1.owl.prov.ttl Tue Oct 04 11:58:53 2011 -0400
@@ -1,4 +1,4 @@
@prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> .
-<prov-variant-1.ttl> prov:wasDerivedFrom <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations/prov-variant-1.ttl> .
+<prov-variant-1.owl> prov:wasDerivedFrom <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations/prov-variant-1.ttl> .