changeset 353:1662745233d9 serializedQuery

serialized features query complete and tested
author mas01mc
date Fri, 07 Nov 2008 12:18:43 +0000
parents a22b18005853
children
files QueryADB.py audioDBws.h soap.cpp
diffstat 3 files changed, 33 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/QueryADB.py	Thu Nov 06 22:57:39 2008 +0000
+++ b/QueryADB.py	Fri Nov 07 12:18:43 2008 +0000
@@ -100,12 +100,17 @@
       %s
       %s
    </qVector>
+   <keyList></keyList>
+   <timesFileName></timesFileName>
    <queryType>32</queryType>
+   <queryPos>%s</queryPos>
    <pointNN>%s</pointNN>
    <trackNN>%s</trackNN>
    <sequenceLength>1</sequenceLength>
    <radius>%s</radius>
    <absolute-threshold>%s</absolute-threshold>
+   <relative-threshold>%s</relative-threshold>
+   <exhaustive>%s</exhaustive>
    <lsh-exact>%s</lsh-exact>
   </adb:shingleQuery>
  </SOAP-ENV:Body>
@@ -161,19 +166,34 @@
 
 
 
-###############  Shingle Query - Show the data closest to one shingle ###########
+###############  Shingle/Matrix Query - Show the data closest to shingle range ###########
+#
+# Encode features as a matrix with dim columns, and (optionally) powers as a matrix with one column
+# dim   # number of columns
+# f1,1 f1,2...f1,dim # first row
+# f2,1 f2,2...f2,dim
+# ...
+# fN,1 fN,2...fN,dim # last row
+# p1,1         # first row's power
+# p2,1
+# ...
+# pN,1         # last row's power
+#
 def RunShingleQuery():
 	global debug, dbName
 	featureDim = '3'
-	queryVector='<v>1.0</v><v>0.5</v><v>0.25</v>'
-	powerVector='<p>-1.0</p>'
-	pointNN = '10'
-	trackNN = '5'
-	queryRadius = '0.5'
+	queryVector='<v>1.0</v><v>0.5</v><v>0.25</v><v>0.5</v><v>1.5</v><v>1.0</v>'  # two rows
+	powerVector='<p>-1.0</p><p>-1.0</p>'
+	queryPos = '0'
+	pointNN = '2'
+	trackNN = '2'
+	radius = '0.0'
 	absoluteThreshold = '-4.5'
+	relativeThreshold = '0'
+	exhaustive = '0'
 	lshExact = '0'
 	message = SHINGLE_QUERY_TEMPLATE
-	message = SHINGLE_QUERY_TEMPLATE%(dbName, featureDim, queryVector, powerVector, pointNN, trackNN, queryRadius, absoluteThreshold, lshExact);
+	message = SHINGLE_QUERY_TEMPLATE%(dbName, featureDim, queryVector, powerVector, queryPos, pointNN, trackNN, radius, absoluteThreshold, relativeThreshold, exhaustive, lshExact);
 	# print message
 	print message
 	response = SendXMLCommand(message)
--- a/audioDBws.h	Thu Nov 06 22:57:39 2008 +0000
+++ b/audioDBws.h	Fri Nov 07 12:18:43 2008 +0000
@@ -71,5 +71,5 @@
 // Query an adb database by key
 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);
 
-// Query an audioDB database by vector (serialized)
-int adb__shingleQuery(xsd__string dbName, struct adb__queryVector qVector, xsd__int queryType, xsd__int pointNN, xsd__int trackNN, xsd__int sequenceLength, xsd__double radius, xsd__double absolute_threshold, xsd__int lsh_exact, struct adb__queryResponse &adbQueryResponse);
+// Query an audioDB database by vector (serialized), queryKey/featureFileName is here replaced with qVector
+int adb__shingleQuery(xsd__string dbName, struct adb__queryVector qVector, xsd__string keyList, xsd__string timesFileName, xsd__int queryType, xsd__int queryPos, xsd__int pointNN, xsd__int trackNN, xsd__int sequenceLength, xsd__double radius, xsd__double absolute_threshold, xsd__double relative_threshold, xsd__int exhaustive, xsd__int lsh_exact, struct adb__queryResponse &adbQueryResponse);
--- a/soap.cpp	Thu Nov 06 22:57:39 2008 +0000
+++ b/soap.cpp	Fri Nov 07 12:18:43 2008 +0000
@@ -282,7 +282,6 @@
   }
   argv[argv_counter] = NULL;
 
-
   try {
     audioDB(argc, (char* const*)argv, &adbQueryResponse);
     delete [] argv;
@@ -359,7 +358,7 @@
 }
 
 // Query an audioDB database by vector (serialized)
-int adb__shingleQuery(struct soap* soap, xsd__string dbName, struct adb__queryVector qVector, xsd__int queryType,xsd__int pointNN,xsd__int trackNN,xsd__int sequenceLength,xsd__double radius,xsd__double absolute_threshold,xsd__int lsh_exact,struct adb__queryResponse &adbQueryResponse){
+int adb__shingleQuery(struct soap* soap, xsd__string dbName, struct adb__queryVector qVector, xsd__string keyList, xsd__string timesFileName, xsd__int queryType, xsd__int queryPos, xsd__int pointNN, xsd__int trackNN, xsd__int sequenceLength, xsd__double radius, xsd__double absolute_threshold, xsd__double relative_threshold, xsd__int exhaustive, xsd__int lsh_exact, struct adb__queryResponse &adbQueryResponse){
 
   cout << "qvector[" << qVector.dim << " x " << qVector.__sizev/qVector.dim << "]: ";
   for(int k=0; k < qVector.__sizev ; k++)
@@ -424,9 +423,10 @@
   // and the feature dimensionality
   if(!sequenceLength)
     sequenceLength = qVector.__sizev/qVector.dim;
-  //  int retVal = adb__sequenceQueryByKey(soap, dbName, "", tmpFileName, queryType,"","",0,pointNN,trackNN,sequenceLength,radius,absolute_threshold,1,lsh_exact,adbQueryResponse);
 
-int retVal = adb__query(soap, dbName, tmpFileName, "", "", qVector.__sizep?tmpFileName2:0, queryType, 0, pointNN, trackNN, sequenceLength,radius, absolute_threshold, 0,0, lsh_exact,adbQueryResponse);
+  int retVal = adb__query(soap, dbName, tmpFileName, keyList, timesFileName, qVector.__sizep?tmpFileName2:0,
+			  queryType, queryPos, pointNN, trackNN, sequenceLength, radius, 
+			  absolute_threshold, relative_threshold, exhaustive, lsh_exact, adbQueryResponse);
 
   return retVal;
 }