[Swift-commit] r7247 - provenancedb/tags

wilde at ci.uchicago.edu wilde at ci.uchicago.edu
Tue Oct 29 20:59:28 CDT 2013


Author: wilde
Date: 2013-10-29 20:59:28 -0500 (Tue, 29 Oct 2013)
New Revision: 7247

Added:
   provenancedb/tags/tag
   provenancedb/tags/tlocate.old
Removed:
   provenancedb/tags/tlocate
   provenancedb/tags/ttag
Log:
snapshot of client side.

Copied: provenancedb/tags/tag (from rev 7243, provenancedb/tags/ttag)
===================================================================
--- provenancedb/tags/tag	                        (rev 0)
+++ provenancedb/tags/tag	2013-10-30 01:59:28 UTC (rev 7247)
@@ -0,0 +1,55 @@
+#! /bin/sh
+
+
+usage()
+{
+  echo $0: usage:
+  cat <<END
+    -m|--multiple   allow multiple tags with the same name
+    -u|--user       Defaults to $USER or set from ~/.tagpass
+    -p|--password   Or set from ~/.tagpass
+    -d|--database   Defaults to provdb or \$TAGDB or set from ~/.tagpass
+    -h|-?|?|--help  print this help
+END
+}
+
+# Default values
+
+user=$USER
+database=provdb
+
+# Get user's preferred user name, password, and database if specified
+
+if [ -r ~/.tagpass ]; then
+  user=$(awk '{print $1}' < ~/.tagpass)
+  password=$(awk '{print $2}' < ~/.tagpass)
+  database=$(awk '{print $3}' < ~/.tagpass)
+fi
+database=${TAGDB:-$database}
+
+# Get command line option flags
+
+multiple=false
+while [ $# -gt 0 ]; do
+  case $1 in
+    -u|--user)     user=$2;       shift 2 ;;
+    -p|--password) password=$2;   shift 2 ;;
+    -d|--database) database=$2;   shift 2 ;;
+    -m|--multiple) multiple=true; shift 1 ;;
+    -h|-?|--help|-*|--*) usage;   exit    ;;
+    *) break                              ;;
+  esac
+done
+
+echo multiple=$multiple
+
+query=$@
+
+query="-u $user -p $password -d $database $query"
+
+query=$(echo $query | sed -e 's/ /\+/g')
+
+echo FINAL: curl http://$HOST/provdb.php?cmd="tags/locate.server+$query"
+
+curl http://$HOST/provdb.php?cmd="tags/locate.server+$query"
+

Deleted: provenancedb/tags/tlocate
===================================================================
--- provenancedb/tags/tlocate	2013-10-29 20:45:53 UTC (rev 7246)
+++ provenancedb/tags/tlocate	2013-10-30 01:59:28 UTC (rev 7247)
@@ -1,86 +0,0 @@
-#! /bin/sh
-
-TAGDB=${TAGDB:-provdb}
-
-SQLCMD="psql -U provdb -h swift.rcc.uchicago.edu $TAGDB"
-
-format=default
-
-echo
-
-if [ _"$1" = _ -o _"$1" = '_*' ]; then
-  WHERE="(select distinct dataset_id from annot_dataset_text)"
-else
-  WHERE=$(echo $* | sed -e "s/\([[:alnum:]_-]\+\)[[:space:]]*\([!=<>]\+\|like\|ilike\)[[:space:]]*\([[:alnum:] *%.:_-]\+\)/(select dataset_id from annot_dataset_text where name = '\1' AND value \2 '\3')/g" -e "s/ and / INTERSECT /g" -e "s/ or / UNION /g")
-fi
-
-QUERY="select * from annot_dataset_text where dataset_id in ($WHERE);"
-
-TQUERY="select * from annot_dataset_text where dataset_id in (
-         select dataset_id from annot_dataset_text where (name='owner' and value='wilde') intersect
-         select dataset_id from annot_dataset_text where (name='type' and value='pdb')
-       );"
-
-echo -e "$QUERY\n"
-
-$SQLCMD -c "$QUERY" >t.out
-head -2 t.out >t.hdr
-tail -n +2 t.out | sort >t.body
-
-if [ $format = default ]; then
-
-cat t.hdr t.body |  awk '
-BEGIN {
-  start=0
-  for(i=0;i<1024;i++) spaces = spaces " ";
-}
-start==0 { print $0 }
-start==1 {
-  if ($1 != lastid)
-    print "\n" $0;
-  else {
-    line=$0
-    sub("^[^|]*| ",nullds,line);
-    print line;
-  }
-  lastid = $1;
-}
-/------/ {
-  start=1
-  dslen=match($0,"+")-1;
-  nullds = substr(spaces,1,dslen);
-}
-'
-
-elif [ $format = cols ]; then
-
-cat t.hdr t.body |  awk '
-BEGIN {
-  start=0
-  for(i=0;i<1024;i++) spaces = spaces " ";
-  fields = [ a3 a4 ];
-}
-start==0 { print $0 }
-start==1 {
-  if ($1 != lastid)
-    print "\n" $0;
-  else {
-    line=$0
-    sub("^[^|]*| ",nullds,line);
-    print line;
-  }
-  lastid = $1;
-}
-/------/ {
-  start=1
-  dslen=match($0,"+")-1;
-  nullds = substr(spaces,1,dslen);
-}
-'
-
-fi
-
-
-exit
-
-locate owner=sinitzkiy or owner=wilde

Copied: provenancedb/tags/tlocate.old (from rev 7243, provenancedb/tags/tlocate)
===================================================================
--- provenancedb/tags/tlocate.old	                        (rev 0)
+++ provenancedb/tags/tlocate.old	2013-10-30 01:59:28 UTC (rev 7247)
@@ -0,0 +1,86 @@
+#! /bin/sh
+
+TAGDB=${TAGDB:-provdb}
+
+SQLCMD="psql -U provdb -h swift.rcc.uchicago.edu $TAGDB"
+
+format=default
+
+echo
+
+if [ _"$1" = _ -o _"$1" = '_*' ]; then
+  WHERE="(select distinct dataset_id from annot_dataset_text)"
+else
+  WHERE=$(echo $* | sed -e "s/\([[:alnum:]_-]\+\)[[:space:]]*\([!=<>]\+\|like\|ilike\)[[:space:]]*\([[:alnum:] *%.:_-]\+\)/(select dataset_id from annot_dataset_text where name = '\1' AND value \2 '\3')/g" -e "s/ and / INTERSECT /g" -e "s/ or / UNION /g")
+fi
+
+QUERY="select * from annot_dataset_text where dataset_id in ($WHERE);"
+
+TQUERY="select * from annot_dataset_text where dataset_id in (
+         select dataset_id from annot_dataset_text where (name='owner' and value='wilde') intersect
+         select dataset_id from annot_dataset_text where (name='type' and value='pdb')
+       );"
+
+echo -e "$QUERY\n"
+
+$SQLCMD -c "$QUERY" >t.out
+head -2 t.out >t.hdr
+tail -n +2 t.out | sort >t.body
+
+if [ $format = default ]; then
+
+cat t.hdr t.body |  awk '
+BEGIN {
+  start=0
+  for(i=0;i<1024;i++) spaces = spaces " ";
+}
+start==0 { print $0 }
+start==1 {
+  if ($1 != lastid)
+    print "\n" $0;
+  else {
+    line=$0
+    sub("^[^|]*| ",nullds,line);
+    print line;
+  }
+  lastid = $1;
+}
+/------/ {
+  start=1
+  dslen=match($0,"+")-1;
+  nullds = substr(spaces,1,dslen);
+}
+'
+
+elif [ $format = cols ]; then
+
+cat t.hdr t.body |  awk '
+BEGIN {
+  start=0
+  for(i=0;i<1024;i++) spaces = spaces " ";
+  fields = [ a3 a4 ];
+}
+start==0 { print $0 }
+start==1 {
+  if ($1 != lastid)
+    print "\n" $0;
+  else {
+    line=$0
+    sub("^[^|]*| ",nullds,line);
+    print line;
+  }
+  lastid = $1;
+}
+/------/ {
+  start=1
+  dslen=match($0,"+")-1;
+  nullds = substr(spaces,1,dslen);
+}
+'
+
+fi
+
+
+exit
+
+locate owner=sinitzkiy or owner=wilde

Deleted: provenancedb/tags/ttag
===================================================================
--- provenancedb/tags/ttag	2013-10-29 20:45:53 UTC (rev 7246)
+++ provenancedb/tags/ttag	2013-10-30 01:59:28 UTC (rev 7247)
@@ -1,68 +0,0 @@
-#! /bin/sh
-
-TAGDB=${TAGDB:-provdb}
-
-SQLCMD="psql -U provdb -h swift.rcc.uchicago.edu $TAGDB"
-
-multiple=false
-while [ $# -gt 0 ]; do
-  case $1 in
-    -m|--multiple)  multiple=true; shift 1 ;;
-    -h|-?|--help|-*|--*) usage; exit  ;;
-    *) break ;;
-  esac
-  # shift 2 
-done
-
-echo multiple=$multiple
-
-object=$1
-#count=$#
-#echo count=$count
-#last="$7"
-#echo last="$last"
-shift
-
-$SQLCMD -c "insert into ds (id) values ('$object');"
-
-
-usage()
-{
-  echo $0: usage:
-  cat <<END
-    -m|--multiple   allow multiple tags with the same name
-    -h|-?|?|--help  print this help
-END
-}
-
-for anno in "$@"; do
-  name=$(echo "$anno" | awk -F= '{print $1}')
-  value=$(echo "$anno" | awk -F= '{print $2}')
-  echo anno=$anno name=$name value="$value"
-  if [ $multiple = false ]; then
-    $SQLCMD -c "
-    DO
-    \$\$
-    BEGIN
-      IF EXISTS ( SELECT 1 FROM annot_dataset_text WHERE dataset_id = '$object' and name = '$name' ) THEN
-        UPDATE annot_dataset_text SET value = '$value' WHERE dataset_id = '$object' and name = '$name' ;
-      ELSE
-        INSERT INTO annot_dataset_text (dataset_id, name, value) VALUES ('$object', '$name', '$value') ;
-      END IF;
-    END;
-    \$\$"
-  else
-    $SQLCMD -c "insert into annot_dataset_text (dataset_id, name, value) values ('$object', '$name', '$value');"
-  fi
-done
-
-exit
-
-insert into annot_dataset_text (dataset_id, name, value) values ('/d1/d2/f1', 'owner', 'wilde');
-insert into annot_dataset_text (dataset_id, name, value) values ('/d1/d2/f1', 'group', 'cmts-cyber');
-insert into annot_dataset_text (dataset_id, name, value) values ('/d1/d2/f1', 'create-date', '2013.0123.23:07:29.123');
-insert into annot_dataset_text (dataset_id, name, value) values ('/d1/d2/f1', 'type', 'pdb');
-insert into annot_dataset_text (dataset_id, name, value) values ('/d1/d2/f1', 'state', 'unverified');
-insert into annot_dataset_text (dataset_id, name, value) values ('/d1/d2/f1', 'note','Initial structure prediction from loop model. mw');
-
-END




More information about the Swift-commit mailing list