added URLs to component aggregation provenance.
authorTim L <lebot@rpi.edu>
Thu, 06 Oct 2011 09:44:42 -0400
changeset 557 3d6ec214ad01
parent 556 0491e4906eec
child 559 4c79363beac1
added URLs to component aggregation provenance.
ontology/component-aggregations/aggregate.sh
ontology/component-aggregations/prov-variant-1.owl.prov.ttl
ontology/component-aggregations/prov.owl.prov.ttl
--- a/ontology/component-aggregations/aggregate.sh	Thu Oct 06 09:07:28 2011 -0400
+++ b/ontology/component-aggregations/aggregate.sh	Thu Oct 06 09:44:42 2011 -0400
@@ -30,32 +30,56 @@
 rm -f "_"`basename $0`*.tmp
 TEMP="_"`basename $0``date +%s`_$$.tmp
 
-for aggregation_file in `find . -name "*.ttl" | grep -v "\.prov.ttl" | sed 's/^\.\///'`; do
-   aggregation_url="${base}/${aggregation_file}"
-   echo "$aggregation_url"
+for component_list_file in `find . -name "*.ttl" | grep -v "\.prov.ttl" | sed 's/^\.\///'`; do
    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
+   component_url="${base}/${component_list_file}"
+   echo "$component_url"
+   closure_file=`echo $component_list_file | sed 's/.ttl$/.owl/'`
+
+   if [ "$closure_file" == $component_list_file ]; then
+      echo "skipping $component_list_file because it would be overwritten by its closure."
+      continue
+   fi
+
+   let input_count=0
+   for component in `rapper -g -o ntriples $component_url 2> /dev/null | awk '$2 == "<http://www.w3.org/2002/07/owl#imports>"{print $3}' | sed 's/<//;s/>//'`; do
+      let input_count=$input_count+1
       genid=`md5 -s $component | awk '{print $4}'`
       echo "   += $component"
       rapper -q -g -o ntriples $component | sed "s/_:genid/_:genid${genid}/g" >> $TEMP
+      if [ $input_count -eq 1 ]; then
+         echo "@prefix nfo:  <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> ."                >> $closure_file.prov.ttl
+         echo "@prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> ." >> $closure_file.prov.ttl
+         echo "@prefix :     <#> ."                                                                        >> $closure_file.prov.ttl
+         id=""
+      else
+         id="_$input_count"
+      fi
+      echo ""                                                                                              >> $closure_file.prov.ttl
+      echo ":result"                                                                                       >> $closure_file.prov.ttl
+      if [ $input_count -eq 1 ]; then
+         echo "   nfo:fileURL <$closure_file>;"                                                            >> $closure_file.prov.ttl
+         echo "   prov:wasDerivedFrom :component_list;"                                                    >> $closure_file.prov.ttl
+      fi
+         echo "   prov:wasDerivedFrom :input$id;"                                                          >> $closure_file.prov.ttl
+      if [ $input_count -eq 1 ]; then
+         echo "   a prov:Entity;"                                                                          >> $closure_file.prov.ttl
+      fi
+      echo "."                                                                                             >> $closure_file.prov.ttl
+      if [ $input_count -eq 1 ]; then
+         echo ""                                                                                           >> $closure_file.prov.ttl
+         echo ":component_list"                                                                            >> $closure_file.prov.ttl
+         echo "   nfo:fileURL <$component_url>;"                                                           >> $closure_file.prov.ttl
+         echo "   a prov:Entity;"                                                                          >> $closure_file.prov.ttl
+         echo "."                                                                                          >> $closure_file.prov.ttl
+      fi
+      echo ""                                                                                              >> $closure_file.prov.ttl
+      echo ":input$id"                                                                                     >> $closure_file.prov.ttl
+      echo "   nfo:fileURL <$component>;"                                                                  >> $closure_file.prov.ttl
+      echo "   a prov:Entity;"                                                                             >> $closure_file.prov.ttl
+      echo "."                                                                                             >> $closure_file.prov.ttl
    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 nfo:  <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> ."                >> $aggregated.prov.ttl
-      echo "@prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> ." >> $aggregated.prov.ttl
-      echo "@prefix :     <#> ."                                                                        >> $aggregated.prov.ttl
-      echo ""                                                                                           >> $aggregated.prov.ttl
-      echo ":result"                                                                                    >> $aggregated.prov.ttl
-      echo "   nfo:fileURL <$aggregated>;"                                                              >> $aggregated.prov.ttl
-      echo "   prov:wasDerivedFrom :input;"                                                             >> $aggregated.prov.ttl
-      echo "   a prov:Entity;"                                                                          >> $aggregated.prov.ttl
-      echo "."                                                                                          >> $aggregated.prov.ttl
-      echo ":input"                                                                                     >> $aggregated.prov.ttl
-      echo "   nfo:fileURL <$aggregation_url>;"                                                         >> $aggregated.prov.ttl
-      echo "   a prov:Entity;"                                                                          >> $aggregated.prov.ttl
-      echo "."                                                                                          >> $aggregated.prov.ttl
-   fi
+   rapper -q -i ntriples -o rdfxml-abbrev $TEMP > $closure_file
+   echo "   ==-> $closure_file"
    rm -f $TEMP
 done
