Server device, client device, server program, and client program
The server and client device system addresses inefficiencies in multi-user document editing by synchronizing editing results, ensuring timely completion of edits across all users.
Patent Information
- Application Number
- JP2021054626
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2021-03-29
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2041-03-29
AI Technical Summary
Existing methods for resolving conflicts in document editing by multiple users result in inefficiencies as only one user's edits are saved, leading to prolonged completion times for all users.
A server device and client device system that manages document editing by determining new editing targets based on existing and received edit methods and targets, ensuring that editing results match regardless of timing differences among users.
Enables efficient and synchronized editing of documents across multiple users by matching editing results, reducing the time required for all users to complete their edits.
Smart Images

Figure 0007707604000001 
Figure 0007707604000002 
Figure 0007707604000003
Abstract
Description
Technical Field
[0001] The present invention relates to a server device, a client device, a server program, and a client program.
Background Art
[0002] In a communication system, various techniques for jointly editing a common document by a plurality of users have been proposed. Patent Document 1 discloses a method for solving a conflict when a plurality of users perform editing operations on a document stored in a work holder. In this solution method, a message for inquiring a method for resolving a conflict state is notified to any one of the users. The user to whom the message is notified selects which one of the plurality of conflicting documents is to be made valid. In this case, the selected document is saved and the unselected document is deleted, thereby resolving the conflict state.
Prior Art Documents
Patent Documents
[0003]
Patent Document 1
Summary of the Invention
Problems to be Solved by the Invention
[0004] Even when a conflict occurs, depending on the editing method of each of the plurality of users, there may be a case where a document can be edited simultaneously by a plurality of editing methods. However, in the above method, only one of the documents edited by the plurality of users is saved and the rest are deleted, so there is a problem that it takes time until all users finish editing the document by their respective editing methods.
[0005] An object of the present invention is to provide a server device, a client device, a server program, and a client program that enable a plurality of users to efficiently edit a common document.
Means for Solving the Problem
[0006] The server device according to the first aspect of the present invention is a server device capable of communicating with a client device, and is an edit instruction for editing a server document which is a document editable by the server device, including an edit method, an edit target, and a version of the document. The server device includes a receiving means for receiving the edit instruction from the client device, an editing means for editing the server document according to the edit target and the edit method included in the edit instruction received by the receiving means, an updating means for updating the version of the server document edited by the editing means, and a storage means for storing the edit target and the edit method included in the edit instruction received by the receiving means as history information. The editing means includes a first editing means for editing the first edit target included in the first edit instruction by the first edit method in the server document of the first version when it is determined that both the version included in the first edit instruction received from the client device by the receiving means and the version of the server document are the first version; and when it is determined that the version included in the first edit instruction received from the client device by the receiving means is the first version and the version of the server document is a second version different from the first version, a new edit target is determined based on the first edit method and the first edit target, the second edit target which is the edit target stored as the history information, and the second edit method which is the edit method stored as the history information, and a second editing means for editing the determined new edit target in the server document of the second version by the first edit method. The second editing means is characterized in that it determines the edit target of the second document which is the server document of the second version so as to match the edit result when the second edit target of the edited first document is edited by the second edit method after the first edit target of the first document which is the document of the first version included in the first edit instruction is edited by the first edit method.
[0007] According to the first aspect, when the version of the document to be edited by the client device (first version) is different from the version of the server document (second version), the server device determines the editing target of the server document of the second version based on the first editing method and the first editing target in the editing instruction by the client device, and the second editing method and the second editing target stored as history information. The server device determines the editing target so that it matches the editing result when the second editing target of the edited first document is edited by the second editing method after the first editing target of the first document is edited by the first editing method. Therefore, the client device can efficiently edit a common document with other clients.
[0008] The client device according to the second aspect of the present invention is a client device capable of communicating with a server device. When the client device edits a client document which is a document editable by the client device, it transmits an edit instruction for editing a server document which is a document editable by the server device, the edit instruction including an edit method, an edit target, and the version of the client document, to the server device. It has a receiving means for receiving from the server device a change notification for editing the client document, the change notification including version update information indicating a pre-update version which is the version of the document before editing and a post-update version which is the version of the document after editing, the edit method, and the edit target. It has an editing means for editing the client document according to the edit target and the edit method included in the change notification received by the receiving means, an updating means for updating the version of the client document edited by the editing means, and a storage means for storing as history information the version, the edit target, and the edit method included in the edit instruction transmitted by the transmitting means, and the version update information, the edit target, and the edit method included in the change notification received by the receiving means. When the editing means determines that the pre-update version among the version update information included in the change notification received from the server device by the receiving means matches the version of the client document, it has a first editing means for editing the first edit target included in the change notification in the client document by the first edit method included in the change notification. When the editing means determines that the pre-update version among the version update information included in the change notification received from the server device by the receiving means is different from the version of the client document, it determines a new edit target based on the first edit method and the first edit target, the second edit target which is the edit target stored as the history information, and the second edit method which is the edit method stored as the history information, and edits the determined new edit target in the client document.comprising second editing means for editing by the first editing method, wherein the second editing means is such that, after the first editing target of a first document, which is the document before the second editing target is edited by the second editing method, is edited by the first editing method, the editing target of a second document, which is the client document after the second editing target is edited by the second editing method, is determined so as to match the editing result when the second editing target of the edited first document is edited by the second editing method.
[0009] According to a second aspect, when the version before the update of the version update information notified by the server device by a change notification does not match the version of the client document stored in the client device, the client device determines the editing target of the second document based on the first editing method and the first editing target in the change notification and the second editing method and the second editing target stored as history information. Since the client device determines the editing target of the second document so as to match the editing result when the second editing target of the edited first document is edited by the second editing method after the first editing target of the first document is edited by the first editing method, the client document can be appropriately edited regardless of the relationship between the editing timing of the client document based on the editing instruction and the editing timing of the client document by the change notification.
[0010] The server program according to the third aspect of the present invention causes a computer of a server device capable of communicating with a client device to execute a reception step of receiving, from the client device, an edit instruction for editing a server document that is a document editable by the server device, the edit instruction including an edit method, an edit target, and a version of the document; an edit step of editing the server document according to the edit target and the edit method included in the edit instruction received in the reception step; an update step of updating the version of the server document edited in the edit step; and a storage step of storing the edit target and the edit method included in the edit instruction received in the reception step as history information. The edit step includes a first edit step of editing a first edit target included in the first edit instruction received from the client device in the reception step by the first edit method when it is determined that both the version included in the first edit instruction received in the reception step and the version of the server document are the first version; and a second edit step of determining a new edit target based on the first edit method and the first edit target, a second edit target that is the edit target stored as the history information, and a second edit method that is the edit method stored as the history information when it is determined that the version included in the first edit instruction received from the client device in the reception step is the first version and the version of the server document is a second version different from the first version, and editing the determined new edit target in the second version of the server document by the first edit method. The second edit step is characterized in that it determines the edit target of a second document that is the second version of the server document so as to match the edit result when the edit target of the first document that is the first version of the document included in the first edit instruction is edited by the first edit method and then the edit target of the edited first document is edited by the second edit method.According to the third aspect, the same effects as those of the first aspect can be achieved.
[0011] When the client program according to the fourth aspect of the present invention edits a client document, which is a document editable by the client device, on a computer of the client device capable of communicating with a server device, it sends an edit instruction for editing a server document, which is a document editable by the server device, including an edit method, an edit target, and a version of the client document, to the server device. A transmission step of transmitting; a change notification for editing the client document from the server device, including a pre-update version, which is a version of the document before editing, and a post-update version, which is a version of the document after editing, version update information, the edit method, and a reception step of receiving the change notification including the edit target; an edit step of editing the client document according to the edit target and the edit method included in the change notification received in the reception step; an update step of updating the version of the client document edited in the edit step; and storing the version, the edit target, and the edit method included in the edit instruction transmitted in the transmission step, and the version update information, the edit target, and the edit method included in the change notification received in the reception step, as history information. A client program for executing the steps, wherein when it is determined that the pre-update version among the version update information included in the change notification received from the server device in the reception step matches the version of the client document, the first edit target included in the change notification in the client document is edited by the first edit method included in the change notification. A first edit step; when it is determined that the pre-update version among the version update information included in the change notification received from the server device in the reception step is different from the version of the client document, based on the first edit method and the first edit target, the second edit target, which is the edit target stored as the history information, and the second edit method, which is the edit method stored as the history information,Determine a new editing target among the client documents, and include a second editing step of editing the determined new editing target in the first editing method. The second editing step is such that, after the first editing target of a first document, which is the document before the second editing target is edited by the second editing method, is edited by the first editing method, the editing target of a second document, which is the client document after the second editing target is edited by the second editing method, is determined so as to match the editing result when the second editing target is edited by the second editing method. According to the fourth aspect, the same effects as those of the second aspect can be achieved.
Brief Description of Drawings
[0012]
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Figure 9
Figure 10
Figure 11
Figure 12
Figure 13
Figure 14
Figure 15
[0013] An embodiment of the present invention will be described with reference to the drawings. The drawings referred to are used to explain the technical features that the present invention can adopt, and the configurations of the devices described are not limited to those only, but are merely illustrative examples.
[0014] <Overview of Communication System 1> Referring to FIG. 1, an overview of communication system 1 will be described. Communication system 1 includes a server device 2 and client devices 3A, 3B, 3C (hereinafter collectively referred to as "client devices 3"). The server device 2 is communicably connected to an access point 4A via a network line 4. The client devices 3 are wirelessly communicably connected to the access point 4A. Therefore, the server device 2 and the client devices 3 can communicate with each other via the network line 4 and the access point 4A. The client device 3 is a well-known tablet terminal.
[0015] The server device 2 has a CPU 21, a storage unit 22, and a communication interface (I / F) 23. The CPU 21 controls the overall operation of the server device 2. In the storage unit 22, server programs, documents, etc. for the CPU 21 to execute are stored. As an example of a document, handwriting data indicating handwriting is mentioned. The handwriting data includes coordinate data defining the positions of each of a plurality of line segments constituting the handwriting, and group data for classifying the plurality of line segments into groups, etc. The CPU 21 can directly edit the documents stored in the storage unit 22. The communication I / F 23 is a communication module for communicating with the client device 3 via the network line 4 and the access point 4A.
[0016] The client device 3 includes a CPU 31, a storage unit 32, a display unit 33, an input unit 34, and a communication I / F 35. The CPU 31 controls all aspects of the client device 3. The storage unit 32 stores a client program for the CPU 31 to execute, documents, etc. The CPU 31 receives a document from the server device 2 and stores it in the storage unit 32. The CPU 31 can directly edit the document stored in the storage unit 32. The display unit 33 is a liquid crystal display. The input unit 34 is a touch panel provided on the surface of the display unit 33. The communication I / F 35 is a communication module for communicating with the server device 2 via the network line 4 and the access point 4A.
[0017] Referring to FIG. 2, an overview of the operations in the communication system 1 will be described. Assume that a document showing the letter "A" composed of line segments L1 and L2 is stored in the storage unit 22 of the server device 2. The letter "A" includes a misrecorded portion M. First, the document showing the letter "A" is transmitted from the server device 2 to each of the client devices 3A and 3B, and is stored in the storage units 32 of the client devices 3A and 3B respectively. The document stored in each storage unit 32 is displayed on the display unit 33 of each of the client devices 3A and 3B (see FIG. 2(A)).
[0018] Here, as shown in FIG. 2(B), assume that the user of the client device 3A performs an input operation to delete and correct the misrecorded portion M of the letter "A". In this case, the client device 3A transmits an editing instruction to delete the misrecorded portion M to the server device 2 in order to edit the document stored in the storage unit 22 of the server device 2 so that the misrecorded portion M is deleted. The server device 2 receives the editing instruction. The server device 2 performs the editing based on the editing instruction received from the client device 3A on the document stored in the storage unit 22 and updates it. As shown in FIG. 2(C), the server device 2 transmits an OK response notifying that the editing is completed to the client device 3A. In practice, a change notification, which will be described later, will be transmitted from the server device 2 to the client device 3B, but this is omitted here.
[0019] On the other hand, as shown in FIG. 2(B), assume that the user of the client device 3B performs an input operation to classify the line segments L1 and L2 included in the character "A" into a common group G. As shown in FIG. 2(C), the client device 3B transmits an editing instruction to the server device 2 to classify the line segments L1 and L2 into the group G in order to edit the document stored in the storage unit 22 of the server device 2 so that the line segments L1 and L2 are classified into the group G. The server device 2 receives the editing instruction transmitted from the client device 3B. Here, the document stored in the storage unit 22 of the server device 2 has already been edited based on the editing instruction received from the client device 3A, and the misrecorded portion M has been deleted.
[0020] In such a case, the server device 2 executes editing based on the editing instruction received from the client device 3B on the already edited document. Specifically, as shown in FIG. 2(C), the server device 2 executes editing to classify the line segments L1 and L2 of the character "A" from which the misrecorded portion M has been deleted into the group G, and updates the document stored in the storage unit 22.
[0021] As shown in FIG. 2(D), the server device 2 transmits a change notification to the client devices 3A and 3B so that the updated document stored in the storage unit 22 is displayed on the respective display units 33 of the client devices 3A and 3B. The client devices 3A and 3B each receive the change notification. The client devices 3A and 3B each edit the document stored in the storage unit 32 so as to match the document stored in the storage unit 22 of the server device 2 based on the received change notification. Each of the client devices 3A and 3B displays a document in a state where the misrecorded portion M is corrected and the line segments L1 and L2 are classified into the group G on the display unit 33.
[0022] <Communication Sequence> Referring to FIGS. 3 to 15, the communication sequence in the communication system 1 will be described. In FIGS. 3 to 15, only client devices 3A and 3B among the client devices 3 are shown, and client device 3C is omitted. The document stored in the storage unit 22 is referred to as a "server document". The document stored in the storage unit 32 is referred to as a "client document".
[0023] <First Communication Sequence> In the first communication sequence shown in FIG. 3, the editing of the client document is executed only by the user of client device 3A. In the first communication sequence, the documents stored in the server device 2 and the client devices 3 are shown in JSON format. As shown in FIG. 3, in the storage unit 22 of the server device 2, a server document of version (Ver.) 1 is stored. In the server document of Ver. 1, "1" is stored as the value of the path " / a / b / d", "2" is stored as the value of the path " / a / b / e", and "3" is stored as the value of the path " / a / c".
[0024] Client devices 3A and 3B send a command "GET" to the server device 2 in order to acquire a document from the server device 2 (S201). The server device 2 receives the command "GET", reads out the server document of Ver. 1, and sends it to client devices 3A and 3B (S203). Client devices 3A and 3B receive the document of Ver. 1. Client devices 3A and 3B each store the received document in the storage unit 32 as a client document of Ver. 1 (S205).
[0025] Suppose a user of the client device 3A inputs an operation to change the value of the path " / a / b / d" in the client document of Ver. 1 from "1" to "4". In this case, the client device 3A edits the client document of Ver. 1 according to the user's operation (S207). Also, the client device 3A temporarily updates the version of the edited client document to Ver. 1' (S207). The client device 3A transmits an edit instruction including the command "REPLACE" indicating the value change as the editing method, the version "1" of the document to be edited, the path " / a / b / d" indicating the editing target, and the value "4" to the server device 2 (S209). Also, the client device 3A stores the version "1", the command "REPLACE", the path " / a / b / d", and the value "4" included in the transmitted edit instruction in the storage unit 32 as history information (S211).
[0026] The server device 2 receives the edit instruction transmitted by the client device 3A in S209. The server device 2 determines that the version "1" included in the edit instruction matches the version "1" of the server document. In this case, the server device 2 changes the value of the path " / a / b / d" in the server document of Ver. 1 from "1" to "4" (S213). Also, the server device 2 updates the version of the server document from Ver. 1 to Ver. 2 (S213). Further, the server device 2 stores the command, path, and value included in the edit instruction in the storage unit 22 as history information (S215). Also, the server device 2 stores information indicating that the version has been updated (hereinafter referred to as "version update information") in the storage unit 22 as history information (S215). The version update information indicates the pre-update version, which is the version of the document before editing, and the post-update version, which is the version of the document after editing.
[0027] The server device 2 transmits an OK response indicating that it contains version update information "1→2" and that the editing of the server document has been completed to the client device 3A that sent the editing instruction (S217). The client device 3A receives the OK response. The client device 3A updates the version of the client document from Ver.1' to Ver.2 based on the version update information included in the OK response (S219). Also, the client device 3A updates the version "1" stored as history information to version update information "1→2" (S221).
[0028] Also, the server device 2 transmits a change notification to the client device 3B in order to edit the client document of the client device 3B according to the editing of the server document (S223). The change notification includes the command "REPLACE", version update information "1→2", path " / a / b / d", and value "4" based on the history information stored in S215. The client device 3B receives the change notification.
[0029] The client device 3B changes the value of the path " / a / b / d" of the client document of Ver.1 to "4" (S225). Also, the client device 3B updates the version of the client document from Ver.1 to Ver.2 (S225). Furthermore, the client device 3B stores the version change information, command, path, and value included in the change notification in the storage unit 32 as history information (S227).
[0030] <Second Communication Sequence> In the second communication sequence shown in FIG. 4, the client documents of the client devices 3A and 3B are edited by the respective users. Also, only the editing by the user of the client device 3A is valid, and the server document of the server device 2 is edited. For the same procedures as in the first communication sequence, the same reference numerals are used and the description is omitted. In the second communication sequence, the documents stored in the server device 2 and the client device 3 are shown in JSON format.
[0031] Before the client device 3B receives the change notification sent from the server device 2 at S223, assume that the user of the client device 3B inputs an operation to edit the client document of Ver.1. The editing content is to specify the path " / a / b / f" instead of the paths " / a / b / d" and " / a / b / e", and set "5" as the value of this path. In this case, the client device 3B edits the client document of Ver.1 according to the user's operation (S301). Also, the client device 3B temporarily updates the version of the edited client document to Ver.1' (S301). The client device 3B sends an edit instruction including the command "REPLACE", version "1", path " / a / b", the replaced path "f", and the value "5" to the server device 2 (S303). Also, the client device 3B stores the version, command, path, and value included in the sent edit instruction in the storage unit 32 as history information (S305).
[0032] The server device 2 receives the edit instruction sent by the client device 3B. The server device 2 determines that the version "1" included in the edit instruction is different from the version "2" of the server document. Here, the path " / a / b" included in the change notification sent from the client device 3B at S303 is included in the path " / a / b / d" stored as history information in the server device 2 at S215. In this case, the server device 2 determines not to edit the server document of Ver.2 stored in the storage unit 22 (S307). The server device 2 sends an NG response indicating that the server document has not been edited to the client device 3B (S309).
[0033] On the one hand, the client device 3B receives the change notification sent by the server device 2 at S223. The client device 3B determines that the previous version "1" among the version update information "1→2" included in the received change notification is different from the version "1'" of the client document. Here, the path " / a / b" stored as history information at S305 in the client device 3B is included in the path " / a / b / d" included in the change notification sent from the server device 2 at S223. In this case, the client device 3B returns the client document edited at S301 to the client document before editing, that is, the client document stored in the storage unit 32 at S205 (S311). Also, the client device 3B returns the version of the client document to "1".
[0034] After the client device 3B has returned to the client document stored in the storage unit 32 at S205 (S311), it edits the client document based on the change notification sent by the server device 2 at S223. Specifically, the client device 3B changes the value of the path " / a / b / d" of the client document from "1" to "4" (S313). Also, the client device 3B updates the version of the client document to Ver. 2 (S313).
[0035] Hereinafter, when one of the path included in the edit instruction received by the server device 2 and the path stored as history information in the storage unit 22 of the server device 2 is included in the other, the relationship between the edit instruction and the history information is referred to as a "collision relationship". Similarly, when one of the path included in the change notification received by the client device 3 and the path stored as history information in the storage unit 32 of the client device 3 is included in the other, the relationship between the change notification and the history information is referred to as a "collision relationship".
[0036] <The Third Communication Sequence> In the third communication sequence shown in FIG. 5, the clients of client devices 3A and 3B each edit a client document. Also, unlike the second communication sequence, editing by the users of client devices 3A and 3B is enabled, and the server document of server device 2 is edited. In the third communication sequence, the documents stored in server device 2 and client devices 3 are shown in an array format. As shown in FIG. 5, in the storage unit 22 of server device 2, a server document of Ver.1 is stored. In the server document of Ver.1, "A" is stored as the value of path " / a[0]", "B" is stored as the value of path " / a[1]", and "C" is stored as the value of path " / a[2]".
[0037] To obtain the document from server device 2, client devices 3A and 3B send the command "GET" to server device 2 (S401). Server device 2 receives the command "GET" and sends the server document of Ver.1 to client devices 3A and 3B (S403). Client devices 3A and 3B receive the document of Ver.1. Client devices 3A and 3B each store the received document in storage unit 32 as a client document of Ver.1 (S405).
[0038] Suppose the user of client device 3A inputs an operation to change the value of path " / a[0]" of the client document of Ver.1 from "A" to "D". In this case, client device 3A edits the client document of Ver.1 according to the user's operation (S407). Also, client device 3A tentatively updates the version of the edited client document to Ver.1' (S407). Client device 3A sends an edit instruction including the command "REPLACE", version "1", path " / a[0]", and value "D" to server device 2 (S409). Also, client device 3A stores the version, command, path, and value included in the sent edit instruction in storage unit 32 as history information (S411).
[0039] The server device 2 receives the editing instruction transmitted from the client device 3A in S409. The server device 2 determines that the version "1" included in the editing instruction matches the version "1" of the server document. In this case, the server device 2 changes the value of the path " / a[0]" in the server document of Ver.1 from "A" to "D" (S413). Also, the server device 2 updates the version of the server document from Ver.1 to Ver.2 (S413). Further, the server device 2 stores the command, path, and value included in the editing instruction in the storage unit 22 as history information (S415). Also, the server device 2 stores the version update information "1→2" in the storage unit 22 as history information (S415).
[0040] The server device 2 transmits an OK response including the version update information "1→2" to the client device 3A that transmitted the editing instruction (S417). The client device 3A receives the OK response. The client device 3A updates the version of the client document from Ver.1 to Ver.2 (S419). Also, the client device 3A updates the version "1" of the history information to the version update information "1→2" (S421).
[0041] Also, the server device 2 transmits a change notification to the client device 3B (S423). The change notification includes the command "REPLACE", the version update information "1→2", the path " / a[0]", and the value "D" based on the history information stored in S415.
[0042] Before the client device 3B receives the change notification sent from the server device 2 in S423, assume that the user of the client device 3B inputs an operation to edit the client document of Ver.1. The editing content is to newly insert an array a[2] in which the value "E" is stored in the client document, and update the index of the original array a[2] (value "C") from "2" to "3". In this case, the client device 3B edits the client document of Ver.1 according to the user's operation (S501). Also, the client device 3B tentatively updates the version of the edited client document to Ver.1' (S501). The client device 3B transmits an edit instruction including a command "ADD" indicating the insertion of a new array as an editing method, a version "1", a path " / a[2]" indicating the editing target, and a value "E" to the server device 2 (S503). Also, the client device 3B stores the version, command, path, and value included in the transmitted edit instruction in the storage unit 32 as history information (S505).
[0043] The server device 2 receives the edit instruction sent from the client device 3B. The server device 2 determines that the version "1" included in the edit instruction is different from the version "2" of the server document.
[0044] Here, after the server document of Ver.1 is edited based on the edit instruction (ADD 1, / a[2],"E"), when the edited server document is edited based on the history information (1 REPLACE, / a[0],"D") stored in S415, and when the server document of Ver.2 is edited based on the edit instruction (ADD 1, / a[2],"E") by the client device 3B, in both cases, the content of the server document shown in S507 is obtained and they match each other. In this case, the server device 2 determines to edit the server document of Ver.2 based on the edit instruction received from the client device 3B. Then, for the server document of Ver.2, the server device 2 adds an array with the value "E" to the path " / a[2]" included in the edit instruction (S507). Also, the server device 2 updates the index of a[2] where the value "C" was stored before the edit to a[3] (S507). Further, the server device 2 stores the version change information "2→3", the command, the path, and the value in the storage unit 22 as history information (S509).
[0045] On the other hand, after editing the client document in S501, the client device 3B receives the change notification transmitted by the server device 2 in S423. The client device 3B determines that the pre-update version "1" among the version update information "1→2" included in the received change notification is different from the version "1'" of the client document.
[0046] Here, before the editing based on the history information stored in S505 is performed, after the client document is edited based on the received change notification (REPLACE 1→2, / a[0], "D"), when the edited client document is edited based on the history information (1 ADD, / a[2], "E") stored in S505, and when the client document after the editing based on the history information stored in S505 is edited based on the received change notification, the editing results are the same. In this case, the client device 3B determines to edit the client document based on the change notification transmitted from the server device 2 in S423. Then, the client device 3B changes the path " / a[0]" included in the change notification to the value "D" in the client document (S511). Also, the client device 3B updates the version of the client document from Ver.1' to Ver.2 (S511). Further, the client device 3B stores the version change information, command, path, and value included in the change notification in the storage unit 32 as history information (S513).
[0047] After the server device 2 updates the history information in S509, it transmits an OK response including version update information "2→3" to the client device 3B that transmitted the edit instruction in S503 (S515). The client device 3B receives the OK response. The client device 3B updates the version of the client document from Ver.2 to Ver.3 (S517).
[0048] Also, the server device 2 transmits a change notification to the client device 3A to notify the client device 3A that the server document has been edited based on the edit instruction transmitted from the client device 3B in S503 (S519). The change notification includes the command "ADD", version update information "2→3", path " / a[2]", and value "E" based on the history information stored in S509.
[0049] The client device 3A receives the change notification sent by the server device 2. The client device 3A determines that the pre-update version "2" in the version update information "2→3" included in the received change notification matches the version "2" of the client document. In this case, the client device 3A adds an array with the value "E" to the path " / a[2]" included in the change notification for the client document (S521). Also, the server device 2 updates the index of a[2] where the value "C" was stored before editing to [3] (S521).
[0050] Hereinafter, in the server device 2, when the server document before version update is edited based on an edit instruction and then the edited server document is edited based on history information, and when the edit results match the case where the server document after version update is edited based on an edit instruction, the relationship between the edit instruction and the history information is referred to as a "loose relationship". Similarly, when the client document before editing based on history information is edited based on a change notification and then the edited client document is edited based on history information, and when the edit results match the case where the client document after editing based on history information is edited based on a change notification, the relationship between the change notification and the history information is referred to as a "loose relationship".
[0051] <Fourth Communication Sequence> In the fourth communication sequence shown in FIG. 6, the documents are edited by the respective users of the client devices 3A and 3B. Also, different from the third communication sequence, only the editing by the user of the client device 3B is valid and the server document of the server device 2 is edited. In the fourth communication sequence, the documents stored in the server device 2 and the client device 3 are shown in array form. For the same procedures as in the third communication sequence (see FIG. 5), the same reference numerals are given and the description is omitted. Although not shown in FIG. 6, the communication is first executed in the same procedures as S401 to S405 in FIG. 5.
[0052] Suppose that the user of the client device 3A inputs an operation to newly insert the array a[0] in which the value "D" is stored in the client document of Ver.1 and update the indexes of the original arrays a[0] to a[2]. In this case, the client device 3A edits the client document of Ver.1 according to the user's operation (S601). Also, the client device 3A tentatively updates the version of the edited client document to Ver.1' (S601). The client device 3A transmits an edit instruction including the command "ADD", version "1", path " / a[0]", and value "D" to the server device 2 (S603). Also, the client device 3A stores the version, command, path, and value included in the transmitted edit instruction in the storage unit 32 as history information (S605).
[0053] The server device 2 receives the edit instruction transmitted by the client device 3A in S603. The server device 2 determines that the version "1" included in the edit instruction matches the version "1" of the server document. In this case, the server device 2 adds an array with the value "D" to the path " / a[0]" included in the edit instruction for the server document of Ver.1 (S607). Also, the server device 2 updates the indexes of each of the arrays a[0] to a[2] before editing to arrays a[1] to a[3] (S607). Also, the server device 2 updates the version of the server document from Ver.1 to Ver.2 (S607). Further, the server device 2 stores the command, path, and value included in the edit instruction in the storage unit 22 as history information (S609). Also, the server device 2 stores the version update information "1→2" in the storage unit 22 as history information (S611).
[0054] The server device 2 transmits an OK response including version update information "1→2" to the client device 3A that sent the edit instruction (S611). The client device 3A receives the OK response. The client device 3A updates the version of the client document from Ver.1' to Ver.2 (S613). Also, the client device 3A updates the version "1" of the history information to version update information "1→2" (S615).
[0055] Also, the server device 2 transmits a change notification to the client device 3B (S617). The change notification includes the command "ADD", version update information "1→2", path " / a[0]", and value "D" based on the history information stored in S609.
[0056] Before the client device 3B receives the change notification transmitted from the server device 2 in S617, assume that the user of the client device 3B inputs an operation to edit the client document of Ver.1. The edit content is to change the value of the path " / a[0]" to "E" in the client document. In this case, the client device 3B edits the client document of Ver.1 according to the user's operation (S621). Also, the client device 3B temporarily updates the version of the edited client document to Ver.1' (S621). The client device 3B transmits an edit instruction including the command "REPLACE", version "1", path " / a[0]" indicating the edit target, and value "E" to the server device 2 (S623). Also, the client device 3B stores the command, version, path, and value included in the transmitted edit instruction in the storage unit 32 as history information (S625).
[0057] The server device 2 receives the edit instruction transmitted from the client device 3B in S623. The server device 2 determines that the version "1" included in the edit instruction is different from the version "2" of the server document.
[0058] Here, the server device 2 determines that the path indicating the editing target of the server document of Ver.1, which is edited based on the history information (1→2 ADD, / a[0],"D") stored in S609 and then edited based on the received edit instruction (REPLACE 1, / a[0],"E"), is changed from " / a[0]" to " / a[1]". In this case, the server device 2 changes the value of the changed path " / a[1]" in the server document of Ver.2 to "E" (S627). Also, the server device 2 updates the version of the server document from "Ver.2" to "Ver.3" (S627). Further, the server device 2 stores the version change information "2→3", the command, the changed path, and the value in the storage unit 22 as history information (S629).
[0059] On the other hand, after editing the client document stored in the storage unit 32 at S621, the client device 3B receives the change notification transmitted from the server device 2 at S617. The client device 3B determines that the pre-update version "1" among the version update information "1→2" included in the received change notification is different from the version "1´" of the client document.
[0060] Here, the client device 3B determines that the path indicating the editing target of the command "REPLACE" stored as history information is changed from " / a[0]" to " / a[1]" because the client document of Ver.1 (see FIG. 5, S405) is edited based on the change notification (ADD 1→2, / a[0],"D") transmitted from the server device 2 at S617.
[0061] In this case, the client device 3B determines to edit the client document based on the change notice received from the server device 2. Then, for the client document of Ver.1 (see FIG. 5, S405), the client device 3B adds an array with the value "D" to the path " / a[0]" included in the change notice (S631). Also, the client device 3B updates the indices of the respective arrays a[0] to a[2] before editing to make them arrays a[1] to a[3] (S631). Also, the client device 3B changes the value of the path " / a[1]" after the change to "E" based on the history information (S631). Also, the client device 3B updates the version of the client document from Ver.1' to Ver.2 (S631). Further, the client device 3B stores the command, version change information, path, and value included in the change notice in the storage unit 32 as history information (S633).
[0062] Hereinafter, in the server device 2, when the server document is edited based on the history information and then the path changes when editing is performed with a command based on an edit instruction received from the client device 3 next, the relationship between the edit instruction and the history information is referred to as a "conditionally sparse relationship". Also, in the client device 3, when editing based on the change notice received from the server device 2 is performed on the client document and then the path changes when editing is performed based on the history information next, the relationship between the change notice and the history information is referred to as a "conditionally sparse relationship".
[0063] After updating the history information in S629, the server device 2 transmits an OK response including version update information "2→3" to the client device 3B that sent the edit instruction in S623 (S635). The client device 3B receives the OK response. The client device 3B updates the version of the client document from Ver.2 to Ver.3 (S637). Also, the server device 2 transmits a change notification to the client device 3A (S639). The change notification includes the command "REPLACE", version update information "2→3", path " / a[1]", and value "E" based on the history information stored in S629.
[0064] Before the client device 3A receives the change notification transmitted from the server device 2 in S639, assume that the user of the client device 3A inputs an operation to edit the client document. The edit content is to change the value of the path " / a[1]" to "F". In this case, the client device 3A edits the client document of Ver.2 according to the user's operation (S651). Also, the client device 3A temporarily updates the version of the edited client document to Ver.2' (S651). The client device 3A transmits an edit instruction including the command "REPLACE", version "2", path " / a[1]", and value "F" to the server device 2 (S653). Also, the client device 3A stores the version, command, path, and value included in the transmitted edit instruction in the storage unit 32 as history information (S655).
[0065] The server device 2 receives the edit instruction transmitted from the client device 3A in S653. The server device 2 determines that the version "2" included in the edit instruction is different from the version "3" of the server document stored in the storage unit 22. Here, the command "REPLACE" and the path " / a[1]" match between the history information stored in S629 and the received edit instruction. In this case, the server device 2 determines not to edit the server document of Ver.3 (S657). The server device 2 transmits an NG response to the client device 3A (S659).
[0066] Hereinafter, in the server device 2, when the commands are the same and the paths are the same for the edit instruction and the history information respectively, the relationship between the edit instruction and the history information is referred to as the "history command precedence relationship". Similarly, although not shown in the figure, in the client device 3, when the commands are the same and the paths are the same for the change notification and the history information respectively, the relationship between the change notification and the history information is referred to as the "history command precedence relationship".
[0067] On the other hand, the client device 3A receives the change notification transmitted from the server device 2 in S639. The client device 3A determines that the pre-update version "2" in the version update information "2→3" included in the received change notification is different from the version "2'" of the client document. Here, the path " / a[1]" stored as history information in S655 is included in the path " / a[1]" included in the change notification transmitted from the server device 2 in S639. In this case, since the relationship between the change notification and the history information is a collision relationship, the client device 3B returns the client document edited in S651 to the client document before editing, that is, the client document stored in the storage unit 32 in S613 (S671). Also, the client device 3A returns the version of the client document to "2".
[0068] After the client device 3A returns to the client document stored in the storage unit 32 in S613 (S671), it edits the client document based on the change notification transmitted by the server device 2 in S639. Specifically, the client device 3A changes the value of the path " / a[1]" of the client document from "A" to "E" (S673). Also, the client device 3A updates the version of the client document to Ver. 3 (S673).
[0069] <The Fifth Communication Sequence> In the fifth communication sequence shown in FIG. 7, the client documents are edited by the respective users of the client devices 3A and 3B. For the same procedures as in the first communication sequence, the same reference numerals are given and the description is omitted. In the second communication sequence, the documents stored in the server device 2 and the client devices 3 are shown in JSON format.
[0070] Suppose that the user of the client device 3A inputs an operation to delete the path " / a / b / d" of the client document of Ver. 1. In this case, the client device 3A edits the client document of Ver. 1 according to the user's operation (S807). Also, the client device 3A temporarily updates the version of the edited client document to Ver. 1' (S807). The client device 3A transmits an edit instruction including the command "REMOVE" indicating the deletion of the path, the version "1" of the document to be edited, and the path " / a / b / d" indicating the edit (deletion) target, to the server device 2 (S809). Also, the client device 3A stores the version "1", the command "REMOVE", and the path " / a / b / d" included in the transmitted edit instruction in the storage unit 32 as history information (S811).
[0071] The server device 2 receives the edit instruction transmitted by the client device 3A in S809. The server device 2 determines that the version "1" included in the edit instruction matches the version "1" of the server document. In this case, the server device 2 deletes the path " / a / b / d" from the server document of Ver. 1 (S813). Also, the server device 2 updates the version of the server document from Ver. 1 to Ver. 2 (S813). Further, the server device 2 stores the command, path, and value included in the edit instruction in the storage unit 22 as history information (S815). Also, the server device 2 stores the version update information "1→2" in the storage unit 22 as history information (S815).
[0072] The server device 2 transmits an OK response indicating that it contains version update information "1→2" and the editing of the server document is completed to the client device 3A that sent the editing instruction (S817). The client device 3A receives the OK response. The client device 3A updates the version of the client document from Ver.1' to Ver.2 based on the version update information included in the OK response (S819). Also, the client device 3A updates the version "1" stored as history information to version update information "1→2" (S821).
[0073] Also, in order to cause the client device 3B to edit the client document according to the editing of the server document, the server device 2 transmits a change notification to the client device 3B (S823). The change notification includes the command "REMOVE", version update information "1→2", and path " / a / b / d" based on the history information stored in S815. The client device 3B receives the change notification.
[0074] Before the client device 3B receives the change notification transmitted from the server device 2 in S823, assume that the user of the client device 3B inputs an operation to edit the client document of Ver.1. The editing content is to change the value of the path " / a / b / d" from "1" to "4". In this case, the client device 3B edits the client document of Ver.1 according to the user's operation (S901). Also, the client device 3B tentatively updates the version of the edited client document to Ver.1' (S901). The client device 3B transmits an editing instruction including the command "REPLACE", the version "1" of the document to be edited, the path " / a / b / d" indicating the editing target, and the value "4" to the server device 2 (S903). Also, the client device 3B stores the version, command, path, and value included in the transmitted editing instruction in the storage unit 32 as history information (S905).
[0075] The server device 2 receives the editing instruction sent by the client device 3B. The server device 2 determines that the version "1" included in the editing instruction is different from the version "2" of the server document. Here, the server device 2 determines that the priority of the command "REPLACE" included in the editing instruction sent from the client device 3 in S903 is lower than the priority of the command "REMOVE" stored as history information in S815. Note that the priority relationship between commands is defined in advance. In the case of this embodiment, the priority of the command "REMOVE" is set higher than the priority of the command "REPLACE". Note that the information indicating the superiority or inferiority of commands is stored in the storage unit 32 in advance. In this case, the server device 2 determines not to edit the server document of Ver.2 stored in the storage unit 22 (S825). The server device 2 transmits an NG response indicating that the server document has not been edited to the client device 3B (S829).
[0076] On the other hand, the client device 3B receives the change notification sent by the server device 2 in S823. The client device 3B determines that the version before update "1" in the version update information "1→2" included in the received change notification is different from the version "1'" of the client document. Here, the client device 3B determines that the command "REMOVE" included in the change notification sent from the server device 2 in S823 is higher in priority than the command "REPLACE" included in the history information stored in S905. In this case, the client device 3B determines to edit the client document based on the change notification received from the server device 2. Then, the client device 3B deletes the path " / a / b / d" included in the change notification for the client document of Ver.1' (S907). Also, the client device 3B updates the version of the client document from Ver.1' to Ver.2 (S907).
[0077] Next, in the client device 3, when the relationship between the change notification and the history information is neither a sparse relationship nor a conditional sparse relationship, and the priority of the command included in the received change notification is higher than the priority of the command stored in the history information, the relationship between the change notification and the history information is referred to as the "received command priority relationship". Similarly, although not shown in the figure, in the server device 2, when the relationship between the edit instruction and the history information is neither a sparse relationship nor a conditional sparse relationship, and the priority of the command included in the received edit instruction is higher than the priority of the command stored in the history information, the relationship between the edit instruction and the history information is referred to as the "received command priority relationship".
[0078] <Server main process> Referring to FIGS. 8 and 9, the server main process executed by the CPU 21 of the server device 2 will be described. The server main process is started when the CPU 21 reads and executes the server program stored in the storage unit 22 when detecting an edit instruction transmitted from the client device 3.
[0079] As shown in FIG. 8, the CPU 21 receives an edit instruction transmitted from the client device 3 (S11). The CPU 21 compares the version included in the received edit instruction with the version of the server document (S13). When the CPU 21 determines that the respective versions match (S15: YES), the process proceeds to S51 (see FIG. 9).
[0080] As shown in FIG. 9, the CPU 21 acquires the commands and paths included in the editing instruction. The CPU 21 edits the editing target indicated by the acquired path among the server documents by the editing method indicated by the acquired command (S51). The CPU 21 updates by adding 1 to the version of the edited server document (S53). The CPU 21 stores the commands, paths, and values included in the editing instruction received in S11 (see FIG. 8) in the storage unit 22 as history information. Further, the CPU 21 stores version update information indicating that the version has been updated in the storage unit 22 as history information (S55). The version update information includes the version before update and the version after update. Hereinafter, in the history information, the collection consisting of "version update information, command, path, and value" is referred to as a "history record". Each history record is stored in the storage unit 22 in order in LIFO format.
[0081] The CPU 21 transmits an OK response to the client device 3 that transmitted the editing instruction received in S11 (see FIG. 8) (S57). The CPU 21 transmits a change notification to other client devices 3 excluding the client device 3 that transmitted the editing instruction (S59). The change notification includes the commands, version update information, paths, and values included in the history record stored in S55. The CPU 21 ends the server main process.
[0082] On the other hand, as shown in FIG. 8, when the CPU 21 determines that the version included in the received editing instruction is different from the version of the server document (S15: NO), the process proceeds to S17. The CPU 21 acquires the history information stored in the storage unit 22 (S17). Note that there may be a plurality of history records not selected in S19 described later stored in the storage unit 22. The CPU 21 selects one of the history records not selected from the history information (S19). Based on the commands and paths included in the selected history record and the commands and paths included in the editing instruction received in S11, the CPU 21 newly determines the path indicating the editing target to be edited by the editing method indicated by the command included in the editing instruction among the server documents by the method shown below.
[0083] The CPU 21 determines whether the edit instruction received in S11 and the history record selected in S19 are loosely related (S21). If the CPU 21 determines that they are loosely related (S21: YES), the process proceeds to S33. The CPU 21 maintains the path included in the edit instruction (S33). In this case, among the server documents, the edit target indicated by the path included in the edit instruction is edited by the editing method indicated by the command included in the edit instruction (S51 (see FIG. 9), described later). The CPU 21 proceeds with the process to S41.
[0084] If the CPU 21 determines that they are not loosely related (S21: NO), it determines whether the edit instruction received in S11 and the history record selected in S19 are conditionally loosely related (S23). If the CPU 21 determines that they are conditionally loosely related (S23: YES), the process proceeds to S35. In this case, since the server document is edited based on the history record of the history information, the edit target of the server document to be edited based on the next received edit instruction is changed. Therefore, the CPU 21 determines the path indicating the changed edit target (S35). In this case, among the server documents, the edit target indicated by the determined path is edited by the editing method indicated by the command included in the edit instruction (S51 (see FIG. 9), described later). The CPU 21 proceeds with the process to S41.
[0085] If the CPU 21 determines that they are not conditionally loosely related (S23: NO), it determines whether the edit instruction received in S11 and the history record selected in S19 are in a received command precedence relationship (S25). If the CPU 21 determines that they are in a received command precedence relationship (S25: YES), the process proceeds to S37. The CPU 21 maintains the path included in the edit instruction (S37). In this case, among the server documents, the edit target indicated by the path included in the edit instruction is edited by the editing method indicated by the command included in the edit instruction (S51 (see FIG. 9), described later). The CPU 21 proceeds with the process to S41.
[0086] In S41, the CPU 21 determines whether all the history records stored in the storage unit 22 have been selected in S19 (S41). If there are still unselected history records (S41: NO), the CPU 21 returns the process to S19. The CPU 21 selects an unselected history record (S19) and repeats the process. When the CPU 21 determines that all the history records stored in the storage unit 22 have been selected in S19 (S41: YES), the CPU 21 advances the process to S51 (see FIG. 9).
[0087] As shown in FIG. 9, the CPU 21 acquires the commands included in the editing instruction and the paths determined in S33, S35, and S37 (see FIG. 8). The CPU 21 edits the editing target indicated by the acquired path in the server document by the editing method indicated by the acquired command (S51). The CPU 21 increments the version of the edited server document by 1 and updates it (S53). The CPU 21 stores, as history information, a history record including the version update information, the commands and values included in the editing instruction received in S11 (see FIG. 8), and the paths determined in S33, S35, and S37 (see FIG. 8) in the storage unit 22 (S55). The history records are stored in the storage unit 32 in order in the LIFO format.
[0088] The CPU 21 sends an OK response to the client device 3 that sent the editing instruction received in S11 (see FIG. 8) (S57). The CPU 21 sends a change notification to other client devices 3 except the client device 3 that sent the editing instruction (S59). The CPU 21 ends the server main process.
[0089] On the other hand, as shown in FIG. 8, when the CPU 21 determines that it is not a reception command priority relationship (S25: NO), it determines whether the edit instruction received in S11 and the history record selected in S19 are in a history command priority relationship (S27). When the CPU 21 determines that it is in a history command priority relationship (S27: YES), it transmits an NG response to the client device 3 that transmitted the edit instruction (S39). The CPU 21 advances the process to S31. Also, when the CPU 21 determines that it is not in a history command priority relationship (S27: NO), it determines whether the edit instruction received in S11 and the history record selected in S19 are in a collision relationship. The CPU 21 transmits an NG response to the client device 3 that transmitted the edit instruction (S29). The CPU 21 advances the process to S31.
[0090] When the CPU 21 determines that it is in a history command priority relationship or a collision relationship (S27: YES → S39, S27: NO → S29), it prohibits the editing of the server document (S31). The CPU 21 ends the server main process.
[0091] <Client main process> With reference to FIGS. 10 to 14, the client main process executed by the CPU 31 of the client device 3 will be described. The client main process is started when the power of the client device 3 is turned on by the CPU 31 reading and executing the client program stored in the storage unit 32.
[0092] As shown in FIG. 10, the CPU 31 determines whether it has detected an operation for editing the client document (hereinafter referred to as "edit operation") via the input unit 34 (S61). When the CPU 31 determines that it has detected an edit operation (S61: YES), it executes the first client process (see FIG. 11) (S63).
[0093] Referring to FIG. 11, the first client process will be described. The CPU 31 edits the client document according to the editing operation (S81). The CPU 31 generates an editing instruction including the version of the client document, the command, path, and value according to the editing operation (S83). The CPU 31 transmits the generated editing instruction to the server device 2 (S85). The CPU 31 stores a history record including the version, command, path, and value included in the editing instruction in the storage unit 32 as history information (S87). The CPU 31 ends the first client process and returns the process to the client main process (see FIG. 10). As shown in FIG. 10, after the end of the first client process (S63), the CPU 31 returns the process to S61.
[0094] If the CPU 31 determines that the editing operation has not been detected (S61: NO), it determines whether it has received an OK response transmitted from the server device 2 (S65). If the CPU 31 determines that it has received an OK response (S65: YES), it executes the second client process (see FIG. 12) (S67).
[0095] Referring to FIG. 12, the second client process will be described. The CPU 31 sets, as a confirmed history record, a history record including the pre-update version indicated by the version update information included in the received OK response among the history information stored in the storage unit 32 (S91). The CPU 31 updates the version of the client document to the post-update version indicated by the version update information included in the received OK response (S93). The CPU 31 ends the second client process and returns the process to the server main process (see FIG. 10). As shown in FIG. 10, after the end of the second client process (S67), the CPU 31 returns the process to S61.
[0096] If the CPU 31 determines that it has not received an OK response (S65: NO), it determines whether it has received an NG response transmitted from the server device 2 (S69). If the CPU 31 determines that it has received an NG response (S69: YES), it returns the process to S61.
[0097] When the CPU 31 determines that it has not received an NG response (S69: NO), it determines whether it has received a change notification sent from the server device 2 (S73). When the CPU 31 determines that it has not received a change notification (S73: NO), it returns the process to S61. When the CPU 31 determines that it has received a change notification (S73: YES), it executes third client processing (see FIG. 13) (S75). After the end of the third client processing, the CPU 31 returns the process to S61.
[0098] Referring to FIG. 13, the third client processing will be described. The CPU 31 compares the pre-change version among the version update information included in the received change notification with the version of the client document stored in the storage unit 32 (S111). When the CPU 31 determines that the pre-change version among the version update information included in the change notification matches the version of the client document stored in the storage unit 32 (S115: YES), the process proceeds to S151 (see FIG. 14).
[0099] As shown in FIG. 14, the CPU 31 acquires the command and path included in the change notification. The CPU 31 edits the editing target indicated by the acquired path in the client document by the editing method indicated by the acquired command (S151). The CPU 31 stores, as history information, a history record including the version update information, command, path, and value included in the change notification received in S73 (see FIG. 10) in the storage unit 32 (S155). The CPU 31 returns the process to the client main processing (see FIG. 10).
[0100] On the one hand, as shown in FIG. 13, when the CPU 31 determines that there is a difference between the version before change among the version update information included in the received change notification and the version of the client document stored in the storage unit 32 (S115: NO), the process proceeds to S117. The CPU 31 selects one history record that has not been selected in S119 from among the history records for which the settings confirmed in S145 and S91 to be described later have not been set (S119). Based on the command and path included in the selected history record and the command and path included in the change notification received in S73 (see FIG. 10), the CPU 31 newly determines the editing target to be edited by the editing method indicated by the command included in the change notification among the client documents by the method shown below.
[0101] The CPU 31 determines whether the change notification received in S73 and the history record selected in S119 are in a sparse relationship (S121). When the CPU 31 determines that they are in a sparse relationship (S121: YES), the process proceeds to S133. The CPU 31 maintains the path included in the change notification (S133). In this case, among the client documents, the editing target indicated by the path included in the change notification is edited by the editing method indicated by the command indicated by the change notification (S151 (see FIG. 14), to be described later). The CPU 31 proceeds to S141.
[0102] When the CPU 31 determines that they are not in a sparse relationship (S121: NO), it determines whether the change notification received in S73 and the history record selected in S119 are in a conditional sparse relationship (S123). When the CPU 31 determines that they are in a conditional sparse relationship (S123: YES), it advances the process to S135. In this case, since the client document is changed based on the change notification, the editing target of the client document to be edited based on the next executed history record is changed. Therefore, the CPU 31 determines the path indicating the changed editing target (S135). In this case, the client document before the editing based on the history information is first edited based on the change notification, and then the editing target indicated by the determined path is edited by the editing method indicated by the command indicated by the history information (S151 (see FIG. 14), described later). The CPU 31 advances the process to S141.
[0103] When the CPU 31 determines that they are not in a conditional sparse relationship (S123: NO), it determines whether the change notification received in S73 and the history record selected in S19 are in a received command priority relationship (S125). When the CPU 31 determines that they are in a received command priority relationship (S125: YES), it advances the process to S137. The CPU 31 maintains the path included in the change notification (S137). In this case, among the client documents, the editing target indicated by the path included in the change notification is edited by the editing method indicated by the command indicated by the change notification (S151 (see FIG. 14), described later). The CPU 31 advances the process to S141.
[0104] In S141, the CPU 31 determines whether it has selected all the history records in S119 for which the confirmed setting in the history information is not set (S141). When there are remaining unselected history records (S141: NO), the CPU 31 returns the process to S119. The CPU 31 selects the unselected history records (S119) and repeats the process. When the CPU 31 determines that it has selected all the history records in S119 for which the confirmed setting is not set (S141: YES), it advances the process to S151 (see FIG. 14).
[0105] As shown in FIG. 14, the CPU 31 acquires the command included in the change notification and the path determined in S133, S135, and S137 (see FIG. 13). The CPU 31 edits the editing target indicated by the acquired path among the client documents by the editing method indicated by the acquired command (S151). The CPU 31 stores, as history information, a history record including the version update information, command, and value included in the change notification received in S73, and the path determined in S133, S135, and S137 (see FIG. 13) in the storage unit 32 (S155). The CPU 31 returns the process to the client main process (see FIG. 10).
[0106] On the other hand, as shown in FIG. 13, when the CPU 31 determines that it is not in the received command priority relationship (S125: NO), it determines whether the change notification received in S73 and the history record selected in S119 are in the history command priority relationship (S127). When the CPU 31 determines that they are in the history command priority relationship (S127: YES), it prohibits the editing of the client document (S131). The CPU 31 advances the process to S145. Also, when the CPU 31 determines that they are not in the history command priority relationship (S127: NO), it determines whether the change notification received in S73 and the history record selected in S119 are in a conflict relationship. The CPU 31 returns the client document to the state before the editing is performed based on the history record (S143). The CPU 31 sets the history record selected in S119 as a confirmed history record (S145). The CPU 31 returns the process to the client main process (see FIG. 10).
[0107] <Operations and Effects of the Present Embodiment> As described above, when the version of the document to be edited by the client device 3 is different from the version of the server document (S15: NO), the server device 2 determines a new editing target for the server document based on the commands and paths included in the editing instruction sent by the client device 3 and the commands and paths included in the history record (S21 to S39). Hereinafter, in the description of the effects related to the server device 2, the editing method indicated by the command included in the editing instruction sent by the client device 3 is referred to as the "first editing method", and the editing target indicated by the path included in the editing instruction is referred to as the "first editing target". Also, the editing method indicated by the command included in the history record stored in the storage unit 22 of the server device 2 is referred to as the "second editing method", and the editing target indicated by the path included in the history record is referred to as the "second editing target".
[0108] For the document (first document) of the version to be edited by the client device 3 in the editing instruction, the server device 2 newly determines the editing target of the server document (second document) so that it matches the editing result when the second editing target of the edited first document is edited by the second editing method after the first editing target is edited by the first editing method. In this case, the editing result is the same whether the first document is edited based on the first editing target and the first editing method and then edited based on the second editing target and the second editing method, or the first document is edited based on the second editing target and the second editing method and then edited based on the first editing target and the first editing method. Therefore, when a plurality of client devices 3 edit a common server document, the server device 2 can make the editing results match even if the editing timing changes. Therefore, the client device 3 can efficiently edit a common document in cooperation with other client devices 3.
[0109] When the editing instruction received from the client device 3 and the history record are loosely related (S21: YES), the server device 2 maintains the path included in the editing instruction (S33). In this case, the server device 2 can edit the second document by directly applying the path included in the editing instruction transmitted from the client device 3 and using the first editing method indicated by the command.
[0110] When the editing instruction received from the client device 3 and the history record are conditionally loosely related (S23: YES), the server device 2 changes the first editing target indicated by the path included in the editing instruction (S35). In this case, the server device 2 can realize the editing process of editing the second document so as to match the editing result when the first editing target of the first document is edited by the first editing method and then the second editing target is edited by the second editing method, by changing the first editing target.
[0111] When the editing instruction received from the client device 3 and the history record are in a received command priority relationship (S25: YES), the server device 2 maintains the path included in the editing instruction (S37). In this case, the server device 2 can edit the second document by directly applying the path included in the editing instruction transmitted from the client device 3 and using the first editing method indicated by the command.
[0112] When the editing instruction received from the client device 3 and the history record are in a history command priority relationship or a collision relationship (S27: YES / S27: NO), the server device 2 prohibits the editing of the second document (S31). Thereby, when there is no editing method that can match the editing result when the first editing target of the first document is edited by the first editing method and then the second editing target of the edited first document is edited by the second editing method, the server device 2 can prohibit the editing of the second document.
[0113] When the version before update included in the version update information notified by the server device 2 by a change notice does not match the version of the client document stored in the storage unit 32 of the client device 3 (S115: NO), the client device 3 newly determines the editing target of the client document based on the commands and paths included in the change notice transmitted by the server device 2 and the commands and paths included in the history record (S121 to S137). Hereinafter, in the description of the effects related to the client device 3, the editing method indicated by the command included in the change notice transmitted by the server device 2 is referred to as the "first editing method", and the editing target indicated by the path included in the change notice is referred to as the "first editing target". Also, the editing method indicated by the command included in the history record stored in the storage unit 32 of the client device 3 is referred to as the "second editing method", and the editing target indicated by the path included in the history record is referred to as the "second editing target".
[0114] For the client document (first document) before being edited based on the history record, after the first editing target is edited by the first editing method, the client device 3 newly determines the editing target of the client document (second document) after being edited based on the history record so as to match the editing result when the second editing target of the edited first document is edited by the second editing method. In this case, after the first document is edited based on the first editing target and the first editing method and then edited based on the second editing target and the second editing method, and after the first document is edited based on the second editing target and the second editing method and then edited based on the first editing target and the first editing method, the editing results are the same. In this case, regardless of the relationship between the editing timing of the client document when the client device 3 transmits an editing instruction and the editing timing of the client document based on the reception of the change notice by the client device 3, the server device 2 can appropriately edit the client document.
[0115] When the change notification received by the client device 3 and the history record are loosely related (S121: YES), the client device 3 maintains the path included in the change notification (S133). In this case, the client device 3 can directly apply the path included in the change notification transmitted from the server device 2 and edit the second document by the first editing method indicated by the command.
[0116] When the change notification received by the client device 3 and the history record are conditionally loosely related (S123: YES), the client device 3 changes the second editing target indicated by the path included in the history information (S135). In this case, the client device 3 can realize the editing process of editing the first document so that the editing result when the first editing target of the first document is edited by the first editing method after the second editing target is edited by the second editing method matches, by changing the second editing target.
[0117] When the change notification received by the client device 3 and the history record are in a received command priority relationship (S125: YES), the client device 3 maintains the path included in the change notification (S137). In this case, the client device 3 can directly apply the path included in the change notification transmitted from the server device 2 and edit the second document by the first editing method indicated by the command.
[0118] When the change notification received by the client device 3 and the history record are in a history command priority relationship (S127: YES), the client device 3 prohibits the editing of the second document (S131). Thereby, when there is no editing method that matches the editing result when the second editing target of the edited first document is edited by the second editing method after the first editing target of the first document is edited by the first editing method, the client device 3 can prohibit the editing of the second document.
[0119] When the change notice received by the client device 3 and the history record are in a collision relationship (S127: NO), the client device 3 returns the second document to the first document (S143). Thereby, the client device 3 can match the server document stored in the server device 2 and the client document, and synchronize both.
[0120] <Modified Example> In the sixth communication sequence shown in FIG. 15, the client document is edited only by the user of the client device 3A, and the server document of the server device 2 is also edited in the same way. The sixth communication sequence is different from the first communication sequence (see FIG. 3) in that the client document is repeatedly edited by the user of the client device 3A. In FIG. 15, the client device 3B is omitted. In the sixth communication sequence, the documents stored in the server device 2 and the client device 3 are shown in JSON format. For the same procedures as in the first communication sequence, the description is simplified.
[0121] The client device 3A acquires the document of Ver. 1 from the server device 2 (S701, S703). The client device 3A stores the received document of Ver. 1 in the storage unit 32 as a client document (S705).
[0122] Suppose the user of the client device 3A inputs an operation to change the value of the path " / a / b / d" of the Ver. 1 client document from "1" to "4". In this case, the client device 3A edits the client document according to the user's operation (S707). The client device 3A transmits an edit instruction including the command "REPLACE", version "1", path " / a / b / d", and value "4" to the server device 2 (S709). Also, the client device 3A stores the version, command, path, and value in the storage unit 32 as history information based on the transmitted edit instruction (S711).
[0123] The server device 2 receives the editing instruction transmitted from the client device 3A in S711, and determines that the version "1" included in the editing instruction matches the version "1" of the server document. The server device 2 edits the server document based on the editing instruction (S713) and updates the version (S713). Further, the server device 2 stores the history information in the storage unit 22 (S715). The server device 2 transmits an OK response including the version update information "1→2" to the client device 3A (S717).
[0124] Before the client device 3A receives the OK response transmitted by the server device 2 in S717, assume that the user of the client device 3A inputs an operation to change the value of the path " / a / b / d" of the client document from "4" to "5". In this case, the client device 3A edits the client document edited in S707 according to the user's operation (S719). Since the client device 3A has not received the OK response, the version of the client document has not been updated and remains Ver.1. The client device 3A transmits an editing instruction including the command "REPLACE", version "1", path " / a / b / d", and value "5" to the server device 2 (S721). Also, the client device 3A stores the version, command, path, and value as history information in the storage unit 32 based on the transmitted editing instruction (S723).
[0125] The server device 2 receives the editing instruction transmitted from the client device 3A in S721. The server device 2 determines that the version "1" included in the editing instruction is different from the version "2" of the server document.
[0126] Here, in the fourth communication sequence (see FIG. 6), when the command and path match based on the history information and the edit instruction, the server device 2 does not edit the server document (S657, see FIG. 6). However, in the sixth communication sequence, when both the transmission destination to which the server device 2 transmitted the edit instruction in S715 and the transmission source of the next received edit instruction are the common client device 3A, even when the command and path match based on the history information and the edit instruction, the server device 2 edits the server document stored in the storage unit (S725). The server device 2 stores the version, command, path, and value in the storage unit 32 as history information based on the transmitted edit instruction (S727).
[0127] <Other Modification Examples> The present invention is not limited to the above-described embodiments and modification examples, and various changes are possible. The server document is not limited to being stored in the storage unit 22 of the server device 2. The client document is not limited to being stored in the storage unit 32 of the client device 3. For example, at least one of the server document and the client document, and the client device 3 may be stored in another server connected to the network line 4.
[0128] The relationship between the edit instruction determined in the server device 2 and the history information is not limited to a sparse relationship, a conditional sparse relationship, a received command priority relationship, a history command priority relationship, and a collision relationship. Similarly, the relationship between the change notification determined in the client device 3 and the history information is not limited to a sparse relationship, a conditional sparse relationship, a received command priority relationship, a history command priority relationship, and a collision relationship. At least one of the server device 2 and the client device 3 may determine only a part of each of the above relationships. Further, at least one of the server device 2 and the client device 3 may determine a relationship other than the above. In the above, as an example of the document format, the JSON format and the array method have been specifically described, but the document format may be other formats.
[0129] The server device 2 updated the version by adding 1 to the version of the server document (S53). The method by which the server device 2 updates the version is not limited to this method. For example, the server device 2 may manage an edition in addition to the version. In this case, the server device 2 may update the version and the edition separately as appropriate. Also, the server device 2 may manage the version by a random number.
[0130] <Others> In the server device of the present invention, the CPU 21 that performs the process of S11 is an example of the "receiving means" of the present invention. The CPU 21 that performs the process of S51 is an example of the "editing means", "first editing means", and "second editing means" of the present invention. The CPU 21 that performs the process of S53 is an example of the "updating means" of the present invention. The CPU 21 that performs the process of S55 is an example of the "storage means" of the present invention. The CPU 21 that performs the process of S31 is an example of the "first editing prohibition means" and "second editing prohibition means" of the present invention.
[0131] In the client device of the present invention, the CPU 31 that performs the process of S85 is an example of the "transmission means" of the present invention. The CPU 31 that performs the process of S73 is an example of the "receiving means" of the present invention. The CPU 31 that performs the process of S93 is an example of the "updating means" of the present invention. The CPU 31 that performs the process of S151 is an example of the "editing means", "first editing means", "second editing means", and "third editing means" of the present invention. The CPU 31 that performs the process of S155 is an example of the "storage means" of the present invention. The CPU 31 that performs the process of S131 is an example of the "first editing prohibition means" of the present invention. The CPU 31 that performs the process of S141 is an example of the "UNDO means" of the present invention.
[0132] In the server program of the present invention, the process of S11 is an example of the "reception step" of the present invention. The process of S51 is an example of the "editing step", "first editing step", and "second editing step" of the present invention. The process of S53 is an example of the "update step" of the present invention. The process of S55 is an example of the "storage step" of the present invention. The process of S31 is an example of the "first editing prohibition step" and "second editing prohibition step" of the present invention.
[0133] In the client device of the present invention, the process of S85 is an example of the "transmission step" of the present invention. The process of S73 is an example of the "reception step" of the present invention. The process of S93 is an example of the "update step" of the present invention. The process of S151 is an example of the "editing step" and "first editing step" of the present invention. The process of S155 is an example of the "storage step" of the present invention. The process of S131 is an example of the "first editing prohibition step" of the present invention. The process of S141 is an example of the "UNDO step" of the present invention.
Explanation of Signs
[0134] 1: Communication system 2: Server device 3, 3A, 3B, 3C: Client device 4: Network line 4A: Access point 21, 31: CPU 22, 32: Storage unit
Claims
1. A server device capable of communicating with a client device, Receiving means for receiving, from the client device, an editing instruction for editing a server document that is a document editable by the server device, the editing instruction including an editing method, an editing target, and a version of the document, Editing means for editing the server document according to the editing target and the editing method included in the editing instruction received by the receiving means, Updating means for updating the version of the server document edited by the editing means, Storage means for storing the editing target and the editing method included in the editing instruction received by the receiving means as history information, Comprising, The editing means, When it is determined that both the version included in the first editing instruction received from the client device by the receiving means and the version of the server document are the first version, the first editing target included in the first editing instruction in the server document of the first version is edited by the first editing method included in the first editing instruction, the first editing means, When the version included in the first editing instruction received from the client device by the receiving means is the first version and it is determined that the version of the server document is the second version in which the first version has been updated by the updating means, determining means for determining a new editing target to be edited by the first editing method among the second documents that are the server documents of the second version, Second editing means for editing the editing target determined by the determining means among the second documents to generate a third document Comprising, When the first document that is the server document of the first version is edited into the second document, the second editing target that is the editing target and the second editing method that is the editing method are stored by the storage means as the history information, The determining means, The editing result when the second editing target of the edited first document is edited by the second editing method after the first editing target of the first document is edited by the first editing method is the same as the third document, and the editing target of the second document is determined A server device characterized by this.
2. The determining means, After the first editing target of the first document is edited by the first editing method, when the second editing target of the edited first document is edited by the second editing method and the editing result matches the case where the first editing target of the second document is edited by the first editing method, determining the first editing target of the second document The server device according to claim 1, characterized in that
3. The determining means When the second editing target of the first document is edited by the second editing method and the editing target of the first document edited by the first editing method is changed from the first editing target, determining the changed editing target among the second documents The server device according to claim 2, characterized in that
4. The determining means When the priority of the first editing method is higher than the priority of the second editing method, determining the first editing target of the second document The server device according to claim 3, characterized in that
5. The editing means The server device according to any one of claims 1 to 4, further comprising a first editing prohibition means for not editing the second document when the first editing method and the second editing method are the same and the first editing target and the second editing target are the same
6. The editing means The server device according to any one of claims 1 to 5, comprising a second editing prohibition means for not editing the second document when one of the first editing target and the second editing target is included in the other
7. The updating means Updating the version by adding 1 to the version The server device according to any one of claims 1 to 6, characterized in that the second version is larger than the first version
8. A client device capable of communicating with a server device, When editing a client document, which is a document editable by the client device, a transmission means for transmitting an editing instruction for editing a server document, which is a document editable by the server device, the editing instruction including an editing method, an editing target, and the version of the client document, to the server device Receiving means for receiving, from the server device, a change notification for editing the client document, the change notification including version update information indicating a pre-update version which is a version of the document before editing and a post-update version which is a version of the document after editing, the editing method, and the editing target; Editing means for editing the client document according to the editing target and the editing method included in the change notification received by the receiving means; Updating means for updating the version of the client document edited by the editing means; Storage means for storing, as history information, the version, the editing target, and the editing method included in the editing instruction transmitted by the transmitting means, and the version update information, the editing target, and the editing method included in the change notification received by the receiving means; Comprising; The editing means is When it is determined that the pre-update version among the version update information included in the change notification received from the server device by the receiving means matches the version of the client document, first editing means for editing a first editing target included in the change notification in the client document by a first editing method included in the change notification; When it is determined that the pre-update version among the version update information included in the change notification received from the server device by the receiving means is different from the version of the client document, determining means for determining a new editing target to be edited by the first editing method among a second document which is the client document of the post-update version; Second editing means for editing the editing target determined by the determining means in the second document to generate a third document Comprising; When the first document which is the client document of the pre-update version is edited into the second document, a second editing target which is the editing target at that time and a second editing method which is the editing method are stored by the storage means as the history information; The determining means is After the first editing target of the first document is edited by the first editing method, when the second editing target of the edited first document is edited by the second editing method, the editing target of the second document is determined so that the editing result matches the third document. A client device characterized by the above.
9. The determining means After the first editing target of the first document is edited by the first editing method, when the editing result is the same between the case where the second editing target of the edited first document is edited by the second editing method and the case where the first editing target of the second document is edited by the first editing method, the first editing target of the second document is determined. The client device according to claim 8, characterized by the above.
10. The determining means When the first editing target of the first document is edited by the first editing method, and the editing target changes from the second editing target when the edited document is edited by the second editing method, the client device according to claim 9, characterized by determining the changed editing target among the edited documents.
11. The determining means When the priority of the first editing method is higher than the priority of the second editing method, the first editing target of the second document is determined. The client device according to claim 10, characterized by the above.
12. The editing means The client device according to any one of claims 8 to 11, further comprising a first editing prohibition means for not editing the second document when the first editing method and the second editing method are the same and the first editing target and the second editing target are the same.
13. The editing means The client device according to any one of claims 8 to 12, comprising an UNDO means for returning the second document to the first document when one of the first editing target and the second editing target is included in the other.
14. On a computer of a server device capable of communicating with a client device, A reception step of receiving, from the client device, an editing instruction for editing a server document that is a document editable by the server device, the editing instruction including an editing method, an editing target, and a version of the document. An editing step of editing the server document according to the editing target and the editing method included in the editing instruction received in the receiving step; An updating step of updating the version of the server document edited in the editing step; A storage step of storing the editing target and the editing method included in the editing instruction received in the receiving step as history information; A server program for executing the following steps: The editing step includes: When it is determined that both the version included in the first editing instruction received from the client device in the receiving step and the version of the server document are the first version, the first editing target included in the first editing instruction in the server document of the first version is edited by the first editing method in the first editing instruction; When the version included in the first editing instruction received from the client device in the receiving step is the first version and the version of the server document is determined to be the second version in which the first version is updated by the updating step, a determination step of determining a new editing target to be edited by the first editing method among the second documents that are the server documents of the second version; A second editing step of editing the editing target determined in the determination step among the second documents to generate a third document; The server program is provided with: The second editing target that is the editing target when the first document that is the server document of the first version is edited into the second document and the second editing method that is the editing method are stored by the storage step as the history information; The determination step includes: Determining the editing target of the second document so that the editing result when the second editing target of the first document after editing is edited by the second editing method after the first editing target of the first document is edited by the first editing method matches the third document; A server program characterized by the above.
15. On the computer of a client device capable of communicating with a server device When the client device edits a client document which is an editable document, a transmission step of transmitting an edit instruction for editing a server document which is an editable document by the server device, the edit instruction including an edit method, an edit target, and a version of the client document, to the server device; A reception step of receiving, from the server device, a change notification for editing the client document, the change notification including version update information indicating a pre-update version which is a version of the document before editing and a post-update version which is a version of the document after editing, the edit method, and the edit target; An edit step of editing the client document according to the edit target and the edit method included in the change notification received in the reception step; An update step of updating the version of the client document edited in the edit step; A storage step of storing, as history information, the version, the edit target, and the edit method included in the edit instruction transmitted in the transmission step, and the version update information, the edit target, and the edit method included in the change notification received in the reception step; A client program for causing the above to be executed, The edit step includes: A first edit step of editing a first edit target included in the change notification in the client document by a first edit method included in the change notification when it is determined that the pre-update version among the version update information included in the change notification received from the server device in the reception step matches the version of the client document; A determination step of determining a new edit target to be edited by the first edit method among a second document which is the client document of the post-update version when it is determined that the pre-update version among the version update information included in the change notification received from the server device in the reception step is different from the version of the client document; A second edit step of editing the edit target determined in the determination step among the second document to generate a third document and comprising When the first document, which is the client document of the pre-update version, is edited to the second document, the second editing target that is the target of editing and the second editing method that is the editing method are stored by the storage step as the history information. The determination step is as follows. After the first editing target of the first document is edited by the first editing method, when the second editing target of the edited first document is edited by the second editing method, the editing target of the second document is determined so that the editing result matches the third document. A client program characterized by the above.
Citation Information
Patent Citations
Method, device and system for online document edition
CN103914439A
Method for solving data confliction in common data environment
JP1999161535A
Intelligent conflict detection and semantic expression of document edits
US20150378972A1