Developing Editors in Xtext Framework

Developing Editors in Xtext Framework

Developing Editors in Xtext Framework Bojana Dimić Surla Abstract – The article presents one approach in The first one is editor for entering structured development of editors as an alternative to data of MARC 21 bibliographic records, and standard screen forms for entering data. That second is editor for entering holdings data in approach relates to specifying Xtext grammar of database. the text that will be entered and generating EMF Those editors represent the improvement of model and editor on the basis of that editor in fourth version of system BISIS specification. Advanced functionalities of the described in [1], [2] and [3]. editor, such as generating help during editing and control of correctness of entered data are realized as extensions and constraints on generated EMF 2. SOFTWARE ENVIRONMENT model. Such an editor was verified on the example For development of editors described in this of entering data in library information system. Two paper we were using Eclipse platform. Eclipse editors are shown, one for entering structured was chosen as software environment for data of MARC 21 records and one for entering specification of the editors and as software holdings data. environment for running the editors. Index terms - grammmar, Eclipse, EMF, Java Eclipse is an open source project that represents environment for software 1. INTRODUCTION development. It enables work with various programming languages and on various NE of the most important aspects of platforms. Eclipse provides plug-in framework for Oinformation systems is digital content integration of additional software tool. creation, and most common way of creating EMF - Eclipse Modelling Framework [4] is digital content is by entering data in screen form. environment for software modelling and code In contemporary information systems data input generation. EMF enables software development is usually done in screen forms full of visual by generating source code based on structured components, such as labels, text fields, combo data model [5]. EMF model can be built on the boxes, etc. basis of UML models, XML schema and set of In this paper we give the suggestion for Java classes [6]. Moreover, EMF represents the development of editors that enable different way support for model-driven software development of entering data, the way that resembles to and is the base for other project in this area such entering data in text editors such as Microsoft as OpenArchitectureWare (oAW) [7]. Word and editors for writing source code. In such OAW is a platform for model-driven software editor user write data in big text area while editor development that provides parsing of models provides help and control of data correctness. and family of languages and generating source Those editors are created in Xtext framework code on the basis of that. Basic characteristics of without writing source code. They are realised this platform are that it is developed as a set of using model-driven software development by plug-ins for Eclipse, it is based on EMF meta- specification of data model as Xtext grammar modelling concept and all transformations and and generating EMF model and editor. generations are specified as workflows. Two editors are presented in this paper. Both Description of oAW usage is given in [8]. are used for entering data in library software The part of oAW is software tool Xtext for system BISIS. creation of domain-specific languages and generation of Eclipse text editor for those Manuscript received December 20, 2012. The research presented in this paper was supported by Ministry of Science and languages. Furthermore, oAW platform provides Technological Development of the Republic of Serbia, Grant III language Xtend for writing extensions of domain- III43007: “Technology Enhanced Infrastructure for eLearning in specific languages, language Check for Serbia”. specifying constraints and Xpand for writing Bojana Dimić Surla is with the Department of Mathematics and Informatics, Faculty of Sciences, University of Novi Sad, Serbia (e- templates for language transformations. Xtend is mail: [email protected]). used for defining content assist i.e. predefined set of acceptable values for input in editor. 3. EDITOR FOR MARC 21 RECORDS Constraints written in Check that is similar to A MARC 21 bibliographic record describes Object Constraints Language (OCL) are used for one publication (book, serial, article, etc.) and control of correctness of data entered in has exactly defined structure. MARC 21 record generated editor. starts with record leader followed by fields Xtext uses ANTLR – Another tool for language labeled with three digits. There are two types of recognition [9] for implementing parser. ANTLR fields, control fields and data fields. Control field is a tool that provides framework for language can contain either singular data about recognition, interpretation, compiling and publication, either set of fixed-length data on translation. ANTLR has excellent support for specific position. Data field has up to two syntax tree construction. indicators and set of subfields marked with letter In June 2010 the new version of Xtext 1.0 was or digit. Subfields contain bibliographic data as released as a part of Eclipse. This version their content. supports development of complex programming languages, editors for those languages as well as complete integrated development environment based on Eclipse [10]. Listing 1. Xtext grammar for MARC 21 records Existing editors for MARC 21 records that described in this chapter belongs to second are available at Library of Congress Internet group, except that it supports the control of site [11] can be divided into two groups. The entered data which is not the case with other first group includes those editors that provide editors in this group. Described approach of standard screen forms with labels and text development of editor for MARC 21 records is fields (Concourse [12]). The second group discussed in [14]. relates to editors that support input of MARC The first step in realisation of editor is 21 record as a free text (MarcEdit [13]). Editor specification of grammar for MARC 21 records in Xtext environment. This specification is model that are used in generated editor for shown in Listing 1. control of entered data. All that constraints Rule Record in grammar from Listing 1 were written in single file as an expression in describes one MARC 21 record. By this rule, Check language. One example of those MARC 21 record consists of leader represents constraints is number of field with the same by attribute leader of type Leader, set of name in the record. Some fields in MARC 21 control fields represents by attribute can appear more than once in the record (so controlFields that is the list of elements of called repeatable fields), while others can ControlField type and set of data fields appear only once. Check expression that represents by attribute dataFields that is the control this condition is: list of elements of DataField type. The order in which those elements are listed in the Context DataField ERROR grammar is the order in which those elements "Field"+this.name.toString(). should appear in the editor. subString(2,5)+"is not repeatable!" : On the basis of the grammar shown in isFieldOccurenceOK(this); Listing 1 EMF model of MARC 21 record and editor for input of MARC 21 records were This expression specifies the massage that will generated. In Xtext environment it is possible appear in the editor in context DataField if to specify constraints on generated EMF expression isFieldOccurenceOK is false. Figure 1. Editor za MARC 21 zapise On generated EMF model of MARC 21 newProposal("210 - Abbreviated records it is possible to specify extensions that Title", "210"), newProposal("222 - Key Title", are used in the editor for content assist i.e. "222"), generate list of possible values for input on newProposal("240 - Uniform Title", cursor position. Those extensions are written "240"), newProposal("242 - Translation of in Xtend language. One example of those Title by Cataloging Agency", "242"), extensions is the content assist for entering newProposal("243 - Collective name of the field in the editor that is specified Uniform Title", "243"), newProposal("245 - Title Statement", with the following expression: "245"), newProposal("246 - Varying Form of List[Proposal] Title", "246"), completeDataField_name(emf::EObject newProposal("247 - Former Title", ctx,String prefix) : "247") {newProposal("010 - Library of ...}; Congress Control Number", "010 # #"), ... The appearance of the generated editor is shown in Figure 1. Figure 1 illustrates input of bibliographic item. Each piece of information field name with list of possible values offered about holdings is presented by its own rule. to user. Elements declared with “=” are mandatory while optional elements are declared with “?=”. 4. EDITOR FOR HOLDINGS DATA Rules that describe single holdings elements Holdings data relates to single copy of consists of the label which is the key word publication in the library. Every copy has its written in the quotes in Xtext grammar and own inventory number, signature, acquisition, data itself that is entered in the editor. That etc. Within BISIS library software system those data can be of simple type such are String or pieces of information are stored in database Integer or can be of complex type such is Date tables. In this section we give the suggestion which is also presented as a rule in the given of creating editor in Xtext for those types of grammar. data. Listing 2 shows grammar for entering holdings data. The rule Inventory represents data type that describes one copy of Listing 2. Grammar of the language for input of holdings data Figure 2. Editor for holdings data On the basis of the grammar shown in the label there is an entered data that relates Listing 2 EMF model of holdings data and to one copy of a publication. editor for those data were generated. On the generated EMF model we specified constraints 5.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us