--- a/ontology/component-aggregations/prov-variant-1.owl.prov.ttl	Thu Oct 06 09:07:28 2011 -0400
+++ b/ontology/component-aggregations/prov-variant-1.owl.prov.ttl	Thu Oct 06 09:44:42 2011 -0400
@@ -1,52 +1,38 @@
-@prefix nfo:  <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
-@prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> .
-@prefix :     <#> .
-
-:result
-   a prov:Entity;
-   nfo:fileURL <prov-variant-1.owl>;
-   prov:wasDerivedFrom :input;
-.
-:input
-   a prov:Entity;
-   nfo:fileURL <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations/prov-variant-1.ttl>;
-.
-@prefix nfo:  <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
-@prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> .
-@prefix :     <#> .
-
-:result
-   a prov:Entity;
-   nfo:fileURL <prov-variant-1.owl>;
-   prov:wasDerivedFrom :input;
-.
-:input
-   a prov:Entity;
-   nfo:fileURL <https://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations/prov-variant-1.ttl>;
-.
-@prefix nfo:  <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
-@prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> .
-@prefix :     <#> .
-
-:result
-   a prov:Entity;
-   nfo:fileURL <prov-variant-1.owl>;
-   prov:wasDerivedFrom :input;
-.
-:input
-   a prov:Entity;
-   nfo:fileURL <https://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations/prov-variant-1.ttl>;
-.
 @prefix nfo:  <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
 @prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> .
 @prefix :     <#> .
 
 :result
    nfo:fileURL <prov-variant-1.owl>;
+   prov:wasDerivedFrom :component_list;
    prov:wasDerivedFrom :input;
    a prov:Entity;
 .
-:input
+
+:component_list
    nfo:fileURL <https://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations/prov-variant-1.ttl>;
    a prov:Entity;
 .
+
+:input
+   nfo:fileURL <https://dvcs.w3.org/hg/prov/raw-file/tip/ontology/components/Account.ttl>;
+   a prov:Entity;
+.
+
+:result
+   prov:wasDerivedFrom :input_2;
+.
+
+:input_2
+   nfo:fileURL <https://dvcs.w3.org/hg/prov/raw-file/tip/ontology/components/EntityInRole.ttl>;
+   a prov:Entity;
+.
+
+:result
+   prov:wasDerivedFrom :input_3;
+.
+
+:input_3
+   nfo:fileURL <https://dvcs.w3.org/hg/prov/raw-file/tip/ontology/components/assumedBy.ttl>;
+   a prov:Entity;
+.
--- a/ontology/component-aggregations/prov.owl.prov.ttl	Thu Oct 06 09:07:28 2011 -0400
+++ b/ontology/component-aggregations/prov.owl.prov.ttl	Thu Oct 06 09:44:42 2011 -0400
@@ -1,52 +1,20 @@
-@prefix nfo:  <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
-@prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> .
-@prefix :     <#> .
-
-:result
-   a prov:Entity;
-   nfo:fileURL <prov.owl>;
-   prov:wasDerivedFrom :input;
-.
-:input
-   a prov:Entity;
-   nfo:fileURL <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations/prov.ttl>;
-.
-@prefix nfo:  <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
-@prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> .
-@prefix :     <#> .
-
-:result
-   a prov:Entity;
-   nfo:fileURL <prov.owl>;
-   prov:wasDerivedFrom :input;
-.
-:input
-   a prov:Entity;
-   nfo:fileURL <https://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations/prov.ttl>;
-.
-@prefix nfo:  <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
-@prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> .
-@prefix :     <#> .
-
-:result
-   a prov:Entity;
-   nfo:fileURL <prov.owl>;
-   prov:wasDerivedFrom :input;
-.
-:input
-   a prov:Entity;
-   nfo:fileURL <https://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations/prov.ttl>;
-.
 @prefix nfo:  <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> .
 @prefix prov: <http://dvcs.w3.org/hg/prov/raw-file/tip/ontology/ProvenanceOntology.owl#> .
 @prefix :     <#> .
 
 :result
    nfo:fileURL <prov.owl>;
+   prov:wasDerivedFrom :component_list;
    prov:wasDerivedFrom :input;
    a prov:Entity;
 .
-:input
+
+:component_list
    nfo:fileURL <https://dvcs.w3.org/hg/prov/raw-file/tip/ontology/component-aggregations/prov.ttl>;
    a prov:Entity;
 .
+
+:input
+   nfo:fileURL <https://dvcs.w3.org/hg/prov/raw-file/tip/ontology/components/wasDerivedFrom.ttl>;
+   a prov:Entity;
+.