1 Innovative Solutions For Mission Critical Systems Using EMF Annotations to Drive Program Behavior February 19, 2014.

Slides:



Advertisements
Similar presentations
SDMX in the Vietnam Ministry of Planning and Investment - A Data Model to Manage Metadata and Data ETV2 Component 5 – Facilitating better decision-making.
Advertisements

T ESTING WITH J UNIT IN E CLIPSE Farzana Rahman. I NTRODUCTION The class that you will want to test is created first so that Eclipse will be able to find.
Using E-Class Initiating a case file with attached documents.
Introduction to XLink Transparency No. 1 XML Information Set W3C Recommendation 24 October 2001 (1stEdition) 4 February 2004 (2ndEdition) Cheng-Chia Chen.
Searching with Lucene Chapter 2. For discussion Information retrieval What is Lucene? Code for indexer using Lucene Pagerank algorithm.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 3rd Edition.
UML CASE Tool. ABSTRACT Domain analysis enables identifying families of applications and capturing their terminology in order to assist and guide system.
IBM Software Group © 2005 IBM Corporation University of Nantes Eclipse dayMarch 2005 The Eclipse Modeling Framework and the IBM Model Transformation Framework.
Unified Modeling Language
® IBM Software Group © 2006 IBM Corporation How to read/write XML using EGL This Learning Module shows how to utilize an EGL Library to read/write an XML.
XML files (with LINQ). Introduction to LINQ ( Language Integrated Query ) C#’s new LINQ capabilities allow you to write query expressions that retrieve.
Data Storage: Part 1 (Preferences)
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
Chapter 8: String Manipulation
Programming with Microsoft Visual Basic th Edition
JQuery CS 268. What is jQuery? From their web site:
XP New Perspectives on XML Tutorial 4 1 XML Schema Tutorial – Carey ISBN Working with Namespaces and Schemas.
McGraw-Hill© 2007 The McGraw-Hill Companies, Inc. All rights reserved. 1-1.
Classes and objects Practice 2. Basic terms  Classifier is an element of the model, which specifies some general features for a set of objects. Features.
HTML, XHTML, and CSS Chapter 12 Creating and Using XML Documents.
Java.sun.com/javaone/sf | 2004 JavaOne SM Conference | Session The Eclipse Modeling Framework Ed Merks, Ph.D. Software Architect IBM Canada Ltd.
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter.
Model Handling with EMF Eclipse ECESIS Project Model handling with EMF An introduction to the Eclipse Modeling Framework ATLAS group (INRIA & LINA),
Working with the XML Document Object Model ©NIITeXtensible Markup Language/Lesson 7/Slide 1 of 44 Objectives In this lesson, you will learn to: *Identify.
Writing JavaDocs Mimi Opkins CECS 274 Copyright (c) Pearson All rights reserved.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Lecture Set 11 Creating and Using Classes Part B – Class Features – Constructors, Methods, Fields, Properties, Shared Data.
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
New Perspectives on XML, 2nd Edition
1 Schema Registries Steven Hughes, Lou Reich, Dan Crichton NASA 21 October 2015.
Selected Topics in Software Engineering - Distributed Software Development.
Session 08 Module 14: Generics and Iterator Module 15: Anonymous & partial class & Nullable type.
The european ITM Task Force data structure F. Imbeaux.
Java 5 Part 1 CSE301 University of Sunderland Harry Erwin, PhD.
By: Rick Varella, Cuong Nguyen, & Henry Giathi. What is Books Zen Books? Books Zen Books is an e-commerce web application designed to allow students to.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
XML 2nd EDITION Tutorial 4 Working With Schemas. XP Schemas A schema is an XML document that defines the content and structure of one or more XML documents.
1 Tutorial 12 Working with Namespaces Combining XML Vocabularies in a Compound Document.
Ganymede Simultaneous Release | © 2008 by Springsite B.V., The Netherlands made available under the EPL v1.0 Teneo Ganymede Simultaneous Release.
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
JDojo and Its Usage Te-Hsin Shih 04/30/2013. Dojo Dojo Toolkit is an open source JavaScript library designed to ease the rapid development of cross-platform,
SilkTest 2008 R2 SP1: Silk4J Introduction. ConfidentialCopyright © 2008 Borland Software Corporation. 2 What is Silk4J? Silk4J enables you to create functional.
Lesson 13 Databases Unit 2—Using the Computer. Computer Concepts BASICS - 22 Objectives Define the purpose and function of database software. Identify.
Attributes C#.Net Software Development Version 1.0.
Page 1 – Autumn 2009Steffen Vissing Andersen SDJ I1, Autumn 2009 Agenda: Java API Documentation Code Documenting (in javadoc format) Debugging.
Doc.: IEEE /0169r0 Submission Joe Kwak (InterDigital) Slide 1 November 2010 Slide 1 Overview of Resource Description Framework (RFD/XML) Date:
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Accessing XML Documents Using DOM ©NIITeXtensible Markup Language/Lesson 8/Slide 1 of 23 Objectives In this lesson, you will learn to: * Use XML DOM objects.
Inheritance Type/Subtype Relationship. Inheritance Idea: An object B of one type, termed child class, inherits from another object A of another type,
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
16-1 Computing Fundamentals with C++ Object-Oriented Programming and Design, 2nd Edition Rick Mercer Franklin, Beedle & Associates, 1999 ISBN
IS-907 Java EE Introduction to JPA. Java Persistence API A framework for using relational databases in Java programs mapping between tables and classes,
Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
Today Javadoc. Packages and static import. Viewing API source code. Upcoming Topics: –protected access modifier –Using the debugger in Eclipse –JUnit testing.
Building KFS using KNS Presented by James SmithJustin Beltran University of ArizonaUniversity of California, Irvine.
© 2010 IBM Corporation RESTFul Service Modelling in Rational Software Architect April, 2011.
Notices Assn 2 is due tomorrow, 7pm. Moodle quiz next week – written in the lab as before. Everything up to and including today’s lecture: Big Topics are.
XML Namespaces In this first lesson XML Namespaces, you will learn to:
1 © 2003, Cisco Systems, Inc. All rights reserved. DMTF and Cisco Profile overview/comparison August 17, 2005.
Architecture for View Modeling in SysML Auto-View Generation Working Group Lead: Christopher Delp NASA JPL.
Variable Scope & Lifetime
Unified Modeling Language
Used & Signed UPload Matt Supko March 8, 2018.
How to organize and document your classes
CIS 199 Final Review.
Presentation transcript:

