The present application is co-pending with the concurrently filed application, entitled “FRAMEWORK FOR AUTOMATICALLY MERGING CUSTOMIZATIONS TO STRUCTURED CODE THAT HAS BEEN REFACTORED,” assigned to the assignee of the present application, the contents of which are incorporated herein by reference in their entirety.
Exemplary embodiments of the present invention relate to structured software documents, and more particularly, to performing three-way merge operations on such documents.
Version control refers to the management of different versions and variants of data files and software. As software is developed, designed, and deployed, it is extremely common for multiple states, or versions, of the same software to be deployed in different sites, as well as for the software's developers to be working simultaneously on updates. Code reuse, which refers to the use of existing software to update software or implement new software, is based on the idea that a partial or complete computer program written at one time can be, should be, or is being used in another program written at a later time. Programmers have reused sections of code, templates, functions, and procedures from the earliest days of programming to save time and energy by reducing redundant development work. The most common type of reuse of is the reuse of software components, but other artifacts produced during the software development process such as system architecture, analysis models, design models, design patterns, database schemas, web services can also be reused. The general development practice of using a prior version of an extant program as a starting point for the next version is a standard form of code reuse.
A more typical example of code reuse is the topic of end-user development (EUD), which refers to activities or techniques that allow people who are not professional developers to create or modify a software artifact. EUD may be viewed as essentially out-sourcing the development effort to the end user. A common instance of EUD is programming to extend and adapt an existing application package (for example, an office suite). Two main reasons why EUD has become popular are because organizations can use EUD to effectively cut the time of completion on a project and because software tools are more powerful and easier to use. A drawback with the implementation of EUD, however, is that it can increase the complexity of software maintenance, which generally involves the modification of a software product after delivery to correct faults, to improve performance or other attributes, or to adapt the product to a modified environment. In particular, where an end-user has made individual customizations to programming code, it is difficult for the original developer of that code to account for these customizations in considering the processes of implementation and product acceptance for the maintenance modifications.
Three-way merging refers to techniques employed for reintegrating changes made in parallel to multiple independently modified copies of a base software artifact into a single, unified copy of the software artifact containing the changes. As an integral part of performing a three-way merge, the edits made between a base document of the software artifact and modified versions of the document are first detected so that the modifications made can be merged into the unified version. The existing solutions and tools for performing a three-way merge such as, for example, diff, patch, and Eclipse Compare, consider the structure of its input documents (that is, the base document and the modified documents) to be an ordered list of text lines. When used with structured documents, however, these existing merge solutions are difficult to use and not useful for preventing inconsistencies when performing the merge without requiring a user to read the content of the documents to determine the differences. The existing solutions, for example, are not able to address situations where order is important for some elements in a document but not important for other elements in the document, situations where elements are moved within a document or to another document within the software artifact, or situations where a complex semantic structure of the software code must be taken into consideration to perform a successful merge.
An exemplary embodiment of a method of performing a syntactic and semantic three-way merge of structured software documents includes receiving a first version of a document coded in a structured programming language containing a first plurality of elements, a second version of the document containing a second plurality of elements, and a third version of the document containing a third plurality of elements; deserializing the first, second, and third versions of the document to generate a first data model, a second data model, and a third data model respectively representing the first, second, and third versions in a first data store, each data model comprising a tree data structure that includes a corresponding node for each element of the plurality of elements contained within the version of the document represented by the data model, each node of each data model containing a context describing the element corresponding to the node; generating an identifier for each node of each data model in the first data store that is unique to the node within the data model by applying a set of identifier determination rules to the context describing the element corresponding to the node; comparing the identifier for each node in the first data model with the identifier for each node in the second data model to identify each node in the first data model not having matching identifiers with any node in the second data model in the first data store and to link each pair of nodes in the first and second data models that have matching identifiers; and applying a set of comparison rules to the contexts of each linked pair of nodes in the first and second data models to identify differences between each linked pair of nodes in the first and second data models in the first data store.
Exemplary embodiments of the present invention that are related to computer program products and data processing systems corresponding to the above-summarized method are also described and claimed herein.
Additional features and advantages are realized through the techniques of the present invention. Other embodiments and aspects of the invention are described in detail herein and are considered a part of the claimed invention. For a better understanding of the invention with advantages and features, refer to the description and to the drawings.
The subject matter that is regarded as the invention is particularly pointed out and distinctly claimed in the claims at the conclusion of the specification. The foregoing and other objects, features, and advantages of the invention are apparent from the following detailed description of exemplary embodiments of the present invention taken in conjunction with the accompanying drawings in which:
The detailed description explains exemplary embodiments of the present invention, together with advantages and features, by way of example with reference to the drawings. The flow diagrams depicted herein are just examples. There may be many variations to these diagrams or the steps (or operations) described therein without departing from the spirit of the invention. For instance, the steps may be performed in a differing order, or steps may be added, deleted, or modified. All of these variations are considered a part of the claimed invention.
While the specification concludes with claims defining the features of the invention that are regarded as novel, it is believed that the invention will be better understood from a consideration of the description of exemplary embodiments in conjunction with the drawings. It is of course to be understood that the embodiments described herein are merely exemplary of the invention, which can be embodied in various forms. Therefore, specific structural and functional details disclosed in relation to the exemplary embodiments described herein are not to be interpreted as limiting, but merely as a representative basis for teaching one skilled in the art to variously employ the present invention in virtually any appropriate form. Further, the terms and phrases used herein are not intended to be limiting but rather to provide an understandable description of the invention. As used herein, the singular forms “a”, “an”, and “the” are intended to include the plural forms as well, unless the content clearly indicates otherwise. It will be further understood that the terms “comprises”, “includes”, and “comprising”, when used in this specification, specify the presence of stated features, integers, steps, operations, elements, components, and/or groups thereof
Exemplary embodiments of the present invention can be implemented to provide a mechanism for performing a three-way comparison and merge of versions of a software artifact that includes a set of structured documents, such as documents formatted in accordance with the eXtensible Markup Language (XML), both syntactically and semantically. In particular, exemplary embodiments can provide a generic and complete solution for comparing and merging of versions of structured documents that are not defined by a schema and are formatted according to semantic constraints to include a number of elements that may be ordered or unordered. As used herein, the term “data element” refers to an atomic unit of data that includes an identification such as a data element name, a data element definition, and one or more representation terms. By considering the semantics of the documents and not requiring a schema to be defined for the documents, exemplary embodiments can therefore be applied to any type of structured documents. Furthermore, exemplary embodiments can be implemented to provide a pluggable framework that allows users to easily customize the comparison and merge logic according to specific requirements.
In general, exemplary embodiments of the present invention can be implemented to accept three structured documents as input and process these input documents to generate a fourth structured document as output. The first input document is a common ancestor of the second and third input documents, and is referred to herein as the base document. The second input document is a version of the base document that includes customized modifications to the elements of the base document, and is referred to herein as the customized base document. The third input document is an updated version of the base document that contains updates to the elements of the base document, and is referred to herein as the updated document. For purposes of describing exemplary embodiments, it is assumed that the modifications made to the base document to produce the customized base document and the updates made to the base document to produce the updated document were made independently and in parallel. The fourth document includes all the modifications made to the base document to produce the customized base document and all the updates made to the base document to produce the updated document, and is referred to herein as the customized updated document.
In general, exemplary embodiments can be implemented to generate the customized updated document for output by deserializing each of the three input documents according to a generic memory model to generate a hierarchical, tree-structured representation of each input document, comparing the tree-structured representations of the base document and the customized base document to identify the modifications made to the base document in the customized base document, comparing the tree-structured representations of the base document and the updated document to identify the updates made to the base document in the updated document, comparing the tree-structured representations of the customized base document and the updated document to identify the differences therebetween, generating a tree-structured representation of the updated document that includes the identified modifications made to the base document in the customized base document by referencing the identified updates made to the base document in the updated document and the identified differences between the customized base document and the updated document, and serializing the tree-structured representation of the updated document that includes the identified modifications made to the base document in the customized base document to generate the customized updated document.
The comparison and merge process generally outlined above will be described in greater detail herein with reference to exemplary embodiments in which the structured documents are XML documents that are not defined by an XML schema and are formatted according to semantic constraints to include a number of elements that may be ordered or unordered. It should, of course, be understood that this scenario is exemplary only, and that alternative exemplary embodiments of the present invention can be implemented to provide a mechanism for merging versions of structured documents of any type, not just XML-language documents. Exemplary embodiments can be applied to documents coded in a wide range of structured languages including, for example, HTML, WML, XHTML, DHTML, or other SGML derivatives, as well as other structured languages such as user interface markup languages (for example, UIML, XAL, SVG, XAML, and LZX), the programming languages Pascal and C, and languages used to define two- or three-dimensional layouts, structures, or integrated circuits. Exemplary embodiments can also be applied to documents coded in structured languages used for storing scientific information, engineering information, business information, games, cryptography, and other areas of information technology. A document written in a structured language will generally have a hierarchical structure of elements in which the structure is generally defined by tags (that is, sequences of characters in the document). It should also be noted that exemplary embodiments can be implemented to provide a mechanism for merging structured documents that comprise any aspect(s) of any suitable type of software artifact such as software components, application packages, system architectures, analysis models, design models, design patterns, database schemas, web services, and the like.
The XML standard is governed by the World Wide Web Consortium, and is maintained on the Internet at the web site of the World Wide Web Consortium (W3C). XML describes a class of data objects called XML documents and partially describes the behavior of computer programs which process them. An XML document is a structured, self-descriptive document having a collection of elements, and that facilitates some form of automatic semantic integration. Thus, as used herein, the terms “XML element” or “XML data element” refers to the code terms contained between a set of brackets as defined by the rules of XML. XML is classified as an extensible language because it allows users to define their own elements, which contain either parsed or unparsed data. Parsed data is made up of characters, some of which form character data, and some of which form markup. Each element may have a list of associated attributes and elements. An element may refer to other elements to cause their inclusion in the document. A document begins in a “root” or document element. Markup encodes a description of the document's storage layout and logical structure. Logically, the document is composed of declarations, elements, comments, character references, and processing instructions, all of which are indicated in the document by explicit markup. XML provides a mechanism to impose constraints on the storage layout and logical structure. By adding these semantic constraints, application languages can be implemented in XML.
The following example scenario involving the merging of versions of a software artifact that includes customizable XML documents for which no XML schema has been defined illustrates some of the issues that may arise during maintenance of the software artifacts for which exemplary embodiments of the present invention can be implemented to address. In the example scenario, a software vendor initially produces ‘version 1’ of the code for an application package that includes a set of customizable XML documents. The XML documents are provided according to specified semantic constraints, but no XML schema is defined for the documents. A customer purchases version 1 of the application package and, understanding the semantics of the XML documents, customizes the application code by modifying elements of the XML documents. The customer may also define new elements for use in the customizable documents. The vendor then decides to enhance the application package by adding new functionality, some of which will be implemented through updates to the customizable XML documents. The vender's code for the updated version of the application, ‘version 2’, is based on version 1.
The customer then decides to upgrade to version 2 of the application. Because the user has customized the XML documents in version 1, to get the new features of version 2 without losing the customizations, the modifications that were made by the customer to the XML documents for version 1 will need to be merged into the XML documents of version 2. Certain elements of the XML documents for version 1 of the application package that were modified by the customer, however, may not exist or be structured differently in version 2. Using prior art merging techniques, these customizations will need to be integrated manually. Exemplary embodiments of the present invention, however, can provide a generic and complete merging solution for generating a customized version 2 of the application package that includes all the modifications made by the customer to version 1 and all the enhancements added by the vendor in version 2.
Referring now to
In the present exemplary embodiment, comparison module 110 includes a memory model deserializer 112, a unique ID validator 114, and a source code comparator 116. Comparison module 110 is configured to accept a base XML document 130, a customized base XML document 132, and an updated XML document 134 as input. Base document 132 is a common ancestor of customized base document 132 and updated document 134. Customized base document 132 is a version of base document 130 that includes customized modifications to the XML elements of the base document. Updated document 134 is an updated version of base document 130 that contains updates to the XML elements of the base document. As will be described, comparison module 110 is implemented to generate a memory model representation of each input document in generic memory model 140, to compare the three memory model representations of the three input document to identify the differences therebetween, and to update the generic memory model to include information regarding the identified differences between the input documents. The information provided in memory model 140 by comparison module 110 can thereby be accessed to enable merging module 120 to merge customized base document 132 and updated document 134 into a unified, customized updated document 138 that includes all the modifications made to the base document to produce the customized base document and all the updates made to the base document to produce the updated document. For purposes of the present exemplary embodiment, it is assumed that the modifications made to the base document to produce the customized base document and the updates made to the base document to produce the updated document were made independently and in parallel.
In the present exemplary embodiment, deserializer 112 is configured to deserialize each of the three input documents to generate and store a memory model representation of each input document into memory model 140. Each memory model representation takes the form of a hierarchical, node-labeled tree data structure. A tree data structure, which is an acyclic and connected graph having a set of linked nodes, is commonly used for representing XML documents, which utilize a tree-based semantical structure that has exactly one root element. Trees may be manipulated in more complex ways than ordered lists of text lines. For instance, in the present exemplary embodiment, the tree-structured memory model representations of the documents can each include a number of ordered and/or unordered nodes. Each node in a tree has zero or more child nodes, which are below it in the tree (by convention, trees grow down, not up as they do in nature). A node that has a child is called the child's parent node (or ancestor node, or superior). The topmost node in a tree is called the root node. Being the topmost node, the root node will not have parents. As shown in
The memory model representations generated by deserializer 112 operate to automatically create a mapping relationship between the elements of the input XML documents that is sufficiently flexible to satisfy the requirements of the syntactical and semantical comparison performed by comparator 116, as will be described in greater detail below. In the representation form maintained in memory model 140, each XML element of a represented document corresponds to a tree node in the representation. Each such tree node has a context that contains: (a) the attributes of the corresponding XML element; (b) all descendent XML elements (and their respective attributes) of the corresponding element; and (c) a unique identifier for the node. By this definition, it can be seen that node contexts are hierarchical. The children of a node are the elements contained in the element corresponding to the node.
To account for the fact that some XML documents can be provided with a semantic for which order is not important for some or all of the elements, the memory model representations employ the concept of the unique identifier to identify counterpart elements across documents. Unique identifiers provide a reliable marker for comparator 116 to access when identifying differences between documents that ensures that element contents are compared under the correct corresponding parent element. A unique identifier for a node includes the name of the corresponding element and zero or more attribute values of the corresponding element. To generate the unique identifier of each node context, deserializer 112 employs a repository of identifier determination rules that are applied to each of the XML elements according to the values of one or more attributes of the element. In exemplary embodiments, deserializer 112 can be implemented to provide a pluggable framework for the repository of identifier determination rules for generating the unique identifiers that supports easy addition and modification of identifier determination rules. For example, the unique identifiers for each node can be generated according to any suitable implementation of alternative identifier determination rules that allow for each node to be distinctly identified without relying on the name and/or attributes of the corresponding element. The generation of unique identifiers performed by deserializer 112 is dependent upon the identifier determination rules in the pluggable repository. Thus, deserializer 112 is flexible in that a user can control the details of identifier determination and thereby tailor the unique identifiers to meet the requirements of specific applications.
Under the memory model of the present exemplary embodiment, sibling nodes cannot have the same unique identifier. To satisfy this requirement, deserializer 112 can be configured to generate unique identifiers that have different composite sets of attribute values for different corresponding element types. Thus, the memory model representations, there can be two different forms of unique identifiers. In the first type, the name of the XML element represented by the node is used without any attribute values to form the unique identifier. In such a case, it is expected that only one node context of this type occurs within a memory model representation of a document. In the second type of unique identifier, the name of the XML element represented by the node and each value of one or more attributes of the element are used to form the unique identifier. In such a case, there may be more than one node with this element name contained within a memory model representation of a document, and the values of the one or more selected attributes in the unique identifiers are used to distinguish each node.
It is not required that the values of all the attributes for an XML element be included in the unique identifier for the node corresponding to the element as long as the values or the combinations of values are unique to a parent node and each descendent node under the parent separately. To this end, validator 114, in addition to otherwise ensuring that each memory model representation is well formed, is configured to validate that each unique identifier in the memory model representation of each document is unique within the generated representation.
In the present exemplary embodiment, comparator 116 is configured to perform a comparison between base representation 130a and customized base representation 132b to identify the modifications made to base document 130 in customized base document 132, between base representation 130a and updated representation 134b to identify the updates made to base document 130 in updated document 134, and between customized base representation 132b and updated representation 134b to identify the differences between customized base document 132 and updated document 134. Comparator is further configured to generate and update a set of comparison result information 136 maintained in memory model 140 to include correspondence information regarding the identified differences between the three input documents.
The unique identifiers having composite sets of attribute values provide for a flexible, reliable, and transparent mechanism for use by comparator 116 in performing the comparisons to accurately determine the differences between two documents by taking into consideration the semantics of the document. Under the memory model, an element in one XML document is considered a counterpart of another element in a different XML document if the corresponding nodes for both elements have the same unique identifiers in the memory model representations of the documents. Counterpart elements are identical if their corresponding nodes have the same unique identifier and equivalent values for each of the corresponding attributes in the composite attribute set.
In exemplary embodiments in which the documents being merged are customizable parts of versions of a software artifact initially implemented by an application vendor, the unique identifiers must remain consistent between the versions provided by the vendor. Customers that make modifications to a version of the software artifact, however, are not required to have unique identifiers defined for elements they add or customize. When a customer changes any part of an element used to generate a unique identifier for the node corresponding to the changed element, this will have the same effect in comparison and merging system 100 as if that element were deleted in the new version and then added as new element to the new version. This can be used as a way for the customer to provide an indication within a memory model node corresponding to an element of a represented document that they do not desire to have any updates that the vendor provides for that element merged.
Comparator 116 employs a pluggable repository of comparison rules for performing the comparison between the memory model representations of the documents to determine the differences therebetween. To identify the “same” node in two different memory model representations, the comparison rules are configured to be applied to link counterpart nodes (that is, nodes having the same unique identifier in the two representations being compared) in the two representations of the documents being compared and to generate information about the differences between the elements corresponding to the counterpart nodes in the two documents during the comparison. In exemplary embodiments, comparator 116 can be implemented to provide a mechanism through which additional rules can be added to the pluggable repository of comparison rules so that more information about the differences between the elements of the two documents being compared can be determined. The comparison performed by comparator 116 is dependent upon the comparison rules in the pluggable repository. Thus, comparator 116 is flexible in that a user can control the details of the comparison and thereby tailor the information generated in particular comparisons to meet the requirements of specific applications.
In exemplary embodiments, to compare two documents and identify information regarding the differences therebetween, comparator 116 can be implemented to compare each element in one document being compared with each element in the other document being compared. Comparator 116 can perform these comparisons to update memory model 140 to include information regarding the following differences identified by comparing each pair of the three input documents: (1) elements that exist in one document but not the other (that is, elements that have been deleted or added); (2) counterpart elements having children elements that are in differing orders in the two documents (when the semantic constraints for the documents specify that order matters for these elements); (3) counterpart elements having attributes that have the same values in the two documents; (4) counterpart elements having different values for attributes that are not part of the unique identifiers for the nodes corresponding to the elements; and (5) counterpart elements having different numbers of attributes that are not part of the unique identifiers for the nodes corresponding to the elements (that is, attributes that have been added or deleted). Because additional rules can be added to the pluggable repository of comparison rules, a user can easily specify that more information should be included in memory model 140 regarding the differences between each pair of the three input documents. Furthermore, a user can specify different comparison rules to determine differences for each element in each document (for example, specifying whether order is important or whether whitespace should be considered).
Referring now to
Exemplary process 200 begins at decision block 210 by determining if the XML documents containing the element being compared are provided with a semantic specifying that order is not important for the element. If the XML documents are provided with a semantic specifying that order is important, process 200 proceeds to decision block 220 and determines if the respective unique identifiers for the nodes corresponding to the elements in the memory model representations for the documents being compared are the same. If it is determined at decision block 220 that the respective unique identifiers are not the same, process 200 proceeds to block 280 and records that the first element being compared does not exist in the document containing the second element being compared. Process 200 then terminates. If it is determined at decision block 210 that the XML documents of the application package are provided with a semantic specifying that order is not important for the element, process 200 proceeds to decision block 230 and determines if the respective unique identifiers for the nodes corresponding to the elements in the memory model representations for the documents being compared are the same.
If it is determined either at decision block 220 or at decision block 230 that the respective unique identifiers for the nodes corresponding to the two elements being compared are the same, the two elements being compared are counterpart elements, and process 200 proceeds to block 240. At block 240, the attributes of the two counterpart elements, as provided in the memory model representation contexts of the nodes corresponding to the elements, are compared to identify any added attributes, identify any deleted attributes, and identify any attributes with changed values. Then, at block 250, the sequences of the child elements of the two counterpart elements, as provided in the memory model representation contexts of the nodes corresponding to the elements, are compared based on the unique identifiers for the child elements to identify any differences in the child element sequences of the two counterpart elements. Process 200 then proceeds to block 260, at which each child element of one of the elements being compared is compared with each child element of the other element being compared. To perform each of these child element comparisons at block 260, a new instance of exemplary process 200 is called recursively. The information regarding the differences between the elements identified during the comparisons made at blocks 240-260 is recorded in the generic memory model. When each recursive call made to process 200 at block 260 has returned, process 200 terminates.
If it is determined at decision block 230 that the respective unique identifiers for the nodes corresponding to the two elements being compared are not the same, process 200 proceeds to decision block 270, at which it is determined whether the unique identifier for the node corresponding to the first element being compared is the same as any of the unique identifiers for the nodes corresponding to the sibling elements of the second element being compared. If it is determined that the unique identifier for the node corresponding to the first element is the not same as any of the unique identifiers for the nodes corresponding to the sibling elements of the second element, process 200 proceeds to block 280 and records that the first element being compared does not exist in the document containing the second element being compared. If it is determined at block 230 that the unique identifier for the node corresponding to the first element is the same as the unique identifiers for a nodes corresponding to a sibling element of the second element, process 200 proceeds to block 240 and performs the comparisons described above at blocks 240-260 between the first element and the matching sibling element of the second element. When each recursive call made to process 200 at block 260 has returned, after information regarding the differences between the elements identified during the comparisons made at blocks 240-260 is recorded in the generic memory model, process 200 terminates.
Referring again to the exemplary embodiment described with reference to
Merger 122 is configured to perform a three-way merge on a copy of updated representation 138a based upon the correspondence information regarding the identified differences between the three input documents provided by comparison result information 136. In many cases, the correct output of the merge operation will depend on the semantic constraints of the data (for example, whether elements are specified as ordered or unordered). These semantic constraints should be considered during the merge operation where, for example, sibling or parent elements have been deleted or moved. To account for these semantic constraints, the unique identifiers for the nodes corresponding to the elements of the documents provide a flexible, reliable, and transparent mechanism for merger 124 to access when merging the correspondence information regarding the identified differences between the three input documents that ensures that element contents are merged under the correct corresponding parent element. Thus, the memory model representations generated by deserializer 112 operate to automatically create a mapping relationship between the elements of the input XML documents that is able to satisfy the requirements of the syntactical and semantical merge operation performed by merger 122.
Merger 122 performs the merge operation in accordance with a repository of merge rules specified for the elements. In exemplary embodiments, merger 122 can be implemented to provide a pluggable framework for the repository of merge rules for performing the merge that supports easy addition and modification of merge rules. For example, a user can specify whether order should be maintained, whether formatting be maintained, whether comments should be preserved, where a new element should inserted, instructions on how to handle situations where sibling elements have been reordered, etc. The merge operation performed by merger 122 is dependent upon the merge rules in the pluggable repository. Thus, merger 122 is flexible in that a user can control the details of the merge rules and thereby tailor the merge operation to meet the requirements of specific applications.
Referring now to
At block 320 of exemplary process 300, merger 122 accesses comparison result information 136 to identify each modification made in customized base document 132 to the counterpart element in base document 130 to the element corresponding to the target node. As described above, under the memory model, an element in one XML document is considered a counterpart of another element in a different XML document if the corresponding nodes for both elements have the same unique identifiers in the memory model representations of the documents. At block 330, if the modifications identified at block 320 indicate that the counterpart element in base document 130 to the element corresponding to the target node has been deleted in customized base document 132, the target node is deleted from the working representation. At block 340, if the modifications identified at block 320 indicate that any new child elements have been added to the counterpart element in customized base document 132 to the element corresponding to the target node, these child elements are added to the target node in the working representation. At block 350, if the modifications identified at block 320 indicate that any changes have been made to the attributes of the counterpart element in customized base document 132 to the element corresponding to the target node, these attributes are changed accordingly in the target node in the working representation.
Exemplary process then proceeds to block 360, at which, if it determined whether the XML documents containing the element corresponding to the target node are provided with a semantic specifying that order is important for the element, the child elements are reordered accordingly in the target node in the working representation. Finally, at block 370, the merge operations performed at blocks 320-370 are repeated recursively for each child element of the target node.
As mentioned above, the operations performed in blocks 320-370 are repeated sequentially in exemplary of process 300 for each node in the working representation. The result of the merge operation performed by merging module 122 is customized updated representation 138a in memory model 140. Different types of conflicts can arise during performance of the merge operation where certain situations are present such as, for example, sequencing conflicts, move conflicts, or conflicts that occur where a value for an attribute of an element in base document 130 is changed in the counterpart element of both customized base document 132 and updated document 134. In exemplary embodiments, merging module 122 can be configured to utilize the correspondence information maintained in comparison result information 136 in memory model 140 for the modifications made to the base document to produce the customized base document and the updates made to the base document to produce the updated document to resolve these conflicts.
Once the merge operation has been performed by merging module 122 to generate customized updated representation 138a in memory model 140, memory model serializer 124 is configured to access the memory model and serialize the customized updated representation to generate customized updated document 138, which is an XML document that corresponds to a merged version of customized base document 132 and updated document 134, includes all the modifications made to base document 130 to produce the customized base document, includes all the updates made to the base document to produce the updated document, and, furthermore, accords with the semantic constraints specified for the input documents. Once generated by serializer 124, customized updated document 138 can be provided as output by comparison and merge system 100.
To illustrate the use of comparison and merge system 100 described with reference to the exemplary embodiment illustrated in
In the illustrated example of
As discussed above, exemplary embodiments of the present invention can be implemented to perform a three-way merge of documents comprising code in structured documents of any type, not just XML-language documents. In the exemplary embodiment described with to comparison and merge system 100 illustrated in
In the preceding description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the described exemplary embodiments. Nevertheless, one skilled in the art will appreciate that many other embodiments may be practiced without these specific details and structural, logical, and electrical changes may be made.
Some portions of the exemplary embodiments described above are presented in terms of algorithms and symbolic representations of operations on data bits within a processor-based system. The operations are those requiring physical manipulations of physical quantities. These quantities may take the form of electrical, magnetic, optical, or other physical signals capable of being stored, transferred, combined, compared, and otherwise manipulated, and are referred to, principally for reasons of common usage, as bits, values, elements, symbols, characters, terms, numbers, or the like. Nevertheless, it should be noted that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the description, terms such as “executing” or “processing” or “computing” or “calculating” or “determining” or the like, may refer to the action and processes of a processor-based system, or similar electronic computing device, that manipulates and transforms data represented as physical quantities within the processor-based system's storage into other data similarly represented or other such information storage, transmission or display devices.
Exemplary embodiments of the present invention can be realized in hardware, software, or a combination of hardware and software. Exemplary embodiments can be implemented using one or more program modules and data storage units. Exemplary embodiments can be realized in a centralized fashion in one computer system or in a distributed fashion where different elements are spread across several interconnected computer systems. Any kind of computer system—or other apparatus adapted for carrying out the methods described herein—is suited. A typical combination of hardware and software could be a general-purpose computer system with a computer program that, when being loaded and executed, controls the computer system such that it carries out the methods described herein.
Exemplary embodiments of the present invention can also be embedded in a computer program product, which comprises all the features enabling the implementation of the methods described herein, and which—when loaded in a computer system—is able to carry out these methods. Computer program means or computer program as used in the present invention indicates any expression, in any language, code or notation, of a set of instructions intended to cause a system having an information processing capability to perform a particular function either directly or after either or both of the following: (a) conversion to another language, code or, notation; and (b) reproduction in a different material form.
A computer system in which exemplary embodiments can be implemented may include, inter alia, one or more computers and at least a computer program product on a computer readable medium, allowing a computer system, to read data, instructions, messages or message packets, and other computer readable information from the computer readable medium. The computer readable medium may include non-volatile memory, such as ROM, Flash memory, Disk drive memory, CD-ROM, and other permanent storage. Additionally, a computer readable medium may include, for example, volatile storage such as RAM, buffers, cache memory, and network circuits. Furthermore, the computer readable medium may comprise computer readable information in a transitory state medium such as a network link and/or a network interface including a wired network or a wireless network that allow a computer system to read such computer readable information.
Exemplary computer system 500 can include a display interface 508 that forwards graphics, text, and other data from the communication infrastructure 502 (or from a frame buffer not shown) for display on a display unit 510. Computer system 500 also includes a main memory 506, which can be random access memory (RAM), and may also include a secondary memory 512. Secondary memory 512 may include, for example, a hard disk drive 514 and/or a removable storage drive 516, representing a floppy disk drive, a magnetic tape drive, an optical disk drive, etc. Removable storage drive 516 reads from and/or writes to a removable storage unit 518 in a manner well known to those having ordinary skill in the art. Removable storage unit 518, represents, for example, a floppy disk, magnetic tape, optical disk, etc. which is read by and written to by removable storage drive 516. As will be appreciated, removable storage unit 518 includes a computer usable storage medium having stored therein computer software and/or data.
In exemplary embodiments, secondary memory 512 may include other similar means for allowing computer programs or other instructions to be loaded into the computer system. Such means may include, for example, a removable storage unit 522 and an interface 520. Examples of such may include a program cartridge and cartridge interface (such as that found in video game devices), a removable memory chip (such as an EPROM, or PROM) and associated socket, and other removable storage units 522 and interfaces 520 which allow software and data to be transferred from the removable storage unit 522 to computer system 500.
Computer system 500 may also include a communications interface 524. Communications interface 524 allows software and data to be transferred between the computer system and external devices. Examples of communications interface 524 may include a modem, a network interface (such as an Ethernet card), a communications port, a PCMCIA slot and card, etc. Software and data transferred via communications interface 524 are in the form of signals which may be, for example, electronic, electromagnetic, optical, or other signals capable of being received by communications interface 524. These signals are provided to communications interface 524 via a communications path (that is, channel) 526. Channel 526 carries signals and may be implemented using wire or cable, fiber optics, a phone line, a cellular phone link, an RF link, and/or other communications channels.
In this document, the terms “computer program medium,” “computer usable medium,” and “computer readable medium” are used to generally refer to media such as main memory 506 and secondary memory 512, removable storage drive 516, a hard disk installed in hard disk drive 514, and signals. These computer program products are means for providing software to the computer system. The computer readable medium allows the computer system to read data, instructions, messages or message packets, and other computer readable information from the computer readable medium. The computer readable medium, for example, may include non-volatile memory, such as Floppy, ROM, Flash memory, Disk drive memory, CD-ROM, and other permanent storage. It can be used, for example, to transport information, such as data and computer instructions, between computer systems. Furthermore, the computer readable medium may comprise computer readable information in a transitory state medium such as a network link and/or a network interface including a wired network or a wireless network that allow a computer to read such computer readable information.
Computer programs (also called computer control logic) are stored in main memory 506 and/or secondary memory 512. Computer programs may also be received via communications interface 524. Such computer programs, when executed, can enable the computer system to perform the features of exemplary embodiments of the present invention as discussed herein. In particular, the computer programs, when executed, enable processor 504 to perform the features of computer system 500. Accordingly, such computer programs represent controllers of the computer system.
Although exemplary embodiments of the present invention have been described in detail, the present description is not intended to be exhaustive or limiting of the invention to the described embodiments. It should be understood that various changes, substitutions and alterations could be made thereto without departing from spirit and scope of the inventions as defined by the appended claims. Variations described for exemplary embodiments of the present invention can be realized in any combination desirable for each particular application. Thus particular limitations, and/or embodiment enhancements described herein, which may have particular advantages to a particular application, need not be used for all applications. Also, not all limitations need be implemented in methods, systems, and/or apparatuses including one or more concepts described with relation to exemplary embodiments of the present invention.
The exemplary embodiments presented herein were chosen and described to best explain the principles of the present invention and the practical application, and to enable others of ordinary skill in the art to understand the invention. It will be understood that those skilled in the art, both now and in the future, may make various modifications to the exemplary embodiments described herein without departing from the spirit and the scope of the present invention as set forth in the following claims. These following claims should be construed to maintain the proper protection for the present invention.