Eclipse Con

Embed Size (px)

Citation preview

  • 8/3/2019 Eclipse Con

    1/21

    EMF Model Query2-Thenext generation model

    query languageSaurav Sarkar, SAP Labs India, Bangalore

    Saurav Sarkar-EMF Model

    Query2

  • 8/3/2019 Eclipse Con

    2/21

    Need for model queryingSaurav Sarkar-EMF Model

    Query2

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

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

  • 8/3/2019 Eclipse Con

    3/21

    EMF Model Query and EMF ModelQuery2

    EMF Query is a subproject under EMF project whichagain has two features EMF Model Query and EMFModel Query2.

    Major difference between the two is in terms of thescalability.

    EMF Model Query execute queries by loading all the resourcesin the memory.

    EMF Model Query2 in comparison execute queries by minimallyloading the resources .

    Saurav Sarkar-EMF Model

    Query2

  • 8/3/2019 Eclipse Con

    4/21

    Key features of Model Query2Saurav Sarkar-EMF Model

    Query2

  • 8/3/2019 Eclipse Con

    5/21

    Key features of Model Query2

    Scalable Query execution engine and retrieval of results ofinterest.

    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

  • 8/3/2019 Eclipse Con

    6/21

    Query Editor and SQL Like QueriesSaurav Sarkar-EMF Model

    Query2

  • 8/3/2019 Eclipse Con

    7/21

    Query Execution and ResultsSaurav Sarkar-EMF Model

    Query2

  • 8/3/2019 Eclipse Con

    8/21

    Query View-Viewing the QueriesSaurav Sarkar-EMF ModelQuery2

  • 8/3/2019 Eclipse Con

    9/21

    Architectural OverviewSaurav Sarkar-EMF ModelQuery2

  • 8/3/2019 Eclipse Con

    10/21

    Indexing in Query2Saurav Sarkar-EMF ModelQuery2

    Index provides information for narrowing the scopeof resources that have to be loaded during

    execution.

    It contains data about resources, Eobjects andreferences between them. Index is able to rapidlyanswers queries for resources , elements and one

    step reference navigation-forward and backward.

    Indexes can be paged, dumped and loadedaccording to user scenarios.

  • 8/3/2019 Eclipse Con

    11/21

    Dirty state HandlingSaurav Sarkar-EMF ModelQuery2

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

    upon the state of the resources.

    Tooling support is available for dirty state executionof queries.

  • 8/3/2019 Eclipse Con

    12/21

    Execution of Query with Dirtystate awareness.

    Saurav Sarkar-EMF ModelQuery2

  • 8/3/2019 Eclipse Con

    13/21

    Development tooling andscenarios achieved throughQuery2- Searching

    Saurav Sarkar-EMF ModelQuery2

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

    A search UI was developed to test the scenario.

  • 8/3/2019 Eclipse Con

    14/21

    Search EMF Models using Query2Saurav Sarkar-EMF ModelQuery2

  • 8/3/2019 Eclipse Con

    15/21

    Development tooling andscenarios achieved throughQuery2- Refactoring

    Saurav Sarkar-EMF ModelQuery2

    Refactoring of model elements requires referencesto be updated.

    Using query2 reference searches can be performedwhich in turn loads minimal resources and hencefast refactoring can be achieved.

  • 8/3/2019 Eclipse Con

    16/21

    Refactoring of EMF Models usingQuery2

    Saurav Sarkar-EMF ModelQuery2

  • 8/3/2019 Eclipse Con

    17/21

    Development tooling andscenarios achieved throughQuery2- View Models

    Saurav Sarkar-EMF ModelQuery2

    Models can be viewed without actually loading themodel elements.

    A model explorer was implemented to prove thescenario.

  • 8/3/2019 Eclipse Con

    18/21

    Visualizing EMF models usingQuery2 Saurav Sarkar-EMF Model

    Query2

  • 8/3/2019 Eclipse Con

    19/21

    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 ModelQuery2

  • 8/3/2019 Eclipse Con

    20/21

    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.

    Query2 developer utilities like Index View which helps toinspect the indexed resources.

    Saurav Sarkar-EMF ModelQuery2

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=329723https://bugs.eclipse.org/bugs/show_bug.cgi?id=329723
  • 8/3/2019 Eclipse Con

    21/21

    Useful links and feedback

    Update site linkhttps://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 mailto [email protected]

    Saurav Sarkar-EMF ModelQuery2

    https://hudson.eclipse.org/hudson/job/tycho-query2-nightly/lastSuccessfulBuild/artifact/targetPlatform/https://hudson.eclipse.org/hudson/job/tycho-query2-nightly/lastSuccessfulBuild/artifact/targetPlatform/http://wiki.eclipse.org/EMF_Query2Homehttp://wiki.eclipse.org/EMF_Query2Home/EMF_Query2DevGuidehttp://wiki.eclipse.org/EMF_Query2Home/EMF_Query2DevGuidehttp://wiki.eclipse.org/EMF_Query2Homehttps://hudson.eclipse.org/hudson/job/tycho-query2-nightly/lastSuccessfulBuild/artifact/targetPlatform/https://hudson.eclipse.org/hudson/job/tycho-query2-nightly/lastSuccessfulBuild/artifact/targetPlatform/https://hudson.eclipse.org/hudson/job/tycho-query2-nightly/lastSuccessfulBuild/artifact/targetPlatform/https://hudson.eclipse.org/hudson/job/tycho-query2-nightly/lastSuccessfulBuild/artifact/targetPlatform/https://hudson.eclipse.org/hudson/job/tycho-query2-nightly/lastSuccessfulBuild/artifact/targetPlatform/