# US 2006/0155683 A1 · System and method for database query

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2006/0155683 A1
- Document ID: US20060155683A1
- Status: Published application
- Kind: A1
- Application number: 11/034,390
- Filed: 2005-01-11
- Published: 2006-07-13
- Earliest claimed: 2005-01-11
- Assignees: International Business Machines Corporation
- Inventors: Matthew Bangel; Andrew Chang; James Martin; Douglas Murray
- Web page: https://patentgrep.com/patent/US20060155683A1

## CPC

- G06F 16/2445: {Data retrieval commands; View definitions}
- Y10S 707/99933: Query processing, i.e. searching
- Y10S 707/99934: Query formulation, input preparation, or translation
- Y10S 707/99935: Query augmenting and refining, e.g. inexact access
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- Y10S: TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS

## Abstract

A database is queried with on demand database query reduction A query document includes global variables selectively set off by first tags identifying a first global variable as a complete replacement variable and by second tags identifying a second global variable as a complete removal string. An agent is provided for building from the query document an expanded query by replacing any variables set off by first tags with runtime strings, setting off any unions in the query document, and selectively replacing any variables set off by second tags and removing the second tags without replacing variables set off by second tags.

## Claims

### Claim 1

A method for querying a database with on demand database query reduction, comprising:
receiving a query document with global variables selectively set off by first tags identifying a first global variable as a complete replacement variable and by second tags identifying a second global variable as a complete removal string; and
building from said query document an expanded query by replacing any variables set off by said first tags with runtime strings, setting off any unions in said query document, and selectively replacing any variables set off by said second tags and removing said second tags without replacing variables set off by said second tags.

### Claim 2 (depends on 1)

The method of claim 1, said selectively replacing step further comprising:
determining if a next given variable changes in each successive union and, if so, removing said second tags to leave this next given variable without replacement; and, if not, replacing said next given variable based on changing selection criteria.

### Claim 3 (depends on 2)

The method of claim 2, said selectively replacing step further comprising:
determining if said next given variable can change position in an output set and, if so, inserting nulls with variable replacement selectively above and below to shift output data in order.

### Claim 4 (depends on 1)

The method of claim 1, further comprising:
building from said query document and user input a control document specifying execution schedule, queries, global variables and union definitions.

### Claim 5 (depends on 4)

The method of claim 4, further comprising:
executing a runtime agent to monitor said control documents for a query to be run, and upon identifying such a query building and executing said expanded query.

### Claim 6

A computer program product for querying a database with on demand database query reduction, said computer program product comprising:
a computer readable medium;
first program instructions to receive a query document with global variables selectively set off by first tags identifying a first global variable as a complete replacement variable and by second tags identifying a second global variable as a complete removal string;
second program instructions to build from said query document an expanded query by replacing any variables set off by said first tags with runtime strings, setting off any unions in said query document, and selectively replacing any variables set off by said second tags and removing said second tags without replacing variables set off by said second tags; and wherein
said first and second program instructions are recorded on said medium.

### Claim 7 (depends on 6)

The computer program product of claim 6, said second program instructions further comprising:
third program instructions to determine if a next given variable changes in each successive union and, if so, removing said second tags to leave this next given variable without replacement; and, if not, replacing said next given variable based on changing selection criteria; and wherein
said third program instructions are recorded on said medium.

### Claim 8 (depends on 7)

The computer program product of claim 7, said second program instructions further comprising:
fourth program instructions to determine if said next given variable can change position in an output set and, if so, inserting nulls with variable replacement selectively above and below to shift output data in order.

### Claim 9 (depends on 6)

The computer program product of claim 6, further comprising:
fifth program instructions to build from said query document and user input a control document specifying execution schedule, queries, global variables and union definitions; and wherein
said fifth program instructions are recorded on said medium.

### Claim 10 (depends on 9)

The computer program product of claim 9, further comprising:
sixth program instructions to execute a runtime agent to monitor said control documents for a query to be run, and upon identifying such a query building and executing said expanded query; and wherein
said sixth program instructions are recorded on said medium.

### Claim 11

A system for querying a database with on demand database query reduction, comprising:
a query document with global variables selectively set off by first tags identifying a first global variable as a complete replacement variable and by second tags identifying a second global variable as a complete removal string; and
an agent for building from said query document an expanded query by replacing any variables set off by said first tags with runtime strings, setting off any unions in said query document, and selectively replacing any variables set off by said second tags and removing said second tags without replacing variables set off by said second tags.

### Claim 12 (depends on 11)

The system of claim 11, further comprising:
said agent further for determining if a next given variable changes in each successive union and, if so, removing said second tags to leave this next given variable without replacement; and, if not, replacing said next given variable based on changing selection criteria.

### Claim 13 (depends on 12)

The system of claim 12, further comprising:
said agent further for determining if said next given variable can change position in an output set and, if so, inserting nulls with variable replacement selectively above and below to shift output data in order.

### Claim 14 (depends on 11)

The system of claim 11, further comprising:
an agent for building from said query document and user input a control document specifying execution schedule, queries, global variables and union definitions.

### Claim 15 (depends on 14)

The system of claim 14, further comprising:
a runtime agent for monitoring said control documents for a query to be run, and upon identifying such a query for building and executing said expanded query.
