Skip to content

obojson parser requires optional fields to be present #20

Open
@cmungall

Description

@cmungall

given:

{
  "graphs": [
    {
      "id": "test",
      "nodes": [
        {
          "id": "GO:0005773",
          "lbl": "vacuole",
          "meta": {
            "definition": {
              "val": "..."
            }
          }
        }
      ]
    }
  ]
}

pronto gives:

  File "/Users/cjm/Library/Caches/pypoetry/virtualenvs/oaklib-OeQZizwE-py3.9/lib/python3.9/site-packages/pronto/parsers/obojson.py", line 19, in parse_from
    doc = fastobo.load_graph(handle).compact_ids()
ValueError: graphs[0].nodes[0].meta.definition: missing field `xrefs` at line 10 column 27

this can be fixed with inclusion of empty dicts and lists

{
  "graphs": [
      {
          
          "id": "test",
          "meta": {},
          "equivalentNodesSets": [],
          "logicalDefinitionAxioms": [],
          "domainRangeAxioms": [],
          "propertyChainAxioms": [],
          "nodes": [
              {
                  "id": "GO:0005773",
                  "lbl": "vacuole",
                  "meta": {
                      "definition": {
                          "val": "...",
                          "xrefs": []
                          
                      }
                  }
              }
          ]
      }
  ]
}

but this imposes a bit of a burden on lightweight producers

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions