Query Languages: SQL - CQL: HS Practical Corpus Linguistics Tim Ladiges WS 2005/ 06
Query Languages: SQL - CQL: HS Practical Corpus Linguistics Tim Ladiges WS 2005/ 06
Keywords
Database Query Structured Query Language Corpus Query Language
What is a Database?
Structure to hold data Self-describing collection of integrated records Administered by Database Management System (DBMS) Relational databases are based on tables DB stores metadata in data dictionary (description of tables, columns, indexes,)
If data in DB satisfies conditions of query, SQL retrieves queried data Important how to formulate the query that will produce the words
Database Access
User
------------------------------Application Programs/Queries
DBMS
Software to Access Stored Data
Components of SQL
Data Definition Language (DDL) creation of relational databases containment hierarchy (tables, schemas, catalogs, database) Data Manipulation Language (DML)
Database maintenance
SSN
512687458 758420012 102254896 876512563
FirstName
Joe Mary Sam Sarah
LastName
Smith Scott Jones Ackerman
Address
83 First Street 842 Vine Ave. 33 Elm St. 440 U.S. 110
City
Howard Losantiville Paris Upton
State
Ohio Ohio New York Michigan
Sam Sarah
Jones Ackerman
Paris Upton
Disadvantages:
security questions arise
Corpus annotation?
Plain text, PoS-tagged, syntactically annotated, semantic tags
A CQL expression containing more than one atomic query may use the following binary operators: sequence one or more blanks between two queries matches cases where solutions to the first immediately precede solutions to the second. disjunction The | operator between two queries matches cases where either query is satisfied. join The * operator between two queries matches cases where both queries are satisfied in the order specified; the # operator between two queries matches cases where both queries are satisfied in either order.
SGML element A join query followed by a / operator and an SGML query matches cases where the joined query is satisfied within the scope of the SGML element. number A join query followed by a / operator and a number matches cases where the joined query is satisfied within the number of L-words specified.
Examples: cat _ dog finds three word phrases of which the first word is `cat' and the last is `dog !cat dog finds occurrences of `dog' not preceded by `cat' within the same document cat*dog finds occurrences of `cat' followed anywhere within the same document by `dog' cat#dog finds occurrences of `cat' followed or preceded by `dog' anywhere within the same document cat*dog/10 finds occurrences of `cat' followed by `dog' within ten words cat*dog/ finds occurrences of `cat' followed by `dog' within a single <head> element
Resources
Merz, Charlotte: Gastreferat zur Vorlesung Korpuslinguistik mit und fr Computerlinguistik, 3.12.2002. http://www.ifi.unizh.ch/cl/volk/corpling/Vorl_07_Korpus-Abfrage.pdf Taylor, Allen G. (1998) SQL for Dummies, 3rd Edition, Foster City, CA, IDG Books Worldwide, Inc. Reference Guide to the SARA Windows Client http://www.natcorp.ox.ac.uk/getting/chap4.htm#FIMNU Tutorial on SQL http://riki-lb1.vet.ohiostate.edu/mqlin/computec/tutorials/SQLTutorial.htm