changeset 328:7ff56cce3297

Added WS support for Radius search by featureFileName via adb__sequenceQueryByKey(). Added relative path support for non-large ADB.
author mas01mc
date Sat, 30 Aug 2008 13:41:50 +0000
parents cb53c45718e6
children 8f11ea4d9cd2
files audioDB.cpp audioDB.h audioDBws.h gengetopt.in soap.cpp
diffstat 5 files changed, 32 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/audioDB.cpp	Fri Aug 29 20:16:10 2008 +0000
+++ b/audioDB.cpp	Sat Aug 30 13:41:50 2008 +0000
@@ -37,9 +37,12 @@
   }
 
   // Perform database prefix substitution
-  if(adb_root)
+  if(dbName && adb_root)
     prefix_name((char** const)&dbName, adb_root);
 
+  if(inFile && adb_feature_root)
+    prefix_name((char** const)&inFile, adb_feature_root);
+
   if(O2_ACTION(COM_SERVER))
     startServer();
 
@@ -55,7 +58,7 @@
   else if(O2_ACTION(COM_QUERY))
     if(isClient){
       if(query_from_key)
-	ws_query_by_key(dbName, key, (char*)hostport);	
+	ws_query_by_key(dbName, key, inFile, (char*)hostport);	
       else
 	ws_query(dbName, inFile, (char*)hostport);
     }
@@ -93,8 +96,10 @@
     isServer = 1; // FIXME: Hack
     processArgs(argc, argv);
     // Perform database prefix substitution
-    if(adb_root)
+    if(dbName && adb_root)
       prefix_name((char** const)&dbName, adb_root);
+    if(inFile && adb_feature_root)
+      prefix_name((char** const)&inFile, adb_feature_root);
     assert(O2_ACTION(COM_QUERY));
     query(dbName, inFile, adbQueryResponse);
   } catch(char *err) {
@@ -109,8 +114,10 @@
     isServer = 1; // FIXME: Hack
     processArgs(argc, argv);
     // Perform database prefix substitution
-    if(adb_root)
+    if(dbName && adb_root)
       prefix_name((char** const)&dbName, adb_root);
+    if(inFile && adb_feature_root)
+      prefix_name((char** const)&inFile, adb_feature_root);
     assert(O2_ACTION(COM_STATUS));
     status(dbName, adbStatusResponse);
   } catch(char *err) {
--- a/audioDB.h	Fri Aug 29 20:16:10 2008 +0000
+++ b/audioDB.h	Sat Aug 30 13:41:50 2008 +0000
@@ -383,7 +383,7 @@
   void startServer();
   void ws_status(const char*dbName, char* hostport);
   void ws_query(const char*dbName, const char *featureFileName, const char* hostport);
-  void ws_query_by_key(const char*dbName, const char *trackKey, const char* hostport);
+  void ws_query_by_key(const char*dbName, const char *trackKey, const char* featureFileName, const char* hostport);
   
 };
 
--- a/audioDBws.h	Fri Aug 29 20:16:10 2008 +0000
+++ b/audioDBws.h	Sat Aug 30 13:41:50 2008 +0000
@@ -46,4 +46,4 @@
 // Query an existing adb database
 int adb__query(xsd__string dbName, xsd__string qKey, xsd__string keyList, xsd__string timesFileName, xsd__int qType, xsd__int qPos, xsd__int pointNN, xsd__int segNN, xsd__int segLen, struct adb__queryResponse &adbQueryResponse);
 
