FAIRChemistry / md-models

⚒️ - Rust parser for markdown data models
https://fairchemistry.github.io/md-models/
MIT License
2 stars 1 forks source link

Test schema generation from json schema #2

Closed haeussma closed 5 months ago

haeussma commented 5 months ago

I think the Plate Reader Scheme of Allotrope is a good test case.

It'a an ontology-linked and modular scheme with decent complexity.

Curious to see if this can be handled.

JR-1991 commented 5 months ago

I think this is definitely possible, but there are some challenges:

One of the key challenges I see here is that primitive data types such as string are referenced in another schema. For instance, the stringValue is referenced whenever a string is required. The corresponding JSON Schema implements the stringValue as an object that contains @type for JSON-LD compatibility. We need to figure out if the expected object would look something like one of below:

{
  "some_string": {
    "@type": "xsd:string",
    "value": "Hello, World!"
  }
}
{
  "@context": {
    "some_string": {
      "@id": "http://example.com/some_string",
      "@type": "http://www.w3.org/2001/XMLSchema#string"
    }
  },
  "some_string": "Hello world",
}

The latter case is more readable and JSON-LD-ish, but according to the Allotrope schema, the former case is expected. We should check this before we implement the parser because it would require extra work.