Query2 eclipse day

Post on 11-May-2015

1,718 views 0 download

Tags:

description

Contains the detailed feature level description and screenshots of Query2.This was presented in the Eclipse Day India 2011

transcript

EMF Model Query2-The next generation model

query languageSaurav Sarkar, SAP Labs India, Bangalore

Saurav Sarkar-EMF Model Query2

Eclipse Day Talk – May 6th 2011

Need for model queryingSaurav Sarkar-EMF Model Query2

Need for EMF is well known. Once the application is on EMF then the need for querying arises.

Querying for objects, types of objects and the links between the objects becomes an utmost necessity.

EMF Model Query and EMF Model Query2

EMF Query is a subproject under EMF project which again has two features EMF Model Query and EMF Model Query2.

Major difference between the two is in terms of the scalability.

◦ EMF Model Query execute queries by loading all the resources in the memory.

◦ EMF Model Query2 in comparison execute queries by minimally loading the resources .

Saurav Sarkar-EMF Model Query2

Key aspects of QueryingSaurav Sarkar-EMF Model Query2

Key features of Model Query2

Scalable Query execution engine and retrieval of results of interest.

Dirty state awareness.

Ways of expressing Queries. AST and Textual.

New XText based SQL like human readable language.

Testing the model through the XText based UI.

Pre configuring scoping before execution of queries.

Queries are type safe.

Saurav Sarkar-EMF Model Query2

Query Editor and SQL Like Queries

Saurav Sarkar-EMF Model Query2

Query Execution and ResultsSaurav Sarkar-EMF Model Query2

Query Preference pageSaurav Sarkar-EMF Model Query2

Query View-Viewing the QueriesSaurav Sarkar-EMF Model Query2

AST Based Query Syntax example

@Testpublic void testLibrary(){final ResourceSet rs = new ResourceSetImpl();

FromType fromRelationShip = new FromType("lib", EcoreUtil.getURI(LibraryPackage.eINSTANCE.getLibrary()), false);

FromEntry[] fromEntries = new FromEntry[] { fromRelationShip };

SelectAlias selectMe = new SelectAlias("lib");SelectEntry[] selectEntries = new SelectEntry[] { selectMe };

Query query = new Query(selectEntries, fromEntries);

ResultSet execute = QueryProcessorFactory.getDefault().createQueryProcessor(getDefaultIndexStore()).execute(query, getQueryContext(rs));

}

Saurav Sarkar-EMF Model Query2

Architectural OverviewSaurav Sarkar-EMF Model Query2

Architecture – Interpreter and the storage processors

Saurav Sarkar-EMF Model Query2

Indexing in Query2Saurav Sarkar-EMF Model Query2

Index provides information for narrowing the scope of resources that have to be loaded during execution.

It contains data about resources, Eobjects and references between them. Index is able to rapidly answers queries for resources , elements and one step reference navigation-forward and backward.

Indexes can be paged, dumped and loaded according to user scenarios.

Index Data StructuresSaurav Sarkar-EMF Model Query2

The Index is stored in the granularity of an EMF resource as a page.

A ResourceDescriptor corresponds to a resource.The ResourceDescriptor then further can aggregate

number of ReferenceDescriptor and EObjectDescriptor.

Type of IndicesSaurav Sarkar-EMF Model Query2

Index QueriesSaurav Sarkar-EMF Model Query2

Index implementation also supports queries to be performed.

Queries can be performed to retrieve resource, type and reference information.

Queries can be performed on the descriptors.

Introducing Index ViewSaurav Sarkar-EMF Model Query2

To facilitate the users to view the resources which have been indexed, Query 2 provides a dedicated view called Index View.

Index View displays the indices in two broad categories:- Resource Index and Type Index.

More details of Index View on the developer guide.

Demo of Index ViewSaurav Sarkar-EMF Model Query2

Dirty state HandlingSaurav Sarkar-EMF Model Query2

Query engine is aware of the dirty state of the resources i.e. the results are returned depending upon the state of the resources.

Tooling support is available for dirty state execution of queries.

Execution of Query with Dirty state awareness. Saurav Sarkar-EMF Model

Query2

Demo of Dirty state HandlingSaurav Sarkar-EMF Model Query2

Query engine is aware of the dirty state of the resources i.e. the results are returned depending upon the state of the resources.

Tooling support is available for dirty state execution of queries.

Development tooling and scenarios achieved through Query2- Searching

Saurav Sarkar-EMF Model Query2

Searching of model elements can be done using Query2 without actually loading the elements.

A search UI was developed to test the scenario.

Search EMF Models using Query2Saurav Sarkar-EMF Model Query2

Development tooling and scenarios achieved through Query2- Refactoring

Saurav Sarkar-EMF Model Query2

Refactoring of model elements requires references to be updated.

Using query2 reference searches can be performed which in turn loads minimal resources and hence fast refactoring can be achieved.

Refactoring of EMF Models using Query2

Saurav Sarkar-EMF Model Query2

Query2- View ModelsSaurav Sarkar-EMF Model Query2

Models can be viewed without actually loading the model elements.

A model explorer was implemented to prove the scenario.

Junits in Query2

80 % of the major scenarios are covered through JUnits.

Sneak peek into Junits to see the Query execution code.

Saurav Sarkar-EMF Model Query2

Planned new features

Implementing Query2 Execution in Databases.

Integration of CDO with Query2.https://bugs.eclipse.org/bugs/show_bug.cgi?id=329723

Indexing enhancements like Pluggable Index builder, Indexing APIs.

Date and BigInteger support in Query2https://bugs.eclipse.org/bugs/show_bug.cgi?id=338164

Saurav Sarkar-EMF Model Query2

Useful links and feedback

Update site link https://hudson.eclipse.org/hudson/job/tycho-query2-nightly/lastSuccessfulBuild/artifact/targetPlatform/

Query2 wiki homehttp://wiki.eclipse.org/EMF_Query2Home

Query2 developer guidehttp://wiki.eclipse.org/EMF_Query2Home/EMF_Query2DevGuide

For any questions, suggestions and feedback on Query please mail to saurav.sarkar@sap.com or ashwani.kr.sharma@sap.com

You can also ask questions on the EMF forums.

Saurav Sarkar-EMF Model Query2