Project

General

Profile

Actions

Task #7056

closed

Story #7040: A client side data and metadata manager and editor

Investigate schema-based JS object generation

Added by Chris Jones almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
07/15/2016
Due date:
% Done:

0%

Estimated time:

Description

We've acknoledged that it is difficult to manually represent the entire EML schema as Javascript Backbone models, much less other metadata schemas. Investigate converting EML instance documents into Javascript objects and vice versa. Test some of the schema binding libraries that do this.


Files

Actions #1

Updated by Chris Jones almost 8 years ago

I've tested some XML to JSON converters, and the most complete implementation I can find so far is Jsonix. With this library I've been able to convert an EML 2.1.1 document from arcticdata.io into a JSON object by unmarshalling it after first generating an XML to JSON binding from the EML schema. The JSON produced by the converted EML looks to maintain all of the element content and properties. However, for certain XSD patterns like element choices, there are some unusual properties in the JSON (like individualNameOrOrganizationNameOrPositionName under the creator property). See the attached Water_isotope_measurements_unmarshalled.json file.

I was then able to marshall the JSON object back to EML. The marshalled EML passed the EML Parser tests, so that's positive. See the attached EML document.

THe outstanding question for me is the patterns we would use to access the content in the typical dotted notation. It seems very straight forward for JSON objects unmarshalled from simple schemas, but for schemas like EML with a lot of Complex Types, choices, etc., we'll need to evaluate the selector syntax we'll need. for instance, to get to the title, I used:

jsonObject.value.dataset.title[0].content[0]

given

{
  "name": {
    "namespaceURI": "eml://ecoinformatics.org/eml-2.1.1",
    "localPart": "eml",
    "prefix": "eml",
    "key": "{eml://ecoinformatics.org/eml-2.1.1}eml",
    "string": "{eml://ecoinformatics.org/eml-2.1.1}eml:eml" 
  },
  "value": {
    "TYPE_NAME": "EML.Eml",
    "packageId": "doi:10.18739/A24H1Z",
    "system": [
      "knb" 
    ],
    "access": {
      "TYPE_NAME": "EML.AccessType",
      "order": "allowFirst",
      "authSystem": "knb",
      "allowOrDeny": [
        {
          "name": {
            "namespaceURI": "",
            "localPart": "allow",
            "prefix": "",
            "key": "allow",
            "string": "allow" 
          },
          "value": {
            "TYPE_NAME": "EML.AccessRule",
            "principal": [
              "cn=arctic-data-admins,dc=dataone,dc=org" 
            ],
            "permission": [
              "all" 
            ]
          }
        },
        {
          "name": {
            "namespaceURI": "",
            "localPart": "allow",
            "prefix": "",
            "key": "allow",
            "string": "allow" 
          },
          "value": {
            "TYPE_NAME": "EML.AccessRule",
            "principal": [
              "http://orcid.org/0000-0001-9051-5240" 
            ],
            "permission": [
              "all" 
            ]
          }
        },
        {
          "name": {
            "namespaceURI": "",
            "localPart": "allow",
            "prefix": "",
            "key": "allow",
            "string": "allow" 
          },
          "value": {
            "TYPE_NAME": "EML.AccessRule",
            "principal": [
              "public" 
            ],
            "permission": [
              "read" 
            ]
          }
        }
      ]
    },
    "dataset": {
      "TYPE_NAME": "EML.DatasetType",
      "alternateIdentifier": [
        {
          "TYPE_NAME": "EML.ProtocolType.AlternateIdentifier",
          "system": [
            "Desert",
            "Research",
            "Institute" 
          ],
          "value": "McCall_Glacier_Upper_Cirque_water_isotopes_v041116" 
        }
      ],
      "title": [
        {
          "TYPE_NAME": "EML.I18NNonEmptyStringType",
          "content": [
            "Water isotope measurements in the McCall Glacier Upper Cirque ice core" 
          ]
        }
      ],

So, there's some work to be done in figuring out the access patterns we would need to be consistent.

Actions #2

Updated by Lauren Walker over 7 years ago

  • Status changed from In Progress to Closed

This research is closed, for now.. we've decided to implement the EML editor by creating JS models that represent EML modules

Actions

Also available in: Atom PDF