1 Innovative Solutions For Mission Critical Systems Using EMF Annotations to Drive Program Behavior February 19, 2014

2 Innovative Solutions For Mission Critical Systems Preview for:

3 Innovative Solutions For Mission Critical Systems This presentation uses the example EMF Library model to demonstrate how EAnnotations can be used to modify the behavior of an application. The approach used by CohesionForce to identify model parameters to be used in a search context is also provided. Summary:

4 Innovative Solutions For Mission Critical Systems Experience Level: Intermediate While the concepts discussed should be useful to all experience levels, some of the coding examples will require some level of familiarity in developing with EMF.

5 Innovative Solutions For Mission Critical Systems What are EMF Annotations? According to the EMF Book: “Annotations constitute a mechanism by which additional information can be attached to any object in an Ecore model.” This presentation uses the term EAnnotation to refer to EMF Annotations. The term Annotation is used throughout the Eclipse community for many different purposes.

6 Innovative Solutions For Mission Critical Systems Add documentation to generated code: source: key: documentation value: String used in documentation Generate code that uses the Object Constraint Language: Very detailed description here: ECore files created from XML Schema make prolific use of EAnnotations Common Uses of EAnnotations:

7 Innovative Solutions For Mission Critical Systems To add EAnnotations, 1. Right click on an element in the ecore editor and select “New Child- >EAnnotation”. 2. Fill in the Source property. 3. Right click on the EAnnotation and select “New Child->Details Entry” 4. Fill in the key and value properties of the Entry.

8 Innovative Solutions For Mission Critical Systems Demonstrate of working with EAnnotations in the ECore Editor

