[CWB] Query lock violation

Stefan Evert stefanML at collocations.de
Wed Nov 24 20:02:34 CET 2010


> Hmms... but then, what's a query? I tried just  "europe";  and it didn't work as well. Probably I am not understanding the term correctly :)

That should work, and definitely _not_ produce a query lock violation.  Keep in mind that a bare query doesn't return any results in CWB::CQP, which sets "AutoShow off".  It's better to use the command

	A = "europe"

so you can access the query results under a well-defined name (rather than the implicit "Last" variable).

Query lock mode activates hooks in the parser that disallow _every_ command except for queries (assignment to a variable as in my example above is allowed).  That's about the only safe way to allow users to enter a CQP query through a Web interface without compromising your entire server.

The typical idiom in a Web interface would be:

$cqp->exec_query("A = $user_query");
($N) = $cqp->exec("size A");
if ($N > 0) {
	@lines = $cqp->exec("cat A");
}

Best,
Stefan



More information about the CWB mailing list