[MOBY-guts] biomoby commit

Gary Schlitz gss at pub.open-bio.org
Thu Nov 4 22:37:54 UTC 2004


gss
Thu Nov  4 17:37:54 EST 2004
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/smoby/ref/tools
In directory pub.open-bio.org:/tmp/cvs-serv32411/src/org/smoby/ref/tools

Modified Files:
	KeywordQuery.java 
Log Message:
Misc fixes

moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/smoby/ref/tools KeywordQuery.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/smoby/ref/tools/KeywordQuery.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/smoby/ref/tools/KeywordQuery.java	2004/07/21 22:01:19	1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/semanticmoby.org/src/org/smoby/ref/tools/KeywordQuery.java	2004/11/04 22:37:54	1.2
@@ -79,14 +79,30 @@
 	
 	private String buildQueryString()
 	{
-		StringBuffer sb = new StringBuffer();
-		
-		addSelectClause(sb);
-		addFromClause(sb);
-		addJoinClauses(sb);
-		addCompareClauses(sb);
-		
-		return sb.toString();
+	    if (isAllProvidersQuery())
+	    {
+	        return "SELECT DISTINCT provider_uri FROM moby_keyword";
+	    }
+	    else
+	    {
+			StringBuffer sb = new StringBuffer();
+			
+			addSelectClause(sb);
+			addFromClause(sb);
+			addJoinClauses(sb);
+			addCompareClauses(sb);
+			
+			return sb.toString();
+	    }
+	}
+	
+	private boolean isAllProvidersQuery()
+	{
+	    return
+	    	(subjectKeywords.isEmpty()) &&
+	    	(objectKeywords.isEmpty()) &&
+	    	(providerKeywords.size() == 1) &&
+	    	(providerKeywords.get(0).toString().equals("%"));
 	}
 	
 	private void addSelectClause(StringBuffer sb)
@@ -136,7 +152,6 @@
 	
 	private void addCompareClauses(StringBuffer sb)
 	{
-
 		List prev = null;
 		
 		int index = 0;
@@ -181,7 +196,7 @@
 		sb.append("applies_to = '");
 		sb.append(appliesTo);
 		sb.append("') and ");
-		
+			
 		if (list.size() > 1)
 			sb.append("(");
 		
@@ -203,18 +218,4 @@
 		
 		sb.append(")");
 	}
-	
-//	public static void main(String[] args)
-//	{
-//		String[] pArray = new String[] { "p1", "p2" };
-//		String[] sArray = new String[] { "s1", "s2" };
-//		String[] oArray = new String[] { "o1", "o2", "o3" };
-//		
-//		KeywordQuery q = new KeywordQuery(
-//			Arrays.asList(pArray),
-//			Arrays.asList(sArray),
-//			Arrays.asList(oArray));
-//		
-//		System.out.println(q.buildQueryString());
-//	}
 }




More information about the MOBY-guts mailing list