9 Innovative Solutions For Mission Critical Systems protected void createSearchAnnotations() { String source = " addAnnotation (libraryEClass, source, new String[] { "index", "true" }); } When the code is generated, the annotations are added in the PackageImpl class. An example of the generated code is shown below:

10 Innovative Solutions For Mission Critical Systems Accessing EAnnotations in code: Since the EAnnotation is an attribute of the base EModelElement class, it is accessible for pretty much everything in an EMF Object by moving from the concrete structure to the meta level. From the concrete EObject, the EClass is available through the.eClass() method. The data classes for most code generated from EMF models extends the EObject interface.

11 Innovative Solutions For Mission Critical Systems Below is an example of accessing an EAnnotation from the EClass of an EObject. The variable EMFIndexUtil.SOURCE is a static final String set to " which is used for the source of the EAnnotation. public void indexContents(EObject obj) { logger.debug("Indexing contents of {}", obj.eClass().getName()); EAnnotation annotation = obj.eClass().getEAnnotation( EMFIndexUtil.SOURCE);.

12 Innovative Solutions For Mission Critical Systems The features of a class are available through the EClass of an EObject. for (EStructuralFeature feature : obj.eClass().getEAllStructuralFeatures()) { // Do something with the feature } The following slide shows the method of retrieving EAnnotations from an EStructuralFeature.

13 Innovative Solutions For Mission Critical Systems protected void indexFeature(Document doc, EStructuralFeature feature, EObject object) { boolean recurse = false; boolean tokenize = false; boolean index = false; EAnnotation annotation = feature.getEAnnotation(EMFIndexUtil.SOURCE); if (annotation != null) { if (annotation.getDetails().containsKey(EMFIndexUtil.RECURSE_KEY)) { recurse = true; } if (annotation.getDetails().containsKey(EMFIndexUtil.TOKENIZE_KEY)) { tokenize = true; } if (annotation.getDetails().containsKey(EMFIndexUtil.INDEX_KEY)) { index = true; } } else { // Bail out early if this feature should not be indexed return; }.

14 Innovative Solutions For Mission Critical Systems Any questions about creating EAnnotations, generating code, or accessing EAnnotations?

15 Innovative Solutions For Mission Critical Systems The following section describes a capability created by CohesionForce named EMFIndex that applies EMF Annotations to determine how data instances are indexed using Apache Lucene. This capability will be released publicly under the Eclipse Public License as a part of our participation in EclipseCon2014.

16 Innovative Solutions For Mission Critical Systems EMF Index EMF Index is a technique for using EMF Annotations to determine how an instance of an EMF model should be indexed using Apache Lucene. Annotations The annotations defined for EMF Index are as follows: Source: Details: Key: tokenizeValue: N/A Key: recurseValue: N/A Key: indexValue: N/A

17 Innovative Solutions For Mission Critical Systems The annotations can be applied in three different places: 1. EClass – The index detail entry is used to indicate that instances of this class should be indexed as a unique document with Apache Lucene. The unique document will always include the following terms: URI of the containing Resource FragmentURI in the containing Resource to the class instance EClass name of the class instance 2. EAttribute – The tokenize detail entry is used for EString attributes to indicate that the value should be tokenized before indexing. 3. EReference (containment or non-containment) – The recurse detail entry is used to specify that the object referenced should also be folded into the same document as the class instance. This allows a hierarchical structure to be indexed in a flat document. An EReference marked with the index annotation will store the fragment URI of the referenced object.

18 Innovative Solutions For Mission Critical Systems To demonstrate the use of EAnnotations with Apache Lucene, we will start with a data set for the Library EMF Example. We did several searches with the Huntsville Madison County Library ( and converted the search results to instances of model data. The dataset includes > 4500 books with lots of authors and many of the branches included as libraries. We use a JUnit test framework to grab some timing metrics with both Lucene and also normal file loading for: Listing all Books Listing all Authors Listing all Books with the word “leader” in the title

19 Innovative Solutions For Mission Critical Systems Demo Time!

20 Innovative Solutions For Mission Critical Systems Observations on Lucene: Indexing 9188 files took ~67 minutes. Most of this time seems to be spent on items marked with “tokenize=true”. The file search version of the test simply uses the title.contains() method. This returns files with the word “leadership” in addition to the word “leader”. There are many powerful search methods provided by Lucene that we have not yet exposed.

21 Innovative Solutions For Mission Critical Systems References: EMF: Eclipse Modeling Framework, 2nd Edition By Dave Steinberg, Frank Budinsky, Marcelo Paternostro, Ed Merks EMF Examples: EMF Source: git://git.eclipse.org/gitroot/emf/org.eclipse.emf.git