graph data management lab, school of computer science gdm@fudangdm@fudan gdm.fudan.edu.cn...

32
Graph Data Management Lab, School of Computer Science GDM@FUDAN GDM@FUDAN gdm.fudan.edu.cn gdm.fudan.edu.cn XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation 34 th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012 Sheng Huang, Yiqi Lu, Yanghua Xiao and Wei Wang School of Computer Science Fudan University Shanghai, China XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation Yu Wang, IBM China Research Lab Shanghai, China

Upload: oliver-pierce

Post on 29-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Sheng Huang, Yiqi Lu, Yanghua Xiao and Wei Wang

School of Computer ScienceFudan UniversityShanghai, China

XMLSnippet: A Coding Assistant for XML

Configuration SnippetRecommendation

Yu Wang,IBM China Research Lab

Shanghai, China

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

2XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Outline Motivation Solution Evaluation Conclusion

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

3XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Framework-based programming Framework-based programming

• XML configuration file• Client code

• Example: Action class and struts-config.xml

Programmers need to accurately configure many xml files during the development of a large application based on frameworks

• Example: Struts, Spring, iBatis

Errors in XML configuration file leads to:

• Fatal consequence: runtime fault or application failure

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

4XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Prons and cons Prons:

• Simplify implementation• Make programs more structural• High productivity of development

Cons:• Complex• Lack of documentation

Consequences:• Incorrect and inefficient usage of the frameworks in the coding

phase• Defects are easily introduced into the software

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

5XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Problems

login

<form id=“LoginForm" action=“LoginFormAction" > <input name=“userName" value="<s:property value=userName'/>"> <input name=“pwd" value="<s:property value=‘pwd'/>" ></form>

Class LoginAcion implement Action { IResultMsg login(String username, String pwd){….}}

LoginAction.java

Login.jsp

<action path=“/LoginFormAction" type=“LoginAction“ method=“Login” <forward name=“success” result=“List.jsp”> </action>……

struts-config.xml

Client code:

Want to finish configuration file:

Problem: can we recommend XML configuration snippets automatically?

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

6XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Previous worksPrevious approaches

XML schema

templates

File Context

Code snippets

1. Schema based approach 2. Other code recommending approach

1 2

Code repositories

Association rule mining

Code snippets

Our approach

1 n

Open source code repositories

…Frequent Tree pattern mining

Code snippets

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

7XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Challenges Diversity of frameworks

• Struts, Spring, iBatis……

Structural complexity of XML configuration file• Tree structure

• Elements, attributes,….

Semantic mapping between xml configuration files and client codes

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

8XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Our Contribution A xml snippet recommendation solution

• Mine reusable XML patterns• XML code assistance by three queries

• Type query, Structural Query and Context query

An eclipse plug-in• XMLSnippet:

http://gdm.fudan.edu.cn/Wiki.jsp?page=XMLSnippet

Extensive evaluation of our tool

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

9XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Demo

1. Type Query(TQ)The query to get the recommendation of one specific type of framework as the initial content of an empty XML document. 2. Structural Query(SQ)The query to get the subtree recommendation according to the position of the current cursor in the XML document under editing.3. Context Query(CQ)The query to get the sample reference to help programmers to input the context sensitive attribute/element values.

<?xml version=”1.0” encoding=”ISO-8859-1”?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <struts-config>

</struts-config>

Blank file<?xml version=”1.0” encoding=”ISO-8859-1”?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <struts-config> <action-mapping> <action path=“ ” type=“ “ scope=“ “> <forward name=“ “ result=“ “/> </action>

</action-mapping></struts-config>

struts-config.xml

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

10XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Outline Motivation Solution Evaluation Conclusion

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

11XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

XMLSnippet Approach Offline mining

Online query

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

12XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

XMLSnippet Approach

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

13XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Frequent tree pattern mining Input: XML code repository

Objective:• mines XML repository to generate snippets

Apply frequent subtree mining algorithm [Chi and Xia, TKDE 05] to get frequent pattern

Use Trie to index result

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

14XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Frequent tree pattern mining

Build candidate subtree setfrom root element

Grows the subtree pattern

Keep candidates whosefrequency are larger thanthreshold

Return the result frequentsubtree patterns

Result Map

Class

Result Map

Result

Result Map

Class Result

Result Map

Class Result

Result

Column Property

Pattern-growth method

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

15XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

XMLSnippet Approach

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

16XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Source code indexing Build a Prefix tree to

index all root-to-leaf-node paths in frequent tree patterns• To fast answer SQ

and CQ according to the editing prefix

Each node in the prefix tree corresponds to a root-to-leaf-node paths in the tree pattern.

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

18XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Outline Motivation Solution Evaluation Conclusion

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

19XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

What to evaluate?

1. Generality: Could the tool be applied to different frameworks?

2. Effectiveness: Could the tool produce reusable snippets to shorten the programming cycle?

3. Usability: Is the tool useful for programmers with different skill levels?

4. Efficiency: Could the tool mine frequent tree patterns, build index and propose reusable snippets efficiently?

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

20XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Test project The test project is a simple book store

management project including the basic CRUD (Create, Retrieval, Update, and Delete) functions.

Programmers under evaluation

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

21XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

RQ1: Generality Generality. Could the tool be applied to different frameworks?

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

22XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

RQ2 & RQ3: Effectiveness and Usability 3 tasks:

• Task 1: Initialize Web.xml for the target application• Task 2: Construct the Struts_Config.xml• Task 3: Construct the iBATIS configuration xml files

Evaluation result

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

23XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

RQ4: Efficiency Could the tool mine frequent tree patterns, build index and propose reusable snippets efficiently?

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

24XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Outline Problem Example XMLSnippet approach Evaluation Conclusion

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

25XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Conclusion Propose a method to recommend reusable XML

snippets to help programmers configure XML files• Key technique:

• close frequent tree mining• prefix tree based indexing

Future work:• Value recommendation• Online version of XMLSnippet

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

THANK YOU!

Q/A

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

27XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Frequent used attribute and element

combination will be recommended together for SQ in XMLSnippet

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

28XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

29XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

In order to finish the same task as XMLSnippet do in on step, the Eclipse

XMLEditor needs several steps….

Step 1 Add Element “Action”

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

30XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Step 2 Add Child Element “forward” of Element Action

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

31XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Step 3 Add attribute “type”

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

32XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

Step 3 Add attribute “scope”

Graph Data Management Lab, School of Computer Science

GDM@FUDAGDM@FUDANN

gdm.fudan.edu.cngdm.fudan.edu.cn

XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012

33XMLSnippet: A Coding Assistant for XML Configuration Snippet Recommendation

34th Annual IEEE Computer Software and Applications Conference, Izmir, Turkey, 16-20 July, 2012