forums.tropy.org

JSON-LD does not import Notes?

I’m making some progress on my Tropy to R (and back) workflow through the JSON-LD export feature (see this thread).

Unfortunately notes don’t seem to import. For example, if I create an item in a new project, export it to JSON-LD, and try to import it again (without modifying it), the string ‘undefined’ appears instead of the note.

Here’s the JSON-LD that I’m using:

{
  "@context": {
    "@version": 1.1,
    "@vocab": "https://tropy.org/v1/tropy#",
    "template": {
      "@type": "@id"
    },
    "photo": {
      "@id": "https://tropy.org/v1/tropy#photo",
      "@container": "@list"
    },
    "note": {
      "@id": "https://tropy.org/v1/tropy#note",
      "@container": "@list"
    },
    "selection": {
      "@id": "https://tropy.org/v1/tropy#selection",
      "@container": "@list"
    },
    "identifier": "http://purl.org/dc/elements/1.1/identifier",
    "title": "http://purl.org/dc/elements/1.1/title",
    "date": {
      "@id": "http://purl.org/dc/elements/1.1/date",
      "@type": "https://tropy.org/v1/tropy#date"
    }
  },
  "@graph": [
    {
      "@type": "Item",
      "template": "https://tropy.org/v1/templates/id#SrffCQClc",
      "identifier": "rubberduck",
      "title": "Rubber Duck",
      "photo": [
        {
          "@type": "Photo",
          "checksum": "f6c0ac29d8ad09a8ebd2f1a2a61e6be1",
          "color": "rgb(255,255,255,1)",
          "density": null,
          "filename": "rubberduck.png",
          "mimetype": "image/png",
          "orientation": 1,
          "page": 0,
          "path": "/Users/avand003/Desktop/rubberduck.png",
          "protocol": "file",
          "size": 996842,
          "template": "https://tropy.org/v1/templates/photo",
          "angle": 0,
          "brightness": 0,
          "contrast": 0,
          "height": 1100,
          "hue": 0,
          "mirror": false,
          "negative": false,
          "saturation": 0,
          "sharpen": 0,
          "width": 1100,
          "date": "2022-02-22T19:23:38.915Z",
          "note": [
            {
              "@type": "Note",
              "text": {
                "@value": "This is a yellow rubber duck",
                "@language": "en"
              },
              "markdown": {
                "@value": "This is a yellow rubber duck",
                "@language": "en"
              }
            }
          ]
        }
      ]
    }
  ],
  "version": "1.11.1"
}

Any thoughts on how I could fit this?

Yes. When importing notes, Tropy parses the HTML contents in order to re-create the document structure used internally. You should be able to get your texts to show up by changing either ‘markdown’ or ‘text’ to ‘html’ in your example above; if you generate this solely for the purpose of importing to Tropy it’s sufficient to only put the HTML contents there.

Magic! Thank you so much. I’ll share once I have this workflow written out, in case there’s others who would find it useful.