{"id":3213,"date":"2018-06-22T20:59:18","date_gmt":"2018-06-22T20:59:18","guid":{"rendered":"https:\/\/notebooks.dataone.org\/?p=3213"},"modified":"2019-05-24T17:47:30","modified_gmt":"2019-05-24T17:47:30","slug":"week-4-creating-parser-in-apache-tika-for-onedcx-file-format","status":"publish","type":"post","link":"https:\/\/notebooks.dataone.org\/extending-libmagic\/week-4-creating-parser-in-apache-tika-for-onedcx-file-format\/","title":{"rendered":"Week 4: Creating Parser in Apache Tika for onedcx file format"},"content":{"rendered":"
Hi All,<\/p>\n
This blog is in conjunction with my earlier blogs for the Project 4: Extending Libmagic for Identification of Science Resources. Continuing from the last week, we explored Apache serve functionality for detecting the Custom mime types for the DataONE file format. The httpd.conf file of the server is a configuration file, and the “MIMEMagicFile” directive can be set to point to a custom magic file. Due to the limitation in the use of magic file for Apache server as compared to the file command, we can’t use it for defining the metadata of DataONE file format. We updated the documentation for the file identification using the file command<\/a>, Apache Tika<\/a>, and Apache server<\/a>.<\/p>\n The next objective is to explore the further functionality offered by Apache Tika for detecting and parsing the metadata of the file formats. Apache Tika provides numerous functionality for content detection and extraction by the simple configuration of the Apache Tika application.<\/p>\n In Week 3<\/a>, we completed the task of adding and finding custom mime types for DataONE file format. This week we set our goal to create a parser in Tika for extracting the metadata of onedcx file format. We created a maven projec<\/a>t as a development environment and added the required Tika and custom-mimetypes.jar file.<\/p>\n During the creation of the parser files for the onedcx file format, we faced issues in extracting the metadata of the file using the default functionality. The onedcx file is an XML file, and the contents of it were parsed using the XMLParser class of Tika. The text contents of the file were successfully extracted but not the metadata of the file, which we needed. The issue is caused due to the default functionality of Tika for XML file, which extracts the text contents of the XML but not the metadata excepts for the files with Dublin core format. For resolving this issue we created a onedcx file with the XML tags of the metadata. It also set the XML namespace of the file too.<\/p>\n Once, the metadata file for the onedcx XML file was created, the metadata extraction was successfully performed. We leveraged the functionality of the Dublin core file format for creation of the onedcx parser and the metadata.<\/p>\n In the coming weeks, we will work on the parsers for the other DataONE file formats.<\/p>\n That’s all for now, see you all next week!<\/p>\n Have a great weekend!<\/p>\n Resource links: Github-file_identification<\/a>, Github-DataONE Parser,<\/a> Project Plan<\/a><\/p>\n","protected":false},"excerpt":{"rendered":" Hi All, This blog is in conjunction with my earlier blogs for the Project 4: Extending Libmagic for Identification of Science Resources. Continuing from the last week, we explored Apache serve functionality for detecting the Custom mime types for the DataONE file format. The httpd.conf file of the server is Continue reading Week 4: Creating Parser in Apache Tika for onedcx file format<\/span>