“qebu: an advanced metadata editor”, paolo pasini polytechnic university of turin
DESCRIPTION
QEbu: Project specifica1ons } QEbu provides an editor for metadata following the EBU Core Metadata Set. } The user is able to produce new metadata documents or edit existing ones. } A simple graphic interface helps the user in his work by providing: ◦ Instant validation on all input fields; ◦ Dictionaries for dictionary based attributes; ◦ In-place documentation for all metadata elements.TRANSCRIPT
“QEbu: an advanced metadata editor” Paolo Pasini Polytechnic University of Turin Get in contact: [email protected]
#FIATIFTADubai2013 Paolo Pasini: “QEbu- an advanced metadata editor”
Copyright © of this presenta1on is the property of the author(s). FIAT/IFTA is granted permission to reproduce copies of this work for purposes relevant to the above conference and future communica1on by FIAT/IFTA without limita1on, provided that the author(s), source and copyright no1ce are included in each copy. For other uses, including extended quota1on, please contact the author(s).
Contents
} Introduction } Model design } XML management } GUI ◦ Interface ◦ Data management
} Conclusion
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
EBU Core Metadata Set
} Has been developed by the EBU Expert Community on Metadata (ECM).
} Latest revised in october 2011 (version 1.3).
} It makes use of Simple Dublin Core metadata elements as well as more complex structures with deeper expressivity and flexibility.
} The general aim is to define a minimum list of attributes characterising a media resource.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
QEbu: Project specifica1ons
} QEbu provides an editor for metadata following the EBU Core Metadata Set.
} The user is able to produce new metadata documents or edit existing ones.
} A simple graphic interface helps the user in his work by providing: ◦ Instant validation on all input fields; ◦ Dictionaries for dictionary based attributes; ◦ In-place documentation for all metadata
elements.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Why a GUI?
} Editing XML by hand is a hard task, especially with high complex structure definition.
} Using a GUI, the user can focus on metadata content, instead of worry about the format in which metadata will be stored.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Contents
} Introduction } Model design } XML management } GUI ◦ Interface ◦ Data management
} Conclusion
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
From XML to C++
} “A class for each element” } Yes, but with as much code reuse as
possible.
} Exploiting objects composition and inheritance, we tried to keep the number of defined classes to a reasonable minimum.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Managing IDRefs
} RightsType and PublicationType elements contain a reference to a FormatType ◦ It’s a strong relation enforced by the usage of
ID-IDREF(s) types in the schema definition.
} Corresponding classes have been designed to contain a pointer to the format. ◦ Why not a simple string with the ID?
} However pointers require careful handling: ◦ What happens if a format is deleted?
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Root Format Map
} We have introduced a root format map in the top-level metadata element: ◦ Key: format ID; ◦ Value: formatType pointer and a list of listeners.
} A listener is an object which needs to know if a format is deleted (i.e. rightsType and publicationType).
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Contents
} Introduction } Model design } XML management } GUI ◦ Interface ◦ Data management
} Conclusion
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
The issue
} Provide manipulation functionalities over the contents of an XML file of interest, and allow creation of a valid document from scratch.
} It is required a way to map model objects from, and to, XML documents, in a sensible and coherent way
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Which way?
} The requirements of the application, and the complexity of the schema, pretty much call for DOM loud and clear.
} DOM makes for an easier management of the contents, and cover all the requirements needed.
} What about performance?
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Valida1on
} A fundamental aspect of working with XML is the validation of the contents… ◦ …but Qt doesn’t provide anything robust
enough. } In this case it is better to delegate to
something else, which does just that: ◦ xmllint, from libxml2
} What if an input file does not validate? } Validation comes for free when working
from scratch.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
XML to memory…
} This step is performed by EbuParser, which visits recursively the document model managing one node at a time.
} “A class for each element, and for each class its parser”.
} We defined a pattern to achieve code homogeneity and readability.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
EbuParser snippet
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
T* EbuParser::parseT(const QDomElement &element)
{
// Sanity check for node element validity
if (element.isNull()) {
m_errorMsg = “T element is null";
return 0;
}
// Create custom object T
T *obj = new T;
// Get attribute(s).
t attributeName = element.attribute("attributeName");
// Sanity check for attribute validity, according to
// the specific type
if (!attributeName.isValid())
obj->setAttributeName(attributeName);
// all the attributes parsed...
// Get element(s)
// A node list is expected in this example
QDomNodeList nodeList =
element.elementsByTagName("tagName");
for (int i=0; i < nodeList.size(); ++i) {
QDomElement el = nodeList.item(i).toElement();
// In case of nested elements with a given name, which
// are not dicrect children of the current node, skip
if (el.parentNode() != element)
continue;
// Recursively parse the child element, like we just
// did with its parent
ChildT *child = parseChildT(el);
// In case the returned child is not valid (i.e. null)
if (!child) {
// Destroy the parent as well and return failure
delete obj;
return 0;
}
// In case of success append the child in the proper
// structure
obj->tagName().append(child);
}
// Proceed with more children elements…
return obj;
}
…and back!
} The steps from memory to XML are performed by EbuSerializer, which is the dual counterpart of our custom parser just described.
} Once again, to iterate is human, to recurse divine.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
EbuSerializer snippet
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
QDomElement EbuSerializer::serializeT(T *obj)
{
// Create an empty unnamed element
QDomElement l = m_doc.createElement(" ");
// Serialize attribute(s), performing sanity check
// prior to write data
if (!obj->attribute1().isValid())
l.setAttribute("attribute1", obj->attribute1());
if (!obj->attribute2().isValid())
l.setAttribute("attribute2", obj->attribute2());
// ...all the attributes
if (!obj->element1().isEmpty()) {
// Create inner empty unnamed element
// This is just a text node
QDomElement e = m_doc.createElement(" ");
e.setTagName("innerElementName");
QDomText textNode =
m_doc.createTextNode(l->element1());
e.appendChild(textNode);
l.appendChild(e);
}
if (obj->element2()) {
// This is a child element node
QDomElement e = serializeT2(obj->element2());
e.setTagName("anotherInnerElementName");
l.appendChild(e);
}
// For all the elements...
return l;
}
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Infinite descent
} The EBU Core metadata allows the definition of element types that may include content of the very same type.
} The recursive approach has proven to be the only way worth implementing to handle with ease the schema specifics.
Contents
} Introduction } Model design } XML management } GUI ◦ Interface ◦ Data management
} Conclusion
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
User interface
} For almost every object in the model, a dedicated form has been created.
} As a rule of thumb, the principle criteria followed can be summarized like: ◦ Whenever possible attributes are managed via edit
fields; ◦ In case of range-restricted values, pickers are
employed; ◦ Children elements come with their own form, but few
exceptions (i.e. groups); ◦ If possible attributes/elements are grouped together
in a meaningful way; ◦ Recycle as much as possible exploiting composition.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Stack of Forms
} The user interface employs a custom pattern based on stackable forms.
} The users can see only one form at a time } No popup dialogs } Linear path of navigation
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Lists, lists everywhere…
} Many elements include subelements with cardinality [0..*].
} This poses some problems in the UI design: ◦ How to avoid congesting the interface? ◦ How to deal with the coexistence of lists and [0..1]
elements?
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Users first aid
} QEbu offers several features intended for this goal: ◦ A quickstart tutorial; ◦ A navigation bar; ◦ Embedded documentation ◦ Auto completion
Contents
} Introduction } Model design } XML management } GUI ◦ Interface ◦ Data management
} Conclusion
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Data input
} Design challenges: ◦ Provide user-friendly forms; ◦ Propose values from dictionaries; ◦ Grant an instantaneous input validation.
} Qt framework already provides many widgets for different type of input.
} But something was still missing…
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Some examples
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Auto-‐comple1on
} Some fields are meant to store a reference to standard lists of contents.
} The reference scheme are listed in EBU Core documentation.
} Those values are retrieved from a set of XML files downloaded from EBU website, when available.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Schema-‐related problems
} EBU Core schema uses XML Schema types. } It does not restrict them enough. } What is the use of:
• duplicated timezones? • years, months, days of duration? • negative durations?
} It permits to express values which can be meaningless or discordant.
} This may cause troubles for any program which wants to handle those metadata.
Contents
} Introduction } Model design } XML management } GUI ◦ Interface ◦ Data management
} Conclusion
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Tes1ng
} It is known that testing should be done by someone not involved in the coding phase… ◦ … but sometimes it is everything you got.
} Being realistic, it is more a matter of where bugs lie, rather than whether bugs are there.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Future works
} Internationalization (i18n) ◦ The code is already ready for i18n since all text
strings have been surrounded by Qt special macros.
} Forms re-design ◦ We treated each field and attribute equally. ◦ Feedback from EBU-EMC experts who actually
use such metadata could lead to better tailored forms with relevant contents more easily accessible.
} Dynamic download of attribute dictionaries from EBU website.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
QEbu is free so\ware
} QEbu is released under terms of the GNU General Public License 3 as published by the Free Software Foundation.
} The application is built using Qt 4.8 framework by Nokia. ◦ http://qt.nokia.com/products/library
} XML validation requires libxml2 to be installed.
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
QEbu project in numbers
} 7 weeks } 5 people } 252 commits } 39428 LOC ◦ 8438 in model/* ◦ 5485 in fileproc/* ◦ 25505 in ui/*
} 149 classes ◦ 68 in model/* ◦ 3 in fileproc/* ◦ 78 in ui/*
“QEbu: an advanced metadata editor” Paolo Pasini Polytechnic University of Turin Get in contact: [email protected]
#FIATIFTADubai2013 Paolo Pasini: QEbu – an advanced metadata editor
Copyright © of this presenta1on is the property of the author(s). FIAT/IFTA is granted permission to reproduce copies of this work for purposes relevant to the above conference and future communica1on by FIAT/IFTA without limita1on, provided that the author(s), source and copyright no1ce are included in each copy. For other uses, including extended quota1on, please contact the author(s).