Thanks for suggestion
Hi all,
I am trying to build Bio Database based on different file types (RAW, WIFF, DTA, MGF, mzXML) information to overcome searching or comparision on "set of files". The main drawback existed in previous tools is that support query on the only set of files, so questioning whole file type was impossible. My aim is building database and parse all files information into database , minimize redundancy and make GUI for quering.
The main good aspect is that I can convert almost all files to XML (mzXML or mzML) format. But, I am somehow lost in creating database from XML Schema. The problem I am facing is how to mapped these complex XML Schema into Relational Database? Moreover, the intensity of complexity increase when building relationship between the sets of XML schema elements. I went through XML2DB, but doesn't sound promising, Altova XML spy got feature but commercial product. So, I have to say till now haven't found soluton to my problem.
Parsing is second step; but building Database is important in the begining. I am trying to find out the solution. In between does anyone here in BioStar have experience regarding such matter?
Any suggestions, answers and comments are welcome!
2 answers
I thought MySQL had a tool to parse XML into some sort of table structure? I haven't used it myself, though.
However, if I wanted to do what you describe, I would write the mapping layer myself, and not use a tool to do it automatically. The reason is that there is a fundamental difference between the XML data model and the relational data model. Most XML schemas are quite hierarchical. Relational databases are, well, relational. Serializing a relational model into a hierarchical model is fairly easy to automate, so there are a lot of tools that will do that- i.e., write XML from a relational schema. Going in the opposite direction isn't so straight-forward, in my opinion. You basically need to look at the structure of the XML, design a good relational schema to hold the same data, and then map the XML elements to that schema. Personally, I'd want to do that by hand to make sure that I got a schema that would both protect data integrity and be easy to query. Once you've designed your relational schema and done the mapping from the XML schema to that, you might be able to use some of the XML loading tools to load the XML. I think whether or not that will work will depend on how complex the mapping is. If the tools won't work for you, you could write your own code to do it.
So the steps I'd take are:
- Design target relational schema
- Map all XML schemas to the target relational schema
- Either use the XML loading tool for my database of choice to load in the XML or write some code to load the XML, depending on the complexity of the mapping
It's very difficult to create a SQL schema from a XSD schema because the relationships (one-to-many, many-to-many) and the keys (primary keys, indexes) cannot be clearly defined with xsd.
In my experience, the best code generator for this ask was myslef :-)
You can also store the whole XML document in a TEXT column:
#column type
pmid int integer primary key
xml-pubmed-record text
@Pierre, can you refer me any resources regarding your suggestion?
Log in to answer this question.