|
| 1 | +# edit (graph_operation) |
| 2 | + |
| 3 | +Use this to directly edit the graph via graph update instructions. |
| 4 | + |
| 5 | +The following builds a graph and then reverts all steps back to the |
| 6 | +empty graph: |
| 7 | + |
| 8 | +```toml |
| 9 | +[[graph_op]] |
| 10 | +action = "edit" |
| 11 | + |
| 12 | +[[graph_op.config.instructions]] # note that you can define more than one node to be added for the same type |
| 13 | +do = "add" |
| 14 | +nodes = ["a", "b"] |
| 15 | +node_type = "corpus" |
| 16 | + |
| 17 | +[[graph_op.config.instructions]] # note that theorectically you can define more than one node to be targeted by the annotation |
| 18 | +do = "add" |
| 19 | +nodes = ["a"] |
| 20 | +anno = "annis::doc" |
| 21 | +value = "a" |
| 22 | + |
| 23 | +[[graph_op.config.instructions]] |
| 24 | +do = "add" |
| 25 | +nodes = ["b"] |
| 26 | +anno = "annis::doc" |
| 27 | +value = "b" |
| 28 | + |
| 29 | +[[graph_op.config.instructions]] |
| 30 | +do = "add" |
| 31 | +nodes = ["a#t1", "a#t2", "b#t1", "b#t2"] |
| 32 | + |
| 33 | +[[graph_op.config.instructions]] # Note that you can define more than one edge for a single instruction, as long as the component is the same |
| 34 | +do = "add" |
| 35 | +edges = [ |
| 36 | +{ source = "a#t1", target = "a"}, |
| 37 | +{ source = "a#t2", target = "a"}, |
| 38 | +{ source = "b#t1", target = "b"}, |
| 39 | +{ source = "b#t2", target = "b"} |
| 40 | +] |
| 41 | +component = { ctype = "PartOf", layer = "annis", name = "" } |
| 42 | + |
| 43 | +[[graph_op.config.instructions]] |
| 44 | +do = "add" |
| 45 | +edges = [{ source = "a#t2", target = "a#t1"}] |
| 46 | +component = { ctype = "Pointing", layer = "", name = "dep" } |
| 47 | + |
| 48 | +[[graph_op.config.instructions]] # edge annotations also can target more than one edge |
| 49 | +do = "add" |
| 50 | +edges = [{ source = "a#t2", target = "a#t1"}] |
| 51 | +component = { ctype = "Pointing", layer = "", name = "dep" } |
| 52 | +anno = "default_ns::deprel" |
| 53 | +value = "subj" |
| 54 | + |
| 55 | +### now revert |
| 56 | + |
| 57 | +[[graph_op.config.instructions]] |
| 58 | +do = "rm" |
| 59 | +edges = [{ source = "a#t2", target = "a#t1"}] |
| 60 | +component = { ctype = "Pointing", layer = "", name = "dep" } |
| 61 | +annos = ["default_ns::deprel"] |
| 62 | + |
| 63 | +[[graph_op.config.instructions]] |
| 64 | +do = "rm" |
| 65 | +edges = [{ source = "a#t2", target = "a#t1"}] |
| 66 | +component = { ctype = "Pointing", layer = "", name = "dep" } |
| 67 | + |
| 68 | +[[graph_op.config.instructions]] |
| 69 | +do = "rm" |
| 70 | +edges = [ |
| 71 | +{ source = "a#t1", target = "a"}, |
| 72 | +{ source = "a#t2", target = "a"}, |
| 73 | +{ source = "b#t1", target = "b"}, |
| 74 | +{ source = "b#t2", target = "b"} |
| 75 | +] |
| 76 | +component = { ctype = "PartOf", layer = "annis", name = "" } |
| 77 | + |
| 78 | +[[graph_op.config.instructions]] |
| 79 | +do = "rm" |
| 80 | +nodes = ["a#t1", "a#t2", "b#t1", "b#t2"] |
| 81 | + |
| 82 | +[[graph_op.config.instructions]] |
| 83 | +do = "rm" |
| 84 | +nodes = ["a", "b"] |
| 85 | +annos = ["annis::doc"] |
| 86 | + |
| 87 | +[[graph_op.config.instructions]] |
| 88 | +do = "rm" |
| 89 | +nodes = ["a", "b"] |
| 90 | +``` |
| 91 | + |
| 92 | +## Configuration |
| 93 | + |
| 94 | +### instructions |
| 95 | + |
| 96 | +Provide a set of instructions. |
| 97 | + |
0 commit comments