# US 9,355,083 B1 · Systems and methods for generating an edit script

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

- Number: US 9,355,083 B1
- Document ID: US9355083B1
- Status: Granted
- Kind: B1
- Application number: 14/717,359
- Filed: 2015-05-20
- Granted: 2016-05-31
- Earliest claimed: 2015-02-06
- Assignees: Atlassian Pty Ltd.
- Applicants: Atlassian Pty Ltd
- Inventors: Haymo Meran; Tobias Steiner
- Web page: https://patentgrep.com/patent/US9355083B1

## CPC

- G06F 16/1756: {based on delta files}
- G06F 16/2365: {Ensuring data consistency and integrity}
- G06F 16/27: Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F 40/131: Fragmentation of text files, e.g. creating reusable text-blocks; Linking to fragments, e.g. using XInclude; Namespaces
- G06F 40/14: Tree-structured documents (parsing G06F40/205; validation G06F40/226)
- G06F 40/146: Coding or compression of tree-structured data
- G06F 40/166: Editing, e.g. inserting or deleting
- G06F 40/197: Version control (for software G06F8/71)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Described herein is a computer implemented method for generating a hierarchical edit script describing operations which can be applied to a first dataset to generate a second dataset. The method comprises: generating a first linear sequence representing the first dataset and a second linear sequence representing the second dataset; processing the first linear sequence and the second linear sequence using a difference algorithm to generate a linear edit script; processing the linear edit script with reference to the first dataset to generate a first delta; processing the second linear edit script with reference to the second dataset to generate a second delta; and processing the first and second deltas to generate a hierarchical edit script.

## Claims

### Claim 1

A computer implemented method for generating a hierarchical edit script, the method comprising:
accessing a first hierarchical dataset and a second hierarchical dataset from one or more computer readable storage media;
processing, using one or more computer processors, the first hierarchical dataset to generate a first linear sequence, the first linear sequence being a linear sequence of nodes defined in the first hierarchical dataset;
processing the second hierarchical dataset to generate a second linear sequence, the second linear sequence being a linear sequence of nodes defined in the second hierarchical dataset;
processing the first linear sequence and the second linear sequence using a difference algorithm to generate a linear edit script, the linear edit script defining a linear sequence of operations that can be applied to the first linear sequence to generate the second linear sequence;
processing the linear edit script and the first hierarchical dataset to generate a first delta, the first delta having a same hierarchy as the first hierarchical dataset and comprising nodes describing retain operations and delete operations;
processing the linear edit script and the second hierarchical dataset to generate a second delta, the second delta having a same hierarchy as the second hierarchical dataset and comprising nodes describing retain operations and insert operations; and
processing the first delta and the second delta to generate the hierarchical edit script, the hierarchical edit script describing operations which can be applied to the first hierarchical dataset to generate the second hierarchical dataset, the hierarchical edit script defining at least one move operation, a move operation identifying one or more nodes that have been moved from an original location in the first hierarchical dataset to a new location in the second hierarchical dataset, wherein the hierarchical edit script is different than the linear edit script.

### Claim 2 (depends on 1)

The computer implemented method according to claim 1, wherein a move operation is defined in the hierarchical edit script by a corresponding pair of source and target nodes, a source node indicating one or more nodes in the first hierarchical dataset that have been moved from an original position in the first hierarchical dataset, and a target node indicating a position in the second hierarchical dataset to which one or more nodes associated with a corresponding source node have been moved.

### Claim 3 (depends on 2)

The computer implemented method according to claim 2, wherein processing the first delta and the second delta to generate the hierarchical edit script comprises:
maintaining a first delta position record indicating a current first delta position and a second delta position record indicating a current second delta position;
comparing the current first delta position and the current second delta position; and
in response to identifying that the current first delta position is at a child sequence boundary and the current second delta position is not at a child sequence boundary:
identifying that a move operation has occurred;
generating a source node identifying a source position for the move operation;
generating a target node identifying a target position for the move operation; and
identifying one or more nodes between the current second delta position and a second delta child sequence boundary as the one or more nodes that have been moved in the move operation.

### Claim 4 (depends on 3)

The computer implemented method according to claim 3, wherein:
processing the first dataset to generate the first linear sequence comprises processing the first dataset using a pre-order traversal algorithm; and
processing the second dataset to generate the second linear sequence comprises processing the second dataset using a pre-order traversal algorithm.

### Claim 5 (depends on 4)

The computer implemented method according to claim 4, wherein a child sequence boundary is an end of a child sequence.

### Claim 6 (depends on 3)

The computer implemented method according to claim 3, wherein:
processing the first dataset to generate the first linear sequence comprises processing the first dataset using a post-order traversal algorithm; and
processing the second dataset to generate the second linear sequence comprises processing the second dataset using a post-order traversal algorithm.

### Claim 7 (depends on 6)

The computer implemented method according to claim 6, wherein a child sequence boundary is a start of a child sequence.

### Claim 8 (depends on 1)

The computer implemented method according to claim 1, wherein processing the linear edit script and the first dataset to generate the first delta comprises:
maintaining a linear edit script position record indicating a current linear edit script operation and a first dataset position record indicating a current first dataset node;
processing the current linear edit script operation by:
in response to the current linear edit script operation being a retain operation, inserting a retain operation into the first delta at a hierarchical position matching a hierarchical position of the current first dataset node; and
in response to the current linear edit script operation being a delete operation, inserting a delete operation into the first delta at a hierarchical position matching a hierarchical position of the current first dataset node; and
updating the linear edit script position record to point to a next operation in the linear edit script; and
updating the first dataset position record to point to a next node in the first dataset.

### Claim 9 (depends on 1)

The computer implemented method according to claim 1, wherein processing the linear edit script and the second dataset to generate the second delta comprises:
maintaining a linear edit script position record indicating a current linear edit script operation and a second dataset position record indicating a current second dataset node;
processing the current linear edit script operation by:
in response to the current linear edit script operation being a retain operation, inserting a retain operation into the second delta at a hierarchical position matching a hierarchical position of the current second dataset node; and
in response to the current linear edit script operation being an insert operation, inserting an insert operation into the second delta at a hierarchical position matching a hierarchical position of the current second dataset node; and
updating the linear edit script position record to point to a next operation in the linear edit script; and
updating the second dataset position record to point to a next node in the second dataset.

### Claim 10 (depends on 1)

The computer implemented method according to claim 1, wherein the difference algorithm used to process first linear sequence and second linear sequence is based on the Myers O(ND) Difference Algorithm.

### Claim 11

A system for generating a hierarchical edit script, the system comprising:
one or more processors;
one or more non-transitory computer-readable storage media storing sequences of instructions which, when executed by the one or more processors, cause the one or more processors to:
access a first hierarchical dataset and a second hierarchical dataset from the one or more computer readable storage media;
process the first hierarchical dataset to generate a first linear sequence, the first linear sequence being a linear sequence of nodes defined in the first hierarchical dataset;
process the second hierarchical dataset to generate a second linear sequence, the second linear sequence being a linear sequence of nodes defined in the second hierarchical dataset;
process the first linear sequence and the second linear sequence using a difference algorithm to generate a linear edit script, the linear edit script defining a linear sequence of operations that can be applied to the first linear sequence to generate the second linear sequence;
process the linear edit script and the first hierarchical dataset to generate a first delta, the first delta having a same hierarchy as the first hierarchical dataset and comprising nodes describing retain operations and delete operations;
process the linear edit script and the second hierarchical dataset to generate a second delta, the second delta having a same hierarchy as the second hierarchical dataset and comprising nodes describing retain operations and insert operations; and
process the first delta and the second delta to generate the hierarchical edit script, the hierarchical edit script describing operations which can be applied to the first hierarchical dataset to generate the second hierarchical dataset, the hierarchical edit script defining at least one move operation, a move operation identifying one or more nodes that have been moved from an original location in the first hierarchical dataset to a new location in the second hierarchical dataset, wherein the hierarchical edit script is different than the linear edit script.

### Claim 12 (depends on 11)

The system according to claim 11, wherein a move operation is defined in the hierarchical edit script by a corresponding pair of source and target nodes, a source node indicating one or more nodes in the first hierarchical dataset that have been moved from an original position in the first hierarchical dataset, and a target node indicating a position in the second hierarchical dataset to which one or more nodes associated with a corresponding source node have been moved.

### Claim 13 (depends on 12)

The system according to claim 12, wherein processing the first delta and the second delta to generate the hierarchical edit script comprises:
maintaining a first delta position record indicating a current first delta position and a second delta position record indicating a current second delta position;
comparing the current first delta position and the current second delta position; and
in response to identifying that the current first delta position is at a child sequence boundary and the current second delta position is not at a child sequence boundary:
identifying that a move operation has occurred;
generating a source node identifying a source position for the move operation;
generating a target node identifying a target position for the move operation; and
identifying one or more nodes between the current second delta position and a second delta child sequence boundary as the one or more nodes that have been moved in the move operation.

### Claim 14 (depends on 13)

The system according to claim 13, wherein:
processing the first dataset to generate the first linear sequence comprises processing the first dataset using a pre-order traversal algorithm; and
processing the second dataset to generate the second linear sequence comprises processing the second dataset using a pre-order traversal algorithm.

### Claim 15 (depends on 14)

The system according to claim 14, wherein a child sequence boundary is an end of a child sequence.

### Claim 16 (depends on 13)

The system according to claim 13, wherein:
processing the first dataset to generate the first linear sequence comprises processing the first dataset using a post-order traversal algorithm; and
processing the second dataset to generate the second linear sequence comprises processing the second dataset using a post-order traversal algorithm.

### Claim 17 (depends on 16)

The system according to claim 16, wherein a child sequence boundary is a start of a child sequence.

### Claim 18 (depends on 11)

The system according to claim 11, wherein processing the linear edit script and the first dataset to generate the first delta comprises:
maintaining a linear edit script position record indicating a current linear edit script operation and a first dataset position record indicating a current first dataset node;
processing the current linear edit script operation by:
in response to the current linear edit script operation being a retain operation, inserting a retain operation into the first delta at a hierarchical position matching a hierarchical position of the current first dataset node; and
in response to the current linear edit script operation being a delete operation, inserting a delete operation into the first delta at a hierarchical position matching a hierarchical position of the current first dataset node; and
updating the linear edit script position record to point to a next operation in the linear edit script; and
updating the first dataset position record to point to a next node in the first dataset.

### Claim 19 (depends on 11)

The system according to claim 11, wherein processing the linear edit script and the second dataset to generate the second delta comprises:
maintaining a linear edit script position record indicating a current linear edit script operation and a second dataset position record indicating a current second dataset node;
processing the current linear edit script operation by:
in response to the current linear edit script operation being a retain operation, inserting a retain operation into the second delta at a hierarchical position matching a hierarchical position of the current second dataset node; and
in response to the current linear edit script operation being an insert operation, inserting an insert operation into the second delta at a hierarchical position matching a hierarchical position of the current second dataset node; and
updating the linear edit script position record to point to a next operation in the linear edit script; and
updating the second dataset position record to point to a next node in the second dataset.

### Claim 20 (depends on 11)

The system according to claim 11, wherein the difference algorithm used to process first linear sequence and second linear sequence is based on the Myers O(ND) Difference Algorithm.
