OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xliff-omos message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: JLIFF JSON schema and example + two questions about the UML


Dear TC,

I have two questions:

1.The UML diagram appears to lack the originalData table that was included earlier and that is also in the XLIFF XML schema. Is this correct? I wonder how this affects XML to/from JSON conversion tools, because the data content has to be translated *in addition* to the structural content (XML to/from JSON). This means a semantic translation, not just a syntactic translation back/forth JSON and XML. It would be simpler to keep originalData and startRef/dataRef. Just my 2c on this one.

2. The boolean "segment" attribute could be made optional. If segment is dominant over ignorable in practice, then in fact I would suggest to rename this to "ignorable" and use a default value of false.

Below is an initial JSON schema of JLIFF followed by an example. This assumes originalData is still a table. It is almost complete, except for adjustments related to the above, possible improvements, and perhaps rules such as oneOf/anyOf etc to describe and restrict the "element" content that combines all attributes of ec, em, pc, ph, sc, and sm.

Sorry for spamming you with this large email. The github repo is not yet up as David had indicated.

Here is one of many online JSON schema validators you can test this with (no endorsement): http://www.jsonschemavalidator.net

{
  "$schema": "urn:oasis:names:tc:xliff-omos:document:jliff:0.1",

  "$ref": "#/definitions/file",

  "definitions": {

    "file": {
      "type": "object",
      "properties": {
        "id": { "type": "string" },
        "version": { "type": "string" },
        "skeleton": { "$ref": "#/definitions/skeleton" },
        "group": {
          "type": "array",
          "items": { "$ref": "#/definitions/group" }
        },
        "unit": {
          "type": "array",
          "items": { "$ref": "#/definitions/unit" }
        }
      },
      "required": [ "id", "version" ]
    },

    "skeleton": {
      "type": "object",
      "properties": {

      }
    },

    "group": {
      "type": "object",
      "properties": {
        "notes": { "$ref": "#/definitions/notes" },
        "group": {
          "type": "array",
          "items": { "$ref": "#/definitions/group" }
        },
        "unit": {
          "type": "array",
          "items": { "$ref": "#/definitions/unit" }
        }
      }
    },

    "unit": {
      "type": "object",
      "properties": {
        "id": { "type": "string" },
        "name": { "type": "string" },
        "canResegment": { "type": "boolean" },
        "translate": { "type": "boolean" },
        "srcDir": { "$ref": "#/definitions/dir" },
        "trgDir": { "$ref": "#/definitions/dir" },
        "type": { "$ref": "#/definitions/type" },
        "notes": { "$ref": "#/definitions/notes" },
        "subunit": {
          "type": "array",
          "items": { "$ref": "#/definitions/subunit" }
        },
        "originalData": { "$ref": "#/definitions/originalData" }
      },
      "required": [ "id" ]
    },

    "originalData": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "data": { "type" : "string" }
        },
        "required": [ "id", "data" ]
      }
    },

    "subunit": {
      "type": "object",
      "properties": {
	"segment": { "type": "boolean" },
        "state": { "type": "string", "enum": [ "initial", "translated", "reviewed", "final" ] },
        "source": {
          "type": "array",
          "items": { "$ref": "#/definitions/element" }
        },
        "target": {
          "type": "array",
          "items": { "$ref": "#/definitions/element" }
        }
      },
      "required": [ "segment", "source" ]
    },

    "notes": {
      "type": "array",
      "items": { "$ref": "#/definitions/note" },
      "minItems": 1
    },

    "note": {
      "type": "object",
      "properties": {
        "id": { "type": "string" },
        "appliesTo": { "type": "string", "enum": [ "source", "target" ] },
        "category": { "type": "string" },
        "priority": { "type": "integer", "minimum": 1, "maximum": 10 }
      }
    },

    "element": {
      "type": "object",
      "properties": {
        "id": { "type": "string" },
        "kind": { "$ref": "#/definitions/kind" },
        "canCopy": { "type": "boolean" },
        "canDelete": { "type": "boolean" },
        "canOverlap": { "type": "boolean" },
        "canReorder": { "type": "boolean" },
        "copyOf": { "type": "string" },
        "disp": { "type": "string" },
        "equiv": { "type": "string" },
        "dataRef": { "type": "string" },
        "subFlows": { "type": "string" },
        "subtype": { "type": "string" },
        "type": { "$ref": "#/definitions/type" },
        "translate": { "type": "boolean" },
        "ref": { "type": "string" },
        "value": { "type": "string" },
        "dir": { "$ref": "#/definitions/dir" },
        "isolated": { "type": "boolean" },
        "startRef": { "type": "string" },
        "text": { "type": "string" }
      }
    },

    "kind": {
      "type": "string",
      "enum": [ "ec", "em", "pc", "ph", "sc", "sm" ]
    },

    "dir": {
      "type": "string",
      "enum": [ "ltr", "rtl", "auto" ]
    },

    "type": {
      "type": "string",
      "enum": [ "fmt", "ui", "quote", "link", "image", "other" ]
    }

  }

}


An example, similar to the JSON wiki example:


{
    "id": "fl",
    "version": "1.0",
    "unit": [
        {
	    "id": "u1",
	    "originalData": [
		{ "id": "d1", "data": "[C1/]" },
		{ "id": "d2", "data": "[C2]" },
		{ "id": "d3", "data": "[/C2]" }
	    ],
	    "subunit": [
		{
		    "segment": true,
		    "state": "translated",
		    "canResegment": false,
		    "source": [
			{ "id": "c1", "kind": "ph", "dataRef": "d1" },
			{ "text": "aaa" },
			{ "id": "c2", "kind": "pc", "startRef": "d2", "dataRef": "d3", "text": "text" }
		    ],
		    "target": [
			{ "id": "c1", "kind": "ph", "dataRef": "d1" },
			{ "text": "AAA" },
			{ "id": "c2", "kind": "pc", "startRef": "d2", "dataRef": "d3", "text": "TEXT" }
		    ]
		},
		{
		    "segment": false,
		    "source": [
			{ "text": ".  " }
		    ]
		}
	    ]
	}
    ]
}


- Robert van Engelen


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]