Patent ID: 8239400

Claim:
A computer implemented method, comprising: receiving a selection of a portion of a first query having a plurality of portions, wherein the first query comprises an abstract query posed against a database abstraction model for a physical database; annotating the selected portion of the first query by operation of one or more computer processors and responsive to receiving, via an interface: (i) an annotation for the selected portion of the first query and (ii) a request to annotate the selected portion of the first query with the annotation; receiving a suggested substitution for the annotated portion of the first query; and storing, on a storage medium, the annotation and the suggested substitution with a reference to the annotated portion of the first query, wherein the interface is configured to present the annotation in conjunction with the suggested substitution and a user interface element for a user composing a second query to request the annotated portion to be programmatically replaced with the suggested substitution in the second query, wherein storing the annotation with a reference to the portion of the first query comprises: substituting a parameter marker for a first instance value contained in the portion of the first query and storing the portion of the first query with the parameter marker with the annotation; wherein replacing the annotated portion with the suggested substitution comprises at least one of: substituting a second instance value for the parameter marker in the second query; replacing the annotated portion with user-specified query logic; and augmenting the annotated portion with user-specified query logic; wherein a search is performed to identify annotations pertaining to the second query, wherein the annotation is determined to pertain to the second query by at least one of: determining that the instance is identical to the annotated portion of the first query and determining, based on one or more predetermined matching rules, that the instance semantically matches the annotated portion of the first query; and wherein at least a second annotation is not determined to pertain to the second query.