-int adb__sequenceQueryByKey(xsd__string dbName,xsd__string trackKey,xsd__int queryType,xsd__string trackFileName,xsd__string timesFileName,xsd__int queryPoint,xsd__int pointNN,xsd__int trackNN,xsd__int sequenceLength,xsd__double radius,xsd__double absolute_threshold,xsd__int usingQueryPoint,xsd__int lsh_exact,struct adb__queryResponse &adbQueryResponse);
+int adb__sequenceQueryByKey(xsd__string dbName,xsd__string trackKey, xsd__string featureFileName, xsd__int queryType,xsd__string trackFileName,xsd__string timesFileName,xsd__int queryPoint,xsd__int pointNN,xsd__int trackNN,xsd__int sequenceLength,xsd__double radius,xsd__double absolute_threshold,xsd__int usingQueryPoint,xsd__int lsh_exact,struct adb__queryResponse &adbQueryResponse);
--- a/gengetopt.in	Fri Aug 29 20:16:10 2008 +0000
+++ b/gengetopt.in	Sat Aug 30 13:41:50 2008 +0000
@@ -8,7 +8,7 @@
 section "Database Operations" sectiondesc="All database operations require a database argument."
 
 option "database" d "database file required by Database commands." string typestr="filename" optional
-option "adb_root" - "path prefix for database" string typestr="path" dependon="database" optional
+option "adb_root" - "path prefix for database" string typestr="path" optional
 
 section "Database Creation" sectiondesc="Creating a new database file."
 
--- a/soap.cpp	Fri Aug 29 20:16:10 2008 +0000
+++ b/soap.cpp	Sat Aug 30 13:41:50 2008 +0000
@@ -51,7 +51,7 @@
 }
 
 // WS_QUERY_BY_KEY (CLIENT SIDE)
-void audioDB::ws_query_by_key(const char*dbName, const char *trackKey, const char* hostport){
+void audioDB::ws_query_by_key(const char*dbName, const char *trackKey, const char* featureFileName, const char* hostport){
   struct soap soap;
   adb__queryResponse adbQueryResponse;  
   /*  JUST TRY TO USE A DATA STRUCTURE WITH PHP
@@ -72,18 +72,19 @@
   soap_init(&soap);  
   if(queryType==O2_SEQUENCE_QUERY || queryType==O2_N_SEQUENCE_QUERY){
     if(soap_call_adb__sequenceQueryByKey(&soap,hostport,NULL,
-					   (char*)dbName,
-					   (char*)trackKey,
-					   queryType,
-					   (char*)trackFileName,
-					   (char*)timesFileName,
+					 (char*)dbName,
+					 (char*)trackKey,
+					 (char*)featureFileName,
+					 queryType,
+					 (char*)trackFileName, // this means keyFileName 
+					 (char*)timesFileName,
 					   queryPoint,
-					   pointNN,
-					   trackNN,
-					   sequenceLength,
-					   radius,
-					   absolute_threshold,
-					   usingQueryPoint,
+					 pointNN,
+					 trackNN,
+					 sequenceLength,
+					 radius,
+					 absolute_threshold,
+					 usingQueryPoint,
 					   lsh_exact,
 					 adbQueryResponse)==SOAP_OK){
       //std::std::cerr << "result list length:" << adbQueryResponse.result.__sizeRlist << std::std::endl;
@@ -179,8 +180,9 @@
 
 int adb__sequenceQueryByKey(struct soap* soap,xsd__string dbName,
 			    xsd__string trackKey,
+			    xsd__string featureFileName,
 			    xsd__int queryType,
-			    xsd__string trackFileName,
+			    xsd__string keyFileName,
 			    xsd__string timesFileName,
 			    xsd__int queryPoint,
 			    xsd__int pointNN,
@@ -222,10 +224,10 @@
     qtypeStr,
     COM_DATABASE,
     dbName, 
-    COM_QUERYKEY,
-    ENSURE_STRING(trackKey),
+    strlen(trackKey)?COM_QUERYKEY:COM_FEATURES,
+    strlen(trackKey)?ENSURE_STRING(trackKey):ENSURE_STRING(featureFileName),
     COM_KEYLIST,
-    ENSURE_STRING(trackFileName),
+    ENSURE_STRING(keyFileName),
     usingQueryPoint?COM_QPOINT:COM_EXHAUSTIVE,
     usingQueryPoint?qPosStr:"",
     COM_POINTNN,