General questions

Answered

Unable to import jiix

I exported the jiix and saved it to a file as follows:

 public String getJiix() throws IOException {

        batchEditor.waitForIdle();

        String recoResult;ParameterSet parameterSet = batchEditor.getEngine().createParameterSet();

        recoResult = batchEditor.export_(null, MimeType.JIIX, parameterSet);

        return recoResult;

    }

And save to txt file

String jiixPath = IoService.saveTxt(jiix, onlyName + ".txt");

When I need to import, I modified the label according to the tutorial.

 

private String changeJiix(String jiix) throws JSONException {

        if (jiix == null || jiix.equals("")) {

            return null;

        }

        JSONObject jo = new JSONObject(jiix);

        JSONArray words = jo.getJSONArray("words");

        String strs="";

        for (int i = 0; i < words.length(); i++) {

            JSONObject word = words.getJSONObject(i);

            JSONArray candidates = word.getJSONArray("candidates");

            String s = candidates.getString(1);

            strs+=s;

            word.put("label", s);

        }

        jo.put("label", strs);

        return jo.toString();

    }

Then I import jiix

batchEditor.import_(MimeType.JIIX,jiix,batchEditor.getRootBlock());

But there was an exception

java.lang.IllegalStateException: Could not import jiix: unsupported changes

This is my modified jiix:

"type":"Text","bounding-box":{"x":25.538378,"y":35.985012,"width":25.97294,"height":10.6908},"label":"At","words":[{"label":"At","candidates":["Ac","At","AC","Hc","Aa"],"bounding-box":{"x":25.538378,"y":35.985012,"width":25.97294,"height":10.6908},"range":"[0:0,3:63$]","strokes":[{"timestamp":"2019-01-08 13:14:06.204000","X":[30.5252,30.5252,30.5252,30.508202,30.490532,30.4905

What kind of changes do I need to make?




Best Answer

Dear 龚 文益,


currently, please find the conditions that are mandatory to import JIIX data:


### JIIX import


JIIX import is so far limited to text words candidate changes. More import capabilities will be provided later on.


To change the text candidates within a given Text or Diagram block:


1. Export the block to the JIIX format.

2. Replace the `label` of the target `word` with another word **from the `candidates` list**.

3. Import the modified JIIX data back to your block.


Important : Importing JIIX data is only possible if the target block was not modified since it was exported.


In your particular case, can you confirm your target block was not modified in between export and import?


Best regards,


Olivier


Dear 龚 文益,


When I say "modifying the block", nothing should be done in between the export and import, i.e. you should not add any stroke in your block, you should not close/re-open it...


Basically, all you can do is export, modify the "label" with one of the candidates, import.


Best regards,


Olivier

What is the meaning of modifying the block? Modify the type of block? turn on? shut down?

Answer

Dear 龚 文益,


currently, please find the conditions that are mandatory to import JIIX data:


### JIIX import


JIIX import is so far limited to text words candidate changes. More import capabilities will be provided later on.


To change the text candidates within a given Text or Diagram block:


1. Export the block to the JIIX format.

2. Replace the `label` of the target `word` with another word **from the `candidates` list**.

3. Import the modified JIIX data back to your block.


Important : Importing JIIX data is only possible if the target block was not modified since it was exported.


In your particular case, can you confirm your target block was not modified in between export and import?


Best regards,


Olivier