it is to be understood that the figures and descriptions of the present invention have been simplified to illustrate elements that are relevant for a clear understanding of the present invention , while eliminating , for purposes of clarity , many other elements found in typical querying methods and systems . however , because such elements are well known in the art , and because they do not facilitate a better understanding of the present invention , a discussion of such elements is not provided herein . the disclosure herein is directed to all such variations and modifications known to those skilled in the art . according to an aspect of the present invention , an approach that builds on the observation that , across myriad sources , query forms seem to reveal some “ concerted structure ,” by sharing common building blocks may be used . toward this insight , one may hypothesize the existence of a hidden syntax that guides the creation of query interfaces , albeit from different sources . this hypothesis effectively transforms query interfaces into a visual language with a non - prescribed grammar and , thus , their semantic understanding a parsing problem . such a paradigm enables principled solutions for both declaratively representing common patterns , by a derived grammar , and systematically interpreting query forms , by a global parsing mechanism . to realize this paradigm , one may address the challenges of a hypothetical syntax , that it is to be derived , and that it is secondary to the input . as the heart of a form extractor , one may use a 2p grammar and a best - effort parser , which together realize a parsing mechanism for a hypothetical syntax . according to an aspect of the present invention , it is believed that one may achieve above an 85 % accuracy for extracting query conditions across random sources . as query interfaces are created autonomously , automatic extraction of form semantics is clearly challenging . there seems to be some common “ patterns ” emerging from heterogeneous query forms . this impression suggests that web forms are not entirely chaotic ( which , if so , would render automatic extraction unlikely ). considering these patterns as the building blocks , or vocabulary , for constructing query forms , one may ascertain this vocabulary . using search engines ( e . g ., google . com ) and web directories ( e . g ., invisibleweb . com ), 150 sources were collected , which serves as a basic dataset , with 50 in each of books , automobiles , and airfares domains . these sources include familiar ones , e . g ., amazon . com and aa . com as shown in fig3 . these domains were chosen as they are schematically dissimilar and semantically unrelated , and thus constitute a diverse “ sample ” of web sources . the survey established that query interfaces reveal some concerted structure : such that about 25 condition patterns may be suitable for use , which is surprisingly small as a vocabulary for online queries . exemplary patterns are illustrated in fig1 . fig4 ( a ) summarizes the occurrences of 21 “ more - than - once ” patterns . the figure marks ( x , y ) with a “+” if pattern y occurs in source x . as more sources are seen ( along the x - axis ), the growth ( along y ) of the vocabulary slows down and thus the curve flattens rapidly . further , one may observe that the convergence generally spans across different domains ( e . g ., automobiles and airfares are mostly reusing the patterns from books ), which indicates that most condition patterns are quite generic and not domain specific . one may also observe that the distribution is extremely non - uniform : fig4 ( b ) ranks these 21 patterns according to their frequencies , for each domain and overall . a characteristic zipf - distribution may be observed , which means that a small set of top - ranked patterns is very frequently used . accordingly , according to an aspect of the present invention , one may imply that the small and converging vocabulary , which occurs across autonomous sources and even across diverse domains , indicates that there are conventions ( or “ design patterns ”) emerging among web query forms . while each form is different , together they share a relatively small set of vocabulary . further , the non - uniform distribution of patterns suggests that , to leverage such conventions , even if one can not exhaustively cover all patterns , a few frequent ones will likely pay off significantly . the concerted - structure illustrates that form understanding can be promising , by leveraging , presentation conventions . intuitively , given a query form , one may thus build an understanding of it by decomposing it into some known patterns , each of which has been seen before . thus , an interpretation of an interface unseen before may be assembled of known patterns . this “ divide - and - conquer ” approach allows a small vocabulary of such patterns to be shared across diverse query forms . to use these layout patterns , it may be tempting to “ simply ” code up each pattern as a rule - of - thumb , e . g ., the pairwise - proximity grouping heuristic . however , to specify these patterns , such procedural description will involve convoluted code , lacking both generality and extensibility . further , to recognize these patterns , it is far from clear , beyond individual heuristics , how they together form a coherent interpretation of the query form . accordingly , a hidden syntax behind web query interfaces , across different sources , may be leveraged . this rationalizes the observed concerted structure . as fig1 illustrates , a query form creation as guided by such a hypothetical syntax , which connects semantics ( i . e ., query conditions ) to presentations ( i . e ., query forms ) may be used . such a hidden syntax represents the presentation conventions across web forms . unlike traditional string languages ( e . g ., programming languages ), this syntax uses visual effects to express the embedded semantics ( e . g ., pattern 1 in fig3 ( c ) arranges the attribute to be left - adjacent and bottom - aligned to the input field ). thus , a new paradigm is brought forward : viewing query interfaces as a formal language , and in particular , a visual language , whose composition conforms to a hidden , i . e ., non - prescribed , grammar . their semantic understanding , as the inverse , is thus a parsing problem . this “ language ” paradigm further enables a principled algorithmic framework for form understanding — a task that appears inherently heuristic at first . by the hidden - syntax hypothesis , one may resort to a formal framework for languages . that is , according to an aspect of the present invention , the dual notions of a grammar and a parser together provide a systematic framework for both specifying and recognizing common patterns . for pattern specification , the grammar provides a declarative mechanism . such patterns ( e . g ., fig3 ( c )) may simply be declared by productions ( i . e ., grammar rules ) that encode associated visual characteristics . the specification of patterns is thus declarative , fully separated from and independent of how they are recognized individually and assembled globally by the parser . by incorporating arbitrary spatial relations ( instead of , say , only proximity ), one can describe complex visual patterns . by building productions upon productions , one can describe patterns of different “ orders .” one may also simply augment the grammar to add new patterns , leaving the parsing untouched . for pattern recognition , the parser provides a global mechanism for systematically constructing a parse tree as a coherent interpretation of the entire query interface . such a parse naturally structures elements in nested sub - trees , thus satisfying the grouping requirement . further , it assigns grammatical alphabet symbols ( terminals and non - terminals ) to each construct , thus satisfying the tagging requirement . finally , it should be noted that such parsing leverages not only individual patterns but also their coherent assembly into an entire query form , thus resolving local conflicts by a global context . parsing thus systematically realizes the intuitive “ divide - and - conquer ” approach . as the hidden syntax enables a new paradigm , it may present new challenges . for example , as this hypothetical nature implies , the grammar is non - prescribed . that is , instead of being prescribed before query forms are created , it is simply derived from whatever conventions naturally emerge . further , the grammar may be secondary to any language instance . that is , instead of dictating form creation , it may rely on the language &# 39 ; s natural convergence to derive any convention . thus , first , for capturing the hypothetical syntax , the grammar may represent “ conventions ” used for web form presentation . further , while one may ideally want to capture all patterns across many forms , unlike in a carefully - orchestrated grammar , these patterns may not be mutually “ compatible .” one may thus rethink the right mechanism for such a derived grammar , to capture necessary conventions for enabling parsing . second , a derived grammar may be inherently incomplete ( with uncaptured patterns ) and ambiguous ( with conflicting patterns ). thus , such a grammar may only be secondary to input . further , unlike traditional parsing , a parser according to the present invention may not reject input query forms , even if not fully parsed , as “ illegal .” that is , the parser may no longer “ police ” a language for checking and enforcing grammar rules . it may instead be a “ soft ” parser that accepts any input . the right semantics for such a soft parser , and further , its realization should thus be accordingly derived . according to an aspect of the present invention , one may build upon the traditional language framework . first , as a derived grammar for capturing the hypothetical syntax , the 2p grammar encodes not only “ patterns ” but also their “ precedence .” second , as a soft - parser directed by a hypothetical syntax , when a single perfect parse does not exist , the best - effort parser resolves ambiguities as much as possible and constructs parse trees as large as possible . to capture the hidden syntax , a grammar may be used to encode two complementary types of presentation conventions . on one hand , ideally all conventional patterns are captured . on the other hand , however , by capturing many patterns , some will conflict , and thus a conventional precedence ( or “ priorities ”) may also be captured . the grammar mechanism may encode both conventions by productions and preferences respectively ( and thus the 2p name ). that is , it may capture knowledge for both pattern construction ( by productions ) and ambiguity resolution ( by preferences ). according to an aspect of the present invention a 2p grammar may take the form of a 5 - tuple ( σ , n , s , p d , p f ), where σ is a set of terminal symbols , n is a set of nonterminal symbols , sεn is a start symbol , p d is a set of production rules , and p f is a set of preference rules . this 2p grammar mechanism may be used to express the hypothetical syntax . such a grammar may be derived from analyzing and abstracting common patterns . in turn , a best - effort parser works with the hypothetical syntax . as explained earlier , a derived grammar will be inherently ambiguous and incomplete . a “ soft parser ” that assembles parse trees that may be multiple ( because of ambiguities ) and partial ( because of incompleteness ), instead of insisting on a single perfect parse may be used . first , it may prune ambiguities , as much ( and as early ) as possible , by employing preferences ( as in the 2p grammar ). second , it may recognize the structure ( by applying productions ) of the input form , as much as possible , by maximizing partial results . in general , a form extractor may be built in a language - parsing framework . given an input html query form , the form extractor outputs its semantic model ( or the query capabilities ) of the form . at the heart , the best effort parser may work with a derived 2p - grammar to construct multiple and partial parse trees . as preprocessing , a tokenizer may prepare the input to the core parser , by converting the input html form into a set of basic tokens , which are the atomic units in the visual grammatical composition . as post - processing , the merger integrates the output of the parser to generate the final semantic model . more particularly , at the front - end , the tokenizer converts an html query form ( in a web page ) into a set of tokens , each representing an atomic visual element on the form . these tokens are instances of the terminals σ as the 2p grammar defines . each token thus has a terminal type and some attributes recording properties necessary for parsing . for instance , given the html fragment ( as part of interface q aa ), as shown in fig5 , the tokenizer extracts a set t of 16 tokens . in particular , token s 0 is a text terminal , with attributes sval =“ author ” ( its string value ) and pos =( 10 , 40 , 10 , 20 ) ( its bounding - box coordinates ). although different terminals have different attributes , this pos attribute is universal , as the grammar captures two dimensional layout . such a tokenizer thus essentially builds on a layout engine for rendering html into its visual presentation . in particular , the tokenizer may use the html document object model ( dom ) api ( available in browsers , e . g ., internet explorer ), which provides access to html tags and their positions . at the back - end , the merger combines the multiple partial parse trees that the parser outputs , to compile the semantic model and report potential errors ( if any ). since the parser is rather generic , this step applies application ( i . e ., query form ) specific processing . first , as the goal is to identify all the query conditions , the merger combines multiple parse trees by taking the union of their extracted conditions . as each parse covers different parts of the form , this union enhances the coverage of the final model constructed . for example , given a fragment of interface q aa , as fig1 shows , the parser will generate three partial parses ( trees 2 , 3 , 4 in the figure ). their union covers the entire interface and generates all the conditions . the merger also reports errors , which are useful for further error handling by a “ client ” of the form extractor . two types of errors may be reported . first , a conflict occurs if the same token is used by different conditions . in fig1 , tree 2 associates the number selection list with number of passengers , while tree 3 with adults , and thus they conflict by competing for the number selection . ( in this case , tree 3 is the correct association .) second , a missing element is a token not covered by any parse tree . the merger reports both types of errors for further client - side handling . as the key component in the parsing framework , the 2p grammar captures presentation conventions of web interfaces . specifically , the 2p grammar declaratively and comprehensively specifies both condition patterns and their precedence , as a principled way to express a derived syntax and to resolve potential ambiguities . in particular , productions formally specify common condition patterns and preferences their relative precedence . since the condition patterns establish a small set of building blocks for web interfaces , appropriate presentational characteristics to capture those condition patterns as productions may be used . in particular , in query interfaces , visual effects such as topology ( e . g ., alignment , adjacency ) and proximity ( e . g ., closeness ) are frequently used for expressing semantically related components and thus are the candidates to be captured by productions . some features , such as proximity , work well for simple interfaces . however , it may be difficult to extend this to complex interfaces , which difficulty can often result in incorrect interpretations . on the other hand , topology features such as alignment and adjacency ( e . g ., left , above ) often accurately indicate the semantic relationships among the components in query interfaces . according to an aspect of the present invention , topological information may be analyzed in the productions , to capture condition patterns . two - dimensional grammars have been proposed in visual languages to realize such specifications of visual patterns , e . g ., relational grammar , constraint multiset grammar , positional grammar . the 2p grammar ( without considering the preferences ) may be considered a special instance of attributed multiset grammar , where a set of spatial relations capturing topological information ( e . g ., left , right ) are used in productions . the main extension of two dimensional grammars from string grammars ( e . g ., for programming languages ) is to support general constraints . in two dimensional grammars , productions need to capture spatial relations , which essentially are constraints to be verified on the constructs . for example , consider production p 5 in fig6 . to capture the pattern textop ( used by author in interface q aa ), attr may be specified as being left to val and op below to val . ( note that , in the 2p grammar , adjacency may be implied in all spatial relations and thus omitted in the constraint names ). in contrast , productions in string grammars only use one constraint , the sequentiality among components . as a consequence , such extension leads to adaptations in other aspects of the productions . specifically , to support the general constraints , each symbol has a set of attributes ( e . g ., pos of attr , op and val ), which stores the information used in constraints evaluation ( e . g ., left , below ). further , each production has a constructor , which defines how to instantiate an instance of the head symbol from the components . for example , after applying the production p 5 to generate a new textop instance i , the constructor computes i &# 39 ; s position from its components . formally , we define the production as : a production p in a 2p grammar g =( σ , n , s , pd , pf ) is a four - tuple ( h , m , c , f ): head hεn is a nonterminal symbol ; components m ≡ σ ∪ n is a multiset of symbols ; constraint c is a boolean expression defined on m ; and constructor f is a function defined on m , returning an instance of h . referring now to fig6 , there is shown an example 1 , wherein grammar g that specifies 11 productions labeled from p 1 to p 11 . each production defines a non - terminal ( e . g ., textop and enumrb ) as its head . the start symbol is qi and the terminal symbols are text , textbox and radiobutton . note that , to simplify the illustration , the production constructors have been omitted in fig6 . productions p 3 to p 11 capture three patterns ( patterns 1 and 2 in fig3 ( c ) in addition to textop introduced above ). productions p 1 and p 2 capture the form pattern by which condition patterns are arranged into query interfaces . in particular , we consider a query interface qi as composing of vertically aligned “ rows ” hqi , where each hqi further composes of horizontally aligned condition patterns cp . as will be understood by those possessing an ordinary skill in the pertinent arts , productions provide a general and extensible mechanism for describing patterns . first , it can express patterns of different “ orders ”: such that complex patterns are built upon simpler ones . for example , pattern textop is constructed from simpler patterns attr , op and val , and in turn serves as the basis of higher order patterns such as qi . second , being extensible , it may incorporate new patterns and new constraints , while leaving the parsing algorithm untouched . as is discussed below , by changing the grammar , exactly the same parsing framework can be used for other applications . for derived grammars , precedence may be used to resolve conflicts among patterns , and thus form an integral component of the 2p grammar . while the grammar may capture as many common ( but non - prescribed ) patterns as possible , those patterns may not be “ compatible ,” which results in significant ambiguities . to resolve those ambiguities , a preference framework which captures the conventional precedence among condition patterns may be used . again , an ambiguity results when there exist multiple interpretations for the same token , and therefore these interpretations conflict on such a token . as example 2 , to capture the condition pattern textval used by from condition in q aa and pattern rbu used in q am , one may define productions p 4 and p 9 respectively . however , such generality brings ambiguities , allowing a token to be interpreted differently by different patterns . consider the text token s 1 ( i . e ., “ first name / initial and last name ”) in fig5 , pattern textval ( p 4 ) and rbu ( p 9 ) have different interpretations on s 1 , as fig7 shows . in particular , textval interprets it as an attr instance ai in a textval instance i 1 ( fig7 ( a )). in contrast , rbu interprets it as the text of a rbu instance i 2 ( fig7 ( b )). since conflicting on s 1 , i 1 and i 2 cannot appear in the same parse tree . thus , the existence of ambiguities may cause parsing inefficient and inaccurate . it is inefficient because of local ambiguities . that is , the parser may generate “ temporary instances ” that will not appear in any complete parse tree . an ambiguity first name / initials and last name instance between two instances is local if at least one of them is a temporary instance . again considering the above example 2 , i 1 is a temporary instance , since we cannot further derive a complete parse tree from i 1 . in contrast , we can derive complete parse trees from i 2 ( as fig9 shows two ). hence , such an ambiguity is local because it can eventually be resolved at the end of parsing . according to an aspect of the present invention , the parser may generally follow a bottom - up exhaustive approach , which explores all possible interpretations . therefore , the existence of local ambiguities may make parsing very inefficient due to the generation of many “ temporary instances .” in contrast , global ambiguities make the parsing results inaccurate . that is , the parsing may generate more parse trees than the semantically correct one . an ambiguity between two instances is global if they lead into different parse trees , and thus cannot be resolved even at the end of parsing . as example 3 , to capture radio button lists of arbitrary length , production p 8 is defined in a recursive way . as a result , a radio button list of length three can have four interpretations , depending on how they are grouped . fig8 shows such two —( a ) as a single list or ( b ) as three individual lists with each of length one . the ambiguity between these two interpretations is global , because they eventually lead to two different parse trees , as fig9 shows . the first one takes the entire list as an operator of author , while the second takes each list ( of length 1 ) as a condition pattern enumrb . the effect of the inherent ambiguities may be significant . for instance , the simple query interface in fig5 has one correct parse tree containing 42 instances ( 26 non - terminals and 16 terminals ). however , applying a basic parsing approach that exhausts all possible interpretations by “ brute - force ,” 25 parse trees and 773 instances ( 645 temporary instances and 128 non temporary ones ) may be deduced . conflicting instances may further participate in generating other instances , which in turn conflict , thus causing such a significant misinterpretation . such exponential aggregation makes ambiguity a significant problem in parsing . to resolve the significant ambiguities among condition patterns , one may prioritize patterns of a derived grammar . the derived nature of our hidden syntax implies that such precedence comes from “ hidden priority conventions ” across patterns . in predefined grammars , the creation of a grammar is prior to that of the corresponding language , therefore how to resolve ambiguity is determined apriori . however , in derived grammars , the precedence itself is part of conventions to be derived from the language , and thus cannot be arbitrarily decided . according to an aspect of the present invention , one may use the preference to encode conventional precedence across patterns . by way of example 4 , there are two conflicting instances , a 1 and i 2 in the above example 2 . one may observe that text and its preceding radio button are usually tightly bounded together , therefore when conflicting , i 2 is more likely to have a higher priority than a 1 . such convention of the precedence between patterns may be used to resolve ambiguities . in particular , a precedence convention may be encoded as a “ preference ” ri : when an rbu instance and an attr instance conflict on a text token , we arbitrate unconditionally the former as the winner . in general , a convention may also carry a criterion for picking the winner . for example , for the ambiguity described above , one may observe that a row of radio buttons is usually used as a single longer list rather than separate shorter ones . therefore , we define a preference r 2 : when two rblist instances conflict , and if one subsumes the other , pick the longer one as the winner . specifically , each preference resolves a particular ambiguity between two types of conflicting instances by giving priority to one over the other . as the above example motivates , such a preference needs to specify the situation and the resolution . the situation indicates the type of conflicting instances ( e . g ., rblist in preference r 2 ) and the conflicting condition ( e . g ., subsume ). the resolution describes the criteria that the winner instance should satisfy ( e . g ., longer ). formally , the preference may be defined as : a preference r in a 2p grammar g =( σ , n , s , pd , pf ) is a three - tuple & lt ; i , u , w & gt ;: conflicting instances i =& lt ; v 1 : a , v 2 : b & gt ;, where a , b εn ∪ σ , identifies the types of instances v 1 and v 2 respectively . conflicting condition u is a boolean expression on v 1 , v 2 that specifies a conflicting situation to be handled . winning criteria w is a boolean expression on v 1 , v 2 that specifies the criteria to pick v 1 as the winner . with 2p grammar capturing the conventions of condition patterns and their preferences , a best - effort parsing algorithm that on one hand makes use of preferences to prune the wrong interpretations in a timely fashion , and on the other hand handles partial results to achieve maximum interpretations for the input may be employed . with potential ambiguities and incompleteness , the best effort parser operates on a basic framework , the fix - point evaluation as described in r . helm , k . marriott , and m . odersky , building visual language parsers , in proceedings on human factors in computing systems ( chi ), pages 105 - 112 , 1991 , that progressively and concurrently develops multiple parse trees . the essential idea is to continuously generate new instances by applying productions until reaching a fix - point when no new instance can be generated . for example , as fig1 conceptually shows , the parser starts from a set of tokens t ( fig5 ), iteratively constructs new instances and finally outputs parse trees . in particular , by applying the production p 9 , one may generate an rbu instance from the text token s 1 and radiobutton r 1 . further , with the production p 8 , the rbus in a row together generate an rblist instance . continuing this process , one may eventually reach the fix - point . a complete parse tree corresponds to a unique instance of the start symbol qi that covers all tokens , as fig1 conceptually shows one . however , due to the potential ambiguities and incompleteness , the parser may not derive any complete parse tree and only end up with multiple partial parse trees . upon this framework , we realize the “ best - effort ” philosophy using : ( 1 ) just - in - time pruning to prune the parse trees with wrong interpretations as much and as early as possible ; and , ( 2 ) partial tree maximization to favor the parse trees that interpret an input as much as possible . fig1 shows an embodiment of a best - effort parsing algorithm 2pparser . corresponding to the above two components , the algorithm has two phases : first , parse construction with just - in - time pruning , and second , partial tree maximization at the end of parsing . to achieve just - in - time pruning , we schedule the symbols ( by procedure bidschdgraph , explained below ) in a proper order so that false instances are pruned timely before further causing more ambiguities . according to the scheduled order , we instantiate the symbols one by one with a fixed point process ( by instantiate ). preferences are enforced at the end of each iteration ( by enforce ) to detect and remove the false instances in this round . when an instance is invalidated , we need to erase its negative effect : false instances may participate in further instantiations and in turn generate more false parents . procedure rollback is used to remove all those false ancestors to avoid further ambiguity aggregation . finally , after parse construction phase , prhandler chooses the maximum parse trees generated in the parse construction phase and outputs them . for example , and referring now to fig1 a - 17c collectively , there is shown an exemplary flow diagram 100 for a parser according to an aspect of the present invention . the parser first builds a dependency graph for scheduling symbols 110 . the parser then finds a topological order for the symbols 120 . the parser then instantiates the symbols , one - by - one , with a fix - point process 130 . preferences may then be enforced to detect invalidated instances 140 . if necessary , a rollback may be performed to remove the effects of invalidated instances 150 . the maximum parse tree may then be selected as the result 160 , and returned 170 . process bldschdgraph may proceed along the lines of fig1 b . for example , the value of v may be set according to v = σ + n at step 200 . the d - edges of productions may then be added into e 210 . the acrylic r - edges of preferences may then be added 220 . the acrylic indirect r - edges of preferences may then be added 230 . finally ( v , e ) may be returned 240 . turning now to fig1 c , process instantiate may proceed along the lines shown there in . for example , an initial result may be instantiated 310 . all of the productions , with a proper head of the list may then be used to generate instances 320 . it may then be determined if the instantiation has changed 330 . if so , step 320 may be repeated . if not , the result may be returned 340 . the complexity of the membership problem ( i . e ., given grammar g , a sentence s , to determine whether sεl ( g )) for visual languages is np - complete . the algorithm may thus run in exponential time with respect to the number of tokens . however , in practice , the use of preferences gives reasonably good performance . given a query interface of size about 25 ( number of tokens ), parsing takes about 1 second . parsing 120 query interfaces with average size 22 takes less than 100 seconds . ( the time measured here only includes the parsing time without tokenization and merger .) to prune false instances as much and as early as possible , a good timing may be used for enforcing the preferences . such timing would guarantee that any false instance is removed before participating in further instantiations , therefore no rollback is necessary . however , applying preferences whenever a new instance is generated in the basic fix - point algorithm cannot achieve so . for example ( example 5 ), with the preference r 1 ( defined in example 4 ) which resolves the local ambiguity in example 2 , the aftr instance a 1 should be removed by the rbu instance i 2 . but , what if a 1 is generated at the very beginning of parsing , while i 2 is generated at the end ? a 1 will still instantiate instance i 1 ( and possibly others ), and only be removed at the end of parsing ( when i 2 is generated ). this “ late pruning ” makes the preference ri ineffective in controlling ambiguity aggregation . to address the problem , one may generate the winner instance ( e . g ., i 2 ) before the loser ( e . g ., a 1 ) so that the loser can be detected and pruned whenever it is generated . essentially , one may schedule the instance generation in some desired order consistent with the preferences . as preferences are defined on symbols , to guarantee the order on particular instances , one may enforce such an order on symbols so that the winner symbol produces all its instances before the loser does . therefore , such symbol - by - symbol instantiation and winner - then - loser order can guarantee that instances are produced in a desired order to ensure just - in - time pruning . to realize the symbol - by - symbol instantiation , the symbols may be processed in a “ children - parent ” direction defined by the productions . for example , consider symbol textop , as the production p 5 defines , the symbols that contribute to the instantiation of textop are attr , op and val . before one processes textop , those children symbols may be processed first . further , to realize the winner - then - loser order , the winner symbol ( e . g ., rbu in example 5 ) may be scheduled before the loser ( e . g ., attr ). to schedule the symbols by the above two orders , one may build a 2p schedule graph . the graph consists of the symbols as nodes and two types of edges — d - edges to capture the “ children - parent ” order defined by the productions and r - edges to capture the winner - then - loser order defined by the preferences . for example , ( example 6 ), fig1 ( c ) shows the 2p schedule graph y for the grammar g ( defined in example 1 ), by merging d - edges ( fig1 ( a )) and r - edges ( fig1 ( b )). y has a d - edge a → b if the grammar has a production with head symbol a and component symbols containing b ( i . e ., a is a parent of b ). y has an r - edge c → d if the grammar has a preference d over c ( i . e ., d is the winner and c is the loser ). one may omit the self - cycles because they do not affect the scheduling . ( more precisely , one may also omit the terminals , as they do not affect the schedule - ability in this example .) by merging these two types of edges , you get the 2p schedule graph y , with solid edges denoting d - edges and dashed r - edges . by enforcing a topological order on symbol instantiations , this 2p schedule graph captures the two requirements needed for just - in - time pruning . if the graph is acyclic , any topological order achieves such a goal . for example , as our schedule graph y ( example 6 ) is acyclic , we schedule rbu before attr . thus , instance i 2 is generated before a 1 , which then is pruned promptly when generated . more precisely , as preferences are enforced at the end of each symbol instantiation to avoid repeated calls for every instance , ambiguities may aggregate during the instantiation of the symbol , which is minimal . while just - in - time pruning addresses the inherent ambiguities of the grammar , partial parse trees still need to be handled . the parsing algorithm generates partial parse trees when the grammar is incomplete to interpret the entire query interface . specifically , partial parse trees are the derivation trees that cover a subset of tokens and can not be expanded further . for instance , when a query interface contains new condition patterns not covered by the 2p grammar , the parse construction will stop at those partial trees , since not being able to further assemble more tokens . for example , consider the query interface in fig1 , which is a variation from the interface q aa . grammar g does not completely capture the form patterns of that interface . the lower part is arranged “ column by column ” instead of “ row by row .” therefore , the parse construction generates only partial parses , as fig1 shows four of them . to maximize the understanding of query interfaces , the parser may favor the maximum partial trees that interpret as many tokens as possible . in particular , a maximum subsumption may be used to choose parse trees that assemble a maximum set of tokens not subsumed by any other parse . for example , tree 1 in fig1 is not maximum because the tokens covered by tree 1 is subsumed by those of tree 2 . the other three , although overlapping , do not subsume each other . a complete parse tree is a special case of maximum partial tree . in addition to maximizing the interpretations , such maximum parse trees also potentially achieve better interpretations , since they are looking at larger context compared with the non - maximum ones .