|
Back
Midas
Rome
Roody
Rootana
|
Rome Analyzer Framework |
Not logged in |
|
|
|
Message ID: 1
Entry time: 05 Oct 2004
Reply to this: 2
|
Author: |
Jan Wouters |
Topic: |
Suggestion |
Subject: |
xml and ROME |
|
|
After looking at the example xml document for the MEG detector I would like to make the following suggestion.
Only a small portion of the power of XML is used with the MEG example i.e., the ability to express the data as a
hierarchical tree. Missing is the powerful feature of XML to establish a schema for the XML document specific
to ROME that enforces a valid structure.
XML uses the XML Schema language, which is in turn based on XML, to define a schema for a document. I
propose that a ROME schema be developed that defines an XML document that the ROME builder can read
and process. By having such a schema, general purpose XML editors can validate the XML document prior to
invoking the ROME builder. Thus the schema greatly simplifies a user's task of developing a ROME xml
document describing their experiment. In addition, a good XML editor uses the schema to indicate to the user
the elements available at any particular point in the document so that the user doesn't have to remember all the
entries, which are required or optional to describe an experiment.
With this e-mail I include two documents. The first is an example schema for ROME. This schema is
incomplete, but illustrates the major concepts of using a schema to specify the acceptable format of the XML
document and providing help to the user for building the document. The second is an example XML document
built using the ROME sample schema. It is for an experiment currently in production at the Los Alamos
National Laboratory.
To get this example to work you will have to change the second line of DANCESchema.xml so that it properly
points to the ROME.xsd document. For this example I used the Java based XML editor Oxygen.
Notes on Schema:
1) Every element in the schema has a fixed name. All experimental data is included as either xml data or an
xml attribute.
2) Based on the suggestion by http://www.xmlfiles.com/xml/xml_attributes.asp attributes are used sparingly or
not at all. Instead data is specified as XML data e.g. <data>the actual data</data>.
If you have any questions concerning this example please e-mail jwouters@lanl.gov. |
|
|
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation>Described some enumerated types</xs:documentation>
</xs:annotation>
<xs:simpleType name="RootType">
<xs:restriction base="xs:string">
<xs:enumeration value="Float_t"/>
<xs:enumeration value="ULong_t"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="HistTypeDesc">
<xs:restriction base="xs:string">
<xs:enumeration value="TH1C"/>
<xs:enumeration value="TH1S"/>
<xs:enumeration value="TH1F"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="MidasType">
<xs:restriction base="xs:string">
<xs:enumeration value="DWORD"/>
<xs:enumeration value="float"/>
</xs:restriction>
</xs:simpleType>
<xs:annotation>
<xs:documentation>Describe general types</xs:documentation>
</xs:annotation>
<xs:complexType name="AuthorDesc">
<xs:sequence>
<xs:element name="AuthorName" type="xs:string"/>
<xs:element name="AuthorInstitute" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="AuthorCollaboration" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="AuthorEmail" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:annotation>
<xs:documentation>Describe types used by subfolders</xs:documentation>
</xs:annotation>
<xs:complexType name="FieldDesc">
<xs:sequence>
<xs:element name="FieldName" type="xs:string"/>
<xs:element name="FieldType" type="RootType"/>
<xs:element name="FieldComment" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SubFolderDesc">
<xs:sequence>
<xs:element name="SubFolderName" type="xs:string"/>
<xs:element name="SubFolderTitle" type="xs:string"/>
<xs:element name="ArraySize" type="xs:integer"/>
<xs:element name="Field" type="FieldDesc" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:annotation>
<xs:documentation>Describe tasks</xs:documentation>
</xs:annotation>
<xs:complexType name="HistDesc">
<xs:sequence>
<xs:element name="HistFolder" type="xs:string"/>
<xs:element name="HistTitle" type="xs:string"/>
<xs:element name="HistType" type="HistTypeDesc"/>
<xs:element name="HistArraySize" type="xs:integer" minOccurs="0" default="1"/>
<xs:element name="HistSize" type="xs:integer"/>
<xs:element name="xMin" type="xs:integer" minOccurs="0" default="0"/>
<xs:element name="xMax" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HistogramsDesc">
<xs:sequence>
<xs:element name="Histogram" type="HistDesc" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SubTaskDesc">
<xs:sequence>
<xs:element name="TaskName" type="xs:string"/>
<xs:element name="TaskEventId" type="xs:integer"/>
<xs:element name="Author" type="AuthorDesc"/>
<xs:element name="TaskVersion" type="xs:integer"/>
<xs:element name="Histograms" type="HistogramsDesc" minOccurs="0" maxOccurs="1"/>
<xs:element name="TaskDesc" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:annotation>
<xs:documentation>Describe elements used by MidasBanks</xs:documentation>
</xs:annotation>
<xs:complexType name="EventHeaderDesc">
<xs:sequence>
<xs:element name="Folder" type="xs:string"/>
<xs:element name="EventId" type="xs:string"/>
<xs:element name="TriggerMask" type="xs:string"/>
<xs:element name="SerialNumber" type="xs:string"/>
<xs:element name="TimeStamp" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EventDataDesc">
<xs:sequence>
<xs:element name="DataName" type="xs:string"/>
<xs:element name="DataType" type="MidasType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EventStructDesc">
<xs:sequence>
<xs:element name="EventName" type="xs:string"/>
<xs:element name="EventData" type="EventDataDesc" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:annotation>
<xs:documentation>Describe overall document</xs:documentation>
</xs:annotation>
<xs:element name="Experiment">
<xs:complexType>
<xs:sequence>
<xs:element name="ExperimentName" type="xs:string"/>
<xs:element name="Author" type="AuthorDesc"/>
<xs:element name="Folder">
<xs:complexType>
<xs:sequence>
<xs:element name="SubFolder" type="SubFolderDesc" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Task">
<xs:complexType>
<xs:sequence>
<xs:element name="SubTask" type="SubTaskDesc" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="MidasBanks">
<xs:complexType>
<xs:sequence>
<xs:element name="EventHeader" type="EventHeaderDesc"/>
<xs:element name="EventStructure" type="EventStructDesc" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
|