-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Describe the bug
MMApp allows to define a SpecsFile (often an url link) for each hardware object. This makes sense since most objects inherit from ManufacturerSpecs which enables a SpecsFile sub-element. The problem we encounter is that when writing an MMApp config defining a SpecsFile we end up with the following JSON:
{
"Name": "Zeiss 43 em",
"ID": "858a5b4f-918c-4327-bce6-8a6f9e39e310",
"Tier": 1,
"Schema_ID": "EmissionFilter.json",
...,
"Manufacturer": "Zeiss",
"SpecsFile": "https://www.micro-shop.zeiss.com/en/us/shop/filterAssistant/filtersets/000000-1114-101",
"CatalogNumber": "000000-1114-101",
...,
},where SpecsFile is associated with a string value. The XSD defines SpecsFile as something much more complicated (a FileAnnotation):
<xsd:complexType name="ManufacturerSpec">
...
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" ref="MapAnnotation"/>
<xsd:element minOccurs="0" name="SpecsFile" type="FileAnnotation">
...
</xsd:complexType>which is itself a TypeAnnotation (and itself Annotation and so on):
<xsd:complexType name="TypeAnnotation">
...
<xsd:complexContent>
<xsd:extension base="Annotation"/>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="Annotation">
...
<xsd:sequence>
<xsd:element name="Description" minOccurs="0" maxOccurs="1">
...
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:sequence>
<xsd:element ref="AnnotationRef" minOccurs="0" maxOccurs="unbounded">
...
</xsd:element>
</xsd:sequence>
</xsd:sequence>
<xsd:attribute name="ID" use="required" type="AnnotationID">
...
</xsd:attribute>
<xsd:attribute name="Namespace" use="required" type="xsd:anyURI">
...
</xsd:attribute>
<xsd:attribute name="Annotator" use="optional" type="ExperimenterID">
...
</xsd:attribute>
</xsd:complexType>I'm not sure it would be wise to adapt MMApp in that regard, perhaps it is the XSD definition that should be simplified for SpecsFile.
A typical problem we encounter is that it is currently hard to "understand" SpecsFile is a sub-element and even harder to put the URL in its proper place. A nested structure (list of dict - typical of sub-elements) in the JSON config could help.
From our understanding, a SpecsFile object would look like this in xml:
<SpecsFile ID="Annotation:YourID" Namespace="YourNamespace">
<BinaryFile FileName="original_name.pdf" Size="0">
<External href="https://lumencor.com/products/sola-light-engine/" SHA1="0000000000000000000000000000000000000000"/>
</BinaryFile>
</SpecsFile>A JSON structure that would be easier for us would be something like this:
{
"Name": "Zeiss 43 em",
"ID": "858a5b4f-918c-4327-bce6-8a6f9e39e310",
"Tier": 1,
"Schema_ID": "EmissionFilter.json",
"Manufacturer": "Zeiss",
"SpecsFile": [
{"ID": "some-id",
"Namespace": "some namespace",
"BinaryFile": [
{"FileName": "some file name",
"Size": "0",
"External": [
{"href": "https://www.micro-shop.zeiss.com/en/us/shop/filterAssistant/filtersets/000000-1114-101",
"SHA1":"00000000000000000001"}
]
}
]
}
]
}