Project

General

Profile

« Previous | Next » 

Revision 2066

Added by Matt Jones over 20 years ago

removed the 3 versions of printPackageSQL which are no longer used by metacat. This eliminates some dependency on xml_index.

View differences:

src/edu/ucsb/nceas/metacat/QuerySpecification.java
929 929
    self.append("where docid like '").append(docid).append("'");
930 930
    return self.toString();
931 931
  }
932
   
933
  /**
934
   * Prints sql that returns all relations in the database.
935
   */
936
  public static String printPackageSQL()
937
  {
938
    StringBuffer self = new StringBuffer();
939
    self.append("select z.nodedata, x.nodedata, y.nodedata from ");
940
    self.append("(select nodeid, parentnodeid from xml_index where path like ");
941
    self.append("'triple/subject') s, (select nodeid, parentnodeid ");
942
    self.append("from xml_index where path like ");
943
    self.append("'triple/relationship') rel, ");
944
    self.append("(select nodeid, parentnodeid from xml_index where path like ");
945
    self.append("'triple/object') o, ");
946
    self.append("xml_nodes x, xml_nodes y, xml_nodes z ");
947
    self.append("where s.parentnodeid = rel.parentnodeid ");
948
    self.append("and rel.parentnodeid = o.parentnodeid ");
949
    self.append("and x.parentnodeid in (rel.nodeid) ");
950
    self.append("and y.parentnodeid in (o.nodeid) ");
951
    self.append("and z.parentnodeid in (s.nodeid) ");
952
    //self.append("and z.nodedata like '%");
953
    //self.append(docid);
954
    //self.append("%'");
955
    return self.toString();
956
  }
957
  
958
  /**
959
   * Prints sql that returns all relations in the database that were input
960
   * under a specific docid
961
   * @param docid the docid to search for.
962
   */
963
  public static String printPackageSQL(String docid)
964
  {
965
    StringBuffer self = new StringBuffer();
966
    self.append("select z.nodedata, z.parentnodeid, ");
967
    self.append("x.nodedata, x.parentnodeid, y.nodedata, y.parentnodeid from ");
968
    self.append("(select nodeid, parentnodeid from xml_index where path like ");
969
    self.append("'triple/subject') s, (select nodeid, parentnodeid ");
970
    self.append("from xml_index where path like ");
971
    self.append("'triple/relationship') rel, ");
972
    self.append("(select nodeid, parentnodeid from xml_index where path like ");
973
    self.append("'triple/object') o, ");
974
    self.append("xml_nodes x, xml_nodes y, xml_nodes z ");
975
    self.append("where s.parentnodeid = rel.parentnodeid ");
976
    self.append("and rel.parentnodeid = o.parentnodeid ");
977
    self.append("and x.parentnodeid in (rel.nodeid) ");
978
    self.append("and y.parentnodeid in (o.nodeid) ");
979
    self.append("and z.parentnodeid in (s.nodeid) ");
980
    self.append("and z.docid like '").append(docid).append("'");
981
    
982
    return self.toString();
983
  }
984
  
985
  /**
986
   * Returns all of the relations that has a certain docid in the subject
987
   * or the object.
988
   * 
989
   * @param docid the docid to search for
990
   */
991
  public static String printPackageSQL(String subDocidURL, String objDocidURL)
992
  {
993
    StringBuffer self = new StringBuffer();
994
    self.append("select z.nodedata, x.nodedata, y.nodedata from ");
995
    self.append("(select nodeid, parentnodeid from xml_index where path like ");
996
    self.append("'triple/subject') s, (select nodeid, parentnodeid ");
997
    self.append("from xml_index where path like ");
998
    self.append("'triple/relationship') rel, ");
999
    self.append("(select nodeid, parentnodeid from xml_index where path like ");
1000
    self.append("'triple/object') o, ");
1001
    self.append("xml_nodes x, xml_nodes y, xml_nodes z ");
1002
    self.append("where s.parentnodeid = rel.parentnodeid ");
1003
    self.append("and rel.parentnodeid = o.parentnodeid ");
1004
    self.append("and x.parentnodeid in (rel.nodeid) ");
1005
    self.append("and y.parentnodeid in (o.nodeid) ");
1006
    self.append("and z.parentnodeid in (s.nodeid) ");
1007
    self.append("and (z.nodedata like '");
1008
    self.append(subDocidURL);
1009
    self.append("' or y.nodedata like '");
1010
    self.append(objDocidURL);
1011
    self.append("')");
1012
    return self.toString();
1013
  }
1014
  
932

  
1015 933
  public static String printGetDocByDoctypeSQL(String docid)
1016 934
  {
1017 935
    StringBuffer self = new StringBuffer();

Also available in: Unified diff