An Open Source Toolkit to Parse and Analyze Online Crowdsourced Portals

With the success of crowdsourced portals, such as Wikipedia, Stack Overﬂow, Quora, and GitHub, a class of researchers is driven towards understanding the dynamics of knowledge building on these portals. Even though collaborative knowledge building portals are known to be better than expert-driven knowledge repositories, limited research has been performed to understand the knowledge building dynamics in the former. This is mainly due to two reasons; ﬁrst, unavailability of the standard data representation format, second, lack of proper tools and libraries to analyze the knowledge building dynamics. We describe Knowledge Data Analysis and Processing Platform (KDAP), a programming toolkit that is easy to use and provides high-level operations for analysis of knowledge data. We propose Knowledge Markup Language (Knol-ML), a generic representation format for the data of collaborative knowledge building portals. KDAP can process the massive data of crowdsourced portals like Wikipedia and Stack Overﬂow eﬃciently. As a part of this toolkit, a data-dump of various collaborative knowledge building portals is published in Knol-ML format. The combination of Knol-ML and the proposed open-source library will help the knowledge building community to perform benchmark analysis.Linkof [1] The tasks experiment our tool on the ease of usage , the tasks of the second experiment evaluate the usefulness of our tool for large-scale analyses. We describe and compare the analysis of both the experiments. To the best of our knowledge, there does not exist any such library for the large-scale analysis of collaborative knowledge building portals. Hence, we compare the performance of KDAP with existing libraries and APIs commonly used for extracting and parsing the dataset of these portals. All the analyses were performed on a computer with a 3.10GHz Intel Xeon E5-1607 processor and suﬃcient memory to hold the data in RAM. The analyses were performed 5 times, and the average execution time and memory consumption are shown.


Introduction
With progress in computational power, research in various domains is primarily based on the availability of data and appropriate tools for analysis. Open access to libraries and data enhances the ease and pace of research [4]. The impact of opensource tools (like Python, R, and Scilab) can be verified by the expansion in the utility of these tools by the research community [5]. For example, a simple task like matrix inversion requires multiple lines of code to be written in Python. Whereas, the usage of NumPy library reduces the complexity of this task to a single line of code. Similar examples can be found in various domains, where the usage of analysis tools reduces the complexity of tasks in terms of time and effort. It is useful to note that in recent years, the scientific community is positively influenced by a growing number of libraries, such as scikit-learn for machine learning, NumPy and SciPy for statistical computing, and matplotlib for visualization [6].
The advancement in computational power and storage facilities allows crowdsourced portals, such as Wikipedia, Stack Overflow, Quora, Reddit, and GitHub, to host their data on publicly available servers. The popularity and open access to the datasets of these crowdsourced portals have drawn the attention of researchers from various communities. Observing the collaboration and contribution of the crowd, researchers have generalized the knowledge development on these portals to the actual knowledge building process [7]. From predicting box office success of movies to building state-of-the-art software, these portals have helped the research communities in various aspects [8,9,10].
The diverse and rich content present on Wikipedia is used to study online collaboration dynamics [11,12], to examine its impact on other online collaborative portals [13], and to train state-of-the-art artificial intelligence algorithms [14]. Similarly, the massive growth of users and posts on crowdsourced QnA portals like Stack Overflow, Yahoo! Answers, and Quora, have attracted the attention of researchers to study the dynamics of knowledge building on these portals [15,16,17,18,19]. Adding to the portal-specific analyses of knowledge building on wiki-based portals and QnA portals, inter-portal analyses would stimulate an ecosystem to give a broader perspective of knowledge building dynamics. Recent literature has shown a rise in demand for understanding the relationships between these portals [20,13].
The unique functionalities of wiki-based portals and QnA portals have resulted in different representation formats of their datasets. For research involving the largescale analyses of these portals, there is an underlying problem of the unavailability of datasets in a standard format at one place. Furthermore, the existing tools for data extraction and analysis are narrowly focused on specific portals. For example, finding the contributors who are common to Wikipedia and Stack Overflow requires multiple steps of pre-processing and separate analysis of the corresponding datasets. Based on the fact that a large fraction of researchers in the scientific community are dependent on software tools [21,22], we aim to create an ecosystem by standardizing the representation of the datasets of crowdsourced portals and providing a toolkit to analyze these datasets. Although there is an abundance of portal-specific APIs (e.g. Wikipedia API [1] , Wikidata Query Service [2] , Stack Exchange API [3] , Reddit API [4] ), the bottleneck is the restriction on API calls. Another downside is the requirement to learn different APIs for performing analyses on different portals. The structural difference of the extracted data from crowdsourced portals necessitates intermittent pre-processing for analyses. We emphasize the absence of a standard representation format for the data of these portals, albeit the commonality of extensive knowledge development. While there has been substantial research using the dataset of these portals, none of the existing tools have the potential to fulfill the requirements mentioned above. Our work will act as a catalyst for knowledge building research by bridging the gap between the supply of data and demand for analysis.
This manuscript extends our earlier work [23]. The significant changes are as follows: 1) We evaluate our toolkit based on scalability and generalizability on a new [1] https://en.wikipedia.org/w/api.php [2] https://query.wikidata.org/ [3] https://api.stackexchange.com/ [4] https://www.reddit.com/dev/api/ dataset of JOCWiki; 2) We modify the Wiki-based compression method to store in the revision-history dataset in Knol-ML format; 3) We discuss the limitations of our toolkit in terms of Knol-ML representation and generalizability of; 4) We provide more details on the crowdsourced portals in the Background section.
The key contributions of this paper are as follows: 1 An XML [5] -based Knowledge Markup Language (Knol-ML), a novel approach for standardizing the representation of dataset of various collaborative knowledge building portals. 2 Knowledge Data Analysis and Processing Platform (KDAP), a standard highperformance library that is easy to use and provides high-level operations for the analysis of knowledge data. 3 Knowledge Analysis and Retrieval (KAR) dataset, a set of data of these portals in Knol-ML format. KDAP is developed for single big-memory multiple-core machines and stabilizes the disparity between maximum performance and compact in-memory data representation. KDAP aims at facilitating the knowledge building community with open access to standard dataset and efficient data analysis methods. This will increase the ease of inter-portal analyses and also reduce the overhead for researchers to handle different data formats and corresponding APIs/libraries for analyses of these portals.
The rest of the paper is organized as follows. First, we present the relevant literature, including the various representation formats and tools to analyze the dataset of knowledge building portals (section Related Work). Then we describe the Knol-ML format and the extension mechanism associated with it (section Knol-ML: Knowledge Markup Language). The details of the KDAP library is provided in the next section (section KDAP Implementation Details). Finally, we present the evaluation of KDAP and results of the case studies performed (section Evaluation).

Background
Prior to related work, we provide a high-level context about online collaborative portals and how knowledge matures on these portals. There is a class of portals where people contribute towards the development of comprehensive information on a topic, based on resources present on the Internet. Wikipedia and Wikia are instances of such portals. The second category is a set of portals, where structured discussion is the core feature, opening the ground for asking questions and answering them. Unlike Wikipedia, knowledge in these portals is built according to the point of view of the users.

Wikipedia: A Portal with Revisions
Wikipedia is built on the idea that "Anyone Can Edit", aided with functions like history and edit. The rigorous usage of these functions help an article reach a mature state, as history allows the users to trace the development and edit allows them to add their perspective to the article. Articles in Wikipedia follow non-point of view style, demanding users to support their contribution with relevant evidence in the form of references. Crowd collaboration, rich knowledge, and open data dump has [5] https://www.w3.org/TR/REC-xml/ made Wikipedia a popular hub for conducting research in various domains. The success of Wikipedia has sowed the seeds of Wiki technology owing to the prosperity of wiki-based portals (e.g. Wikia).
QnA Portal: Portal for Structured Discussion Another category of crowd-sourced portals is Question and Answer portals (e.g. Stack Overflow, Quora), where the crux is the generation of exhaustive structured discussion on a particular topic. People perform various tasks including asking questions, providing answers, discussing a topic, upvoting or downvoting a post, etc. These functionalities facilitate the crowd to generate question specific knowledge. The increasing usage of QnA portals and the availability of data has led researchers to explore knowledge building dynamics on these portals.

Related Work
In this section, we present the relevant literature regarding standard data representation formats in various domains as well as open-source tools to analyze the data.

Data Representation and Analysis
The problem of standard data representation and tools to analyze data existed in other related domains. In particular, the dynamic nature of graph structures claims for a standard representation format for visualization and analyses. This claim has been addressed with the formulation of formats, such as Pajek, Graph Modeling Language (GML), Graph Markup Language (GraphML), and Graph Exchange XML Format (GEXF) [24]. Further, these formats have triggered the development of open-source tools like NetworkX, iGraph, SNAP, and Gephi for analysis and visualization of graphs [25,26]. The availability of such standard formats and analysis tools promotes open science and helps in the advancement of scientific research [27].

Tools and Parsers for Crowdsourced Portals
Though portal-specific tools are developed to present the analyses of questions asked for particular crowdsourced portals, standard tools, regardless of the portal, are unavailable.

Wikipedia-based APIs
Various tools and libraries have been developed to analyze Wikipedia data. Most of these tools extract the data in real-time to answer questions. A common example of such a tool is the web-based Wikipedia API. It has been frequently used to retrieve language links [28], finding articles related to a word [29], getting details about edits in articles [30], etc. However, the downside of using a web-based API is that a particular revision has to be requested from the service, transferred over the Internet, and then stored locally in an appropriate format. Setting up a local Wikipedia mirror helps circumvent the drawback, but the constraint that Wikipedia API provides full-text revisions leads to a large amount of data being transferred. A similar tool is the Wikipedia Query Service [6] , which helps user query against the wikidata [7] dataset. Currently, in the beta mode of its development, it contains a list of complex queries (e.g. Metro stations in Paris, places that are below 10 meters above sea level), which can be asked on the live dataset. Though the tool is sophisticated, there is a stipulated deadline of 60 seconds, beyond which queries cannot be asked. Such tools are useful for sampling data from the entire set or asking specific queries, but the flexibility with data and algorithms is limited.

Wikipedia data parsers
Apart from web-based services, tools to extract and parse the Wikipedia data dump are available. Ferschke et al. [31] developed the Wikipedia Revision Toolkit, which represents Wikipedia revisions in compressed form by just storing the edits, hence decreasing the size of the dump by 98%. Efficient retrieval methods were implemented to retrieve the data of a particular revision from the compressed data dump. Wikibrain, developed by Sen et al. [32], is another example of Wikipedia data dump parser, which surmounts the unavailability of standard Wikipedia-based algorithms. It provides state-of-the-art algorithms ranging from extracting pageviews to finding semantic relatedness, but the number of algorithms is limited. The usage of various parsers for wiki markup-based [8] data dumps (e.g. MediaWiki Utilities [33], mwxml [34]) are restricted to basic data.

QnA-based tools
Few QnA-based portals provide APIs for users to query the database. For instance, Stack Exchange API [9] developed by Stack Exchange network is employed to obtain various analyses results. Similarly, API provided by Reddit (Reddit API [10] ) can be used to acquire information like user details, subedits, etc. Like Wikipedia APIs, these APIs also have a limit on the number of calls restricting large-scale analyses.

Knol-ML: Knowledge Markup Language
Analysis of crowdsourced knowledge building portals entails data storage to facilitate easy retrieval and exchange. Such portals vary in their functionalities, resulting in a distinct schema for storing data in the database. Due to the structural difference of the schemata, data dump provided by these portals have different representation formats. The steps involved in the process of analyzing the data are; data retrieval, pre-processing, and analysis. The absence of standard libraries and tools to analyze the data of crowdsourced portals follows as yet another downside, restricting the knowledge building community to analyze and study the dynamics of these portals.
Motivated by the goal of having a standard library and access to benchmark datasets for crowdsourced portals, we propose Knowledge Markup Language (Knol-ML), an XML based data representation format for these portals. We specify the following: 1. Core elements to represent the knowledge data structures.
2. An extension mechanism that allows to independently add portal-specific knowledge data with the base as core elements. [7] https://www.wikidata.org/wiki/Wikidata:Main Page [8] https://en.wikipedia.org/wiki/Help:Wikitext [9] https://api.stackexchange.com/docs [10] https://www.reddit.com/dev/api/  The extension mechanism provides a feature of adding extra information that can be combined or ignored without affecting the overall structure. Thus, a portal specific format can be created, respecting the core structure of Knol-ML. The heterogeneity in the representation formats of the data of different portals has created a dire need for the feature mentioned above. There are various data serialization formats like JSON, YAML, SOAP, and XML, of which XML [35] tops the list for developing standard data representation format for crowdsourced portals. The reason being its usage in diverse areas and the availability of widely supported tools for parsing and handling XML-formatted data.

Core Layer
Sequential knowledge development is the fundamental feature of crowdsourced knowledge building portals, where the crowd develops knowledge sequentially by adding, deleting, and editing information [36]. Over and top of this fundamental feature, some portals have customized features like upvoting and downvoting others' contributions, accepting answers, and adding comments. In this section, we describe the representation of the data of crowdsourced portals in Knol-ML format. The core layer constitutes the foundation of the format, describing the underlying elements to represent sequential knowledge development. It can also include additional information (e.g., user's biography), which can be easily identified and optionally ignored, leaving the structural information of the core layer undisturbed. This extension is by virtue of extensibility provided by the XML framework. Section Extension Mechanism defines additional information in this context, and its inclusion.
We define instance as a piece of information which is added by a contributor at a particular timestamp. The idea is to break the knowledge data into a series of instances, making it the fundamental unit of our format. This fragmentation allows us to represent the dataset of any knowledge building portal as a set of instances, each having a set of attributes like contributor, timestamp, and text. The idea is motivated by the GraphML format, where a set of vertices and edges defines a graph, with each having its own set of parameters.
<KnowledgeData Type="text" Id="1"> <Title>This is an example for sequential knowledge data</Title> <Instance Id="1" InstanceType="Revision"> <TimeStamp><CreationDate>t1</CreationDate></TimeStamp> <Contributors> <OwnerUserName>Editor 1</OwnerUserName> <OwnerUserId>1</OwnerUserId> </Contributors> <Body><Text Type="text">Edits of Editor 1</Text></Body> </Instance> <Instance Id="2" InstanceType="Revision"> <TimeStamp><CreationDate>t2</CreationDate></TimeStamp> <Contributors> <OwnerUserName>Editor 2</OwnerUserName> <OwnerUserId>2</OwnerUserId> </Contributors> <Body><Text Type="text">Edits of Editor 2</Text></Body> </Instance> </KnowledgeData> We define our format based on the activities performed on the collaborative knowledge building portals. As explained earlier, users exhibit various activities in the knowledge development process, as illustrated in Figure 1. Each document is considered as separate Knowledge Data, which may contain multiple instances of edits performed by various contributors. The structure depicted in Figure 1 constitutes the fundamental structure of our format. The XML schema of the Knol-ML format has been provided in the Resources section. Figure 2 depicts the Knol-ML format for sequential knowledge data. A Knol-ML document may contain multiple <KnowledgeData>, each representing different document. The topic of a document is described using the <Title> tag. The information regarding a particular edit performed by a contributor is described within the <Instance> tag. It contains three mandatory tags explained below: • A <TimeStamp> tag contains a sub-tag <CreationDate>, which stores the commit date and time of this edit. • <Contributors> tag stores the details regarding editor of this instance. It has two further sub-tags, <OwnerUserName>, which stores the name of the editor and <OwnerUserId>, which stores the unique Id assigned to the editor. The former is optional, but the latter is mandatory. • The <Body> tag contains a sub-tag <Text>, which stores the actual edits of this instance. The sub-tags of <Contributors> and <Body> tags ensure that additional information can be included within them appropriately.

Extension Mechanism
The core layer defined previously describes the generalized structure of sequential knowledge in Knol-ML format. We use the extension mechanism, a feature of XML, to represent the additional portal specific information (e.g., badges' details, users' bio, pageviews, and editors' location). Brandes et al. [38] have used a similar approach in GraphML for representing additional information in graphs. They have defined the location of the additional data with the help of <key> and <data> tags. New data can be accommodated within the <data> tag, which requires a <key> providing a name and domain (type and range of values it can take) of this new data. The domain is defined using for attribute of the <key> tag.
Analogously, we have defined <Knowl> and <Def> tag to represent the additional information, as shown in Figure 3. The <Def> tag can be defined by including attributes name, domain, and location of this new information. The name, domain, and location are defined using attr.name, attr.type and for attribute respectively. Each element in the Knol-ML core layer can contain multiple <Knowl> tags, representing the additional information for that element. Using this extension mechanism, any additional information can be described in the Knol-ML format. Also, a parser need not support the extensions to extract information from the core structure. All the <Def> tags can be safely ignored as they appear before the <KnowledgeData> tag, which is the root of every sequential knowledge data. <KnowledgeData Type="text" Id="1"> <Title> Question Title </Title> <Instance Id="1" InstanceType="Question"> <TimeStamp> <CreationDate> t1 </CreationDate> </TimeStamp> <Contributors> <OwnerUserId> Editor 1 </OwnerUserId> </Contributors> <Body><Text Type="text"> Question </Text></Body> <Credit><Score> score value </Score></Credit> </Instance> </KnowledgeData>

KDAP Implementation Details
KDAP is a system designed for analyzing knowledge data represented in Knol-ML format. KDAP design allows the methods of analysis to work on any category of knowledge data. The foundational classes of KDAP are centered around Knol-ML format. These classes are categorized into wiki-based containers and QnA-based containers. Wiki-based containers, WRKnol and WRCKnol, represent the revision based wiki data. WRKnol corresponds to the full revision and WRCKnol corresponds to the compressed form. In the case of QnA-based portals, the data may or may not be available in the form of revisions. Hence, QKnol corresponds to the knowledge data, which is not in the form of revisions. QRKnol corresponds to knowledge data with revisions.
The idea is to optimize the execution time and memory usage of these methods by choosing the appropriate container class. The containers provide different methods for knowledge data, including revision and non-revision based. The standardized structure of Knol-ML simplifies the implementation of a new algorithm, as each algorithm has to be implemented once, which can be executed on any knowledge data. This implementation helps in comparing different genres of crowdsourced portals under the umbrella of knowledge building.
Methods implemented on wiki and QnA-based containers can be divided into three categories; knowledge generation methods, for the generation of new knowledge data (which is stored in Knol-ML format); knowledge conversion methods, for the conversion of data into Knol-ML format and knowledge analytic methods, for the computation of specific knowledge building-related analysis without manipulating the underlying structure. As future work, we will also include manipulation methods that can be used to modify knowledge data.
Containers Functionality KDAP provides a standard interface for both the containers, bypassing the step of pre-processing the data of multiple knowledge building portals individually. Every method in KDAP is built on the top of KDAP iterators that provides a containerindependent traversal of the instances of knowledge data. The KDAP converters can be used to club all the <KnowledgeData> into a single file, or multiple files can  be created, each having the same number of <KnowledgeData>. The design of creating multiple files allows parallel processing without compromising the dependency. Thus, enabling a massive data dump to be broken down into multiple chunks which can be loaded efficiently, optimizing the memory usage. Also, the excessive increase in the number of files can be avoided by including multiple <KnowledgeData> in a single Knol-ML file.
Knowledge Data Representation KDAP has been designed based on the Knol-ML structure. Hence, it is essential to have a data structure such that accessing and analyzing methods are computationally efficient. For example, accessing a particular instance of a Wikipedia article or Stack Overflow thread should be reasonably fast and not expensive in terms of memory consumption. Handling these features is imperative, as the data of these portals will increase many folds with time. The trade-off between time and space calls for a representation that optimizes both of these. Furthermore, in collaborative knowledge building portals order of knowledge arrival should be preserved. In general, ordering is achieved by using vector-based representation, while speed is achieved by using hash table-based representation.
For KDAP, we have chosen a middle ground between all-hash-table and all-vectorknowledge representations. A hash table has been used to represent the instances of knowledge data. The idea behind using the hash table is to reduce the time complexity for retrieving an instance, which plays a crucial role in processing the knowledge data. Each instance consists of a unique identifier, a single hash table storing the attributes of the instance, and a vector representing the elements of the instance. Elements of the vector may further contain a hash table and a vector representing its attributes and elements, respectively. This cross between the hash table and the vector is designed to store the hierarchical data structure of Knol-ML in the memory. Figure 4 summarizes knowledge representations in KDAP. [11] The time complexity of O(1) is achieved by hashing the instances. Although hashing has worst case time complexity of O(n), on an average O(1) complexity is achieved.

Operations
Time Complexity [11] Wiki-Based QnA-Based Get an instance

Time Complexity of Key Operations
For the analysis of knowledge data, atomic operations must be efficient and less time-consuming. KDAP allows the algorithms to work on small chunks of data at a time, reducing the overall memory consumption and time complexity. This is achieved by the help of the Knol-ML structure, which allows the KDAP parser to process one instance at a time. Furthermore, it gives an additional advantage of processing the knowledge data parallelly, providing an extra benefit of time complexity reduction. Since most of the operations are dependent on the retrieval of information from Knol-ML data like contributors' information, and time details, we have focused on optimizing the time and space complexity of such operations.
To process the Knol-ML files efficiently, its optimal representation in RAM is a pre-requesite. Wikipedia, being a revision based system, store all the edits performed by the editors, resulting in the accumulation of a lot of redundant information. Owing to this, the size of each article reaches megabytes or even gigabytes. To reduce the overall space complexity of processing revision based Knol-ML files while optimizing the time complexity, we compress the revision-based Knol-ML by efficiently storing the differences between consecutive revisions. A naive algorithm will require to store the the edits made in the current revision exclusively, but the revision access time will increase as each revision will now require reconstructing the text from a list of changes. Thus, to accelerate the reconstruction process, every k th revision is stored as a full revision, where k << n (n is the total number of revisions). A similar method is proposed by [31], where the value of each interval (k) is fixed to 1000 irrespective of the article size. We modify Ferschke's algorithm by keeping the interval length k as a function of n for each article. Our experiment on a sample of Wikipedia full revision history dataset revealed the optimal value of k as √ n, optimising both time and space complexity. The details of the experiment is provided in the Appendix (Wikipedia Revision History Compression). However, in KDAP, the user has an option of tuning the value of k. Table 1 shows the time complexity of key operations on knowledge data in KDAP. Here, k is the number of instances that are stored between two successive full revisions, and n is the total number of instances present in the knowledge data. As described before, the size of k << n, which means that the time complexity of an instance retrieval in case of wiki-based data is very less. This is because the size of the compressed wiki-based data is considerably small as compared to the actual XML dump, which allows KDAP methods to store it in RAM. Similarly, the size of a thread in a QnA portal is very less as compared to the total number of posts in the portal, providing an extra benefit of storing multiple threads parallelly in memory. [11] Using the difference of the current revision with the previous one using the diff algorithm [39]  Finding the number of words, sentences and Wikilinks added/deleted in each revision of an article (United States). Task 4 Extracting all the questions which had an accepted answer from anime.stackexchange.
Analysis Methods

Task 5
Find the correlation between monthly pageviews and the number of revisions of an article (United States).

Task 6
Find the correlation between Gini coefficient (a measure of inequality of contribution) and answer to question ratio for various stack stackexchange portals.
As we show in the evaluation (section ), KDAP can provide high performance in terms of memory and time complexity while allowing for efficient execution of algorithms. Figure 5 is an overview of the KDAP framework, which summarizes the entire process of Knol-ML conversion and analysis.

Evaluation
In KDAP, we have implemented commonly used traditional algorithms as well as new methods for analyzing and understanding the dynamics of collaborative knowledge building. All these methods accept Knol-ML files as data input and return the analysis results. The main disadvantage with collaborative online portals is that the data dump is in raw format and requires multiple steps of cleaning for analysis purposes. With the design of Knol-ML and KDAP, we have created a system that reduces the time and effort required to retrieve and analyze knowledge data. We provide many atomic level methods which can be used as building blocks for analysis such as, language statistics as a measure of quality of contribution [40,41,42,43], global inequality as a measure of participation [44,45], editing patterns to understand collaboration [46,47,48], data extraction for various machine learning and NLP algorithms [49,14,50].
To evaluate our tool, we describe two experiments involving the common mining tasks as well as large-scale analyses. The tasks listed in both the experiments were performed twice, including and excluding KDAP. The authors in [51] have used a similar approach to evaluate the PyDriller tool with other existing tools. The tasks in the first experiment were designed to measure our tool based on the ease of usage, whereas the tasks of the second experiment evaluate the usefulness of our tool for large-scale analyses. We describe and compare the analysis of both the experiments. To the best of our knowledge, there does not exist any such library for the large-scale analysis of collaborative knowledge building portals. Hence, we compare the performance of KDAP with existing libraries and APIs commonly used for extracting and parsing the dataset of these portals. All the analyses were performed on a computer with a 3.10GHz Intel Xeon E5-1607 processor and sufficient memory to hold the data in RAM. The analyses were performed 5 times, and the average execution time and memory consumption are shown.

Evaluation Based on Ease of Usage
To evaluate our tool based on the ease of usage, we compare KDAP against existing libraries and APIs for online collaborative portals. We select six commonly known knowledge building tasks that we encountered in our experience as researchers in the knowledge building field. We divided the tasks into three groups, as shown in Table 2. The reason behind this segregation is to evaluate our tool based on a variety of tasks commonly performed by the knowledge building researchers. We compare the analyses using different metrics: lines of code (LOC), complexity (McCabe complexity [52]), memory consumption, and execution time of both implementations. Table 3 shows the results. For all the tasks, the number of lines that are not a core functionality (for example, the constructor) is three. We keep this number as it is always the same for all the tasks for all the libraries/tools.
Regarding execution time, KDAP is 63.32 and 8.33 times faster than the respective tool for tasks 1 and 2, respectively. This speed is achieved because KDAP maintains a database of Wikipedia articles name and corresponding categories (please see Appendix for more details). For other tasks, the performance of KDAP is similar to that of other tools. In terms of memory consumption, the tools behave similarly. In most of the cases, memory consumption was less than 20MB. In the most memory consuming task (task 4), 86MB of memory was used.
The more significant difference is in terms of the complexity of the implementation and LOC. For the former, we observe that using KDAP results (on average) in writing 61% less complex code as compared to respective libraries. This is specially the case in tasks that have to deal with mining Wikipedia and Stack Exchange (Task1 and 2); indeed, obtaining this information in KDAP is just a one line code, while Wikipedia API and Stack Exchange API require many lines of code and exceptions handling.
We also observe that the lines of code written using KDAP is significantly lower than for the respective library. Table 3 shows that, on an average, 84% fewer lines of code are required using KDAP. The biggest difference is in task 3, where the tool had to calculate the change in words, sentences and Wikilinks for each revision of  an article. This problem was solved in five LOC using KDAP, while 120 LOC with cElementTree (95% difference). The details of the experiment are provided in the supplimentry meterial [3] (Appendix 2), and codes for all the implementations are available in the experiment section of the GitHub repository.

Evaluation Based on Usefulness
To further analyze our tool, we choose four peer-reviewed articles in the CSCW domain to be analyzed using KDAP. We took the help of four undergraduate students working in the knowledge building domain to re-perform the analysis mentioned in these articles. Each participant was assigned one paper, as shown in Table 4.
They were asked to perform the analyses twice (including and excluding KDAP) and note the time they took to solve the problems, as well as their personal opinions on all the tools. All the students had an experience in developing with Python and on performing knowledge building studies, but they had never used KDAP before. The setting of the experiment is the following: • Each participant is assigned one paper, which he/she has to implement first with KDAP, then with any other library of their choice. Since understanding how to solve the tasks requires some additional time, we asked the participants to start with KDAP. This choice clearly penalizes our tool, as participants will have a better intuition about the tasks during the first round of implementation. However, we believe that KDAP is simpler to use and that the difference between the two implementations will still be significant. • For the sake of simplicity, participants should only implement the core analysis methods. Methods like machine learning model training and graph plotting were excluded. • Participants note the time taken to implement the tasks. They are also asked to include the time spent in reading the documentation of the tools, since understanding how to use the tool is part of the experiment. • After having implemented all the tasks, we ask the participants to elaborate on the advantages and disadvantages of the tools. The result of the experiment is shown in Table 5. All the participants took less time to solve the problems (26% less in the worst case, 71% less in the best case). Regarding the LOC, three out of four participants wrote significantly less LOC. P4, instead solved both problems using a similar amount of time and LOC: the participant first solved the problem using KDAP and applied the same logic to solve the problem using cElementTree.
All the participants agreed that KDAP was more comfortable to use than other analysis tools (P1 to P4). For example, P1 affirmed that using KDAP, he was able to achieve the same result with more straightforward and shorter code, and that he will continue to use KDAP in his subsequent knowledge building studies. P2 added that Wikipedia and Stack Exchange APIs are useful when one has to perform limited extraction tasks, but it can be overcomplicated when the goal is to perform broad-scale analysis on these portals, for which KDAP is more appropriate because it hides this complexity from the users.

Evaluation Based on Scalability and Generalizability: A Case Study of JOCWiki
Although we have established our toolkit's usefulness, it is essential to show if our toolkit is scalable enough to analyze a new portal's dataset. Moreover, it is interesting to evaluate the generalizability of the analysis methods using cross-portal analysis.
To understand the extent of scalability and generalizability of our toolkit, we describe the analysis of JOCWiki with KDAP as a case study. JOCWiki is an online crowdsourced portal that follows a unique integration of a Wiki-like portal and a discussion-styled forum [57]. JOCWiki was deployed as a part of a MOOC named "The Joy of Computing" to create a rich knowledge repository using the course students as the contributors. The authors showed that this integration of Wiki and QnA forum (also known as QWiki) generates more knowledge as opposed to a single disintegrated platform. The integration of Wiki and discussion-forum like features in a single platform allows us to evaluate our toolkit based on scalability and generalizability. We show that our toolkit can handle the dataset of JOCWiki, and the fundamental analysis can be performed in lesser lines of code. We also show the generalizability of our toolkit by performing same tasks on Wiki and QnA forum of JOCWiki.
We extracted the full dataset of JOCWiki, publically available at GitHub [58]. The dataset contained twelve weeks of Wiki articles (one for each course module) and their respective discussion forum in a raw XML and text format, respectively. We first converted the dataset of Wiki articles and their respective discussion forum into Knol-ML format. Although the conversion step is an overhead in terms of time and computation, it is essential since it enables a user to execute all the KDAP library methods on the converted Knol-ML dataset. We extended the KDAP library by adding the JOCWiki conversion methods to it. We perform a set of fundamental analysis on the JOCWiki Knol-ML dataset using KDAP and without KDAP [12] . We divide the tasks into two categories. The first category of tasks requires similar analysis on both the portals (Wiki articles and their respective QnA forums), and hence we perform them on both the portals (Wikis and QnAs) separately. The second category contains a set of tasks that require cross-portal analysis between the Wiki articles and the QnA forums. We aim to determine if we can perform the mentioned analysis with less complex codes while using KDAP. We compare the results based on LOC (Lines of Code) and Complexity (McCabe complexity [52]). Table 6 represents the result of the experiment.

Results on Scalibility
We observed that using KDAP, we could perform the analysis in lesser lines of code compared to using the conventional libraries. More precisely, we could perform all the mentioned tasks using average 95% lesser lines of code with KDAP compared to using conventional libraries. Moreover, with our toolkit, we could write less complex codes. We observed that the fundamental methods of the KDAP library are useful in performing cross-portal analysis using less complex and fewer lines of code. For instance, extracting topics from Wiki articles that triggered discussion in QnA forums and vice versa is comparatively more straightforward with KDAP. This quantification of triggers was a significant contribution by Simran et. al. [57] using which they showed that the QWiki setup generates more knowledge units than conventional collaborative knowledge building systems. The reason behind writing more complex codes while using the conventional libraries was the unstrctured formatting of QnA forum dataset. Retireving information from an unstructured dataset is generally difficult and time consuming. Given the standardized structure of the Knol-ML format, such information retrieval and analysis tasks are easy to perform with KDAP. [12] We used conventional libraries as mentioned in subsection Results on Generalizability In terms of generalizability, we observed that most of the KDAP methods were generalizable over both the portals while performing intra-portal analysis tasks. More specifically, for most of the tasks, common KDAP methods were used to analyze both Wiki articles and QnA forums. We had to use a different set of methods for some tasks as no common methods were applicable (red colored rows in Table 6 represent those tasks). For example, to extract the author's information (such as age, country, and bio) from both Wiki articles and QnA forums, we had to use the external file of author's dataset. One solution for this problem is to include all author's detailed information in the Knol-ML dataset. However, including such information will increase the size of a single Knol-ML KnowledgeData (refer to Figure 2 for details) by many folds. We discuss this tradeoff in detail in the Limitations and Future Work section. Methods KDAP WikiBrain JWPL [13] DBpedia [14] Wikipedia API SE API Extraction Methods

Limitations and Future Work
Although we have focused on creating a standard representation format and analysis toolkit, there are a few limitations in this approach. First, converting an unstructured dataset into the Knol-ML format may increase the final Knol-ML dataset size. This increase in the size is mainly due to the extra tags required to represent the dataset in Knol-ML format. For instance, converting the JOCWiki QnA dataset into the Knol-ML format increases the QnA dataset's size by 17%. However, Knol-ML representation allows the KDAP methods to extract the data efficiently. Secondly, while most of the fundamental methods are generalizable over different datasets, having portal specific methods is inevitable. This specificity of methods sometimes requires the writing of more complex codes to perform portal specific tasks. Moreover, the generalizability of KDAP methods comes from the Knol-ML representation format, which sometimes leads to the accumulation of extra information (for example, adding new tags to identify the information uniquely), eventually increasing the overall size of the dataset. Finally, to use the KDAP methods on a new portal's dataset, the data must first be converted into Knol-ML format, an overhead in time and computation. However, the conversion task is a one time process as we are maintaining a public repository (KAR dataset) containing all the dataset in Knol-ML format. Users can directly download a portal's dataset in Knol-ML format from the KAR repository.
As future work, we aim to develop more functions for the KDAP library. The library is kept open for the researchers/developers to use and extend. Also, based on the generalized structure, visualization methods can be implemented to visualize the knowledge data. Moreover, some of the KDAP methods can be implemented in the C/C++ programming language, optimizing the overall running time and memory usage. We encourage readers to install KDAP and explore its functionalities; most importantly, we encourage researchers and developers to improve KDAP and KAR dataset by joining our team on GitHub.

Conclusion
We have developed Knol-ML, an XML-based standard representation format for the data of crowdsourced knowledge building portals. We also provide KDAP, a standard high-performance system, to analyze the data of these portals. With Knol-ML and KDAP methods, complex analysis can be performed using a few lines of code. Apart from Knol-ML and KDAP, we release the KAR dataset, which contains the data of crowdsourced knowledge building portals in Knol-ML format. KDAP provides basic as well as advance retrieval and analysis methods that have been proven useful in studying collaborative knowledge building portals. We believe that the combination of Knol-ML, KDAP, and KAR Dataset as a toolkit will accelerate the research in knowledge building community.

Wikipedia Revision History Compression
We extend the fixed-interval length (k = 1000) method provided by Ferschke et al. [31] and develop an online algorithm that calculates the interval length (k) based on the input file, optimizing both the time and space complexity. We experiment on a sample of Wikipedia articles to find the optimal value of k. We experiment on different values of the interval lengths ranging from k = 2 to k = n−1, including the interval length proposed by Ferschke et al. [31]. The reason behind choosing these interval lengths is to experimentally find the the optimal compression, minimizing both extraction time and space complexity. We perform the comparison based on revision's random access time and compressed to original document ratio. Since a single revision's random access time is minimal, we calculate the access time of 100 random revisions and take the aggregate. For each article in the dataset, we calculate all the two parameters and present the mean and standard deviation.

Dataset
The data collection was conducted by using retrieval methods of KDAP (Knowledge Data Analysis and Processing Platform) toolkit. A stratified sampling was conducted on four Wikipedia quality classes: Featured Articles (FA), Good Articles (GA), Class B articles, and Class C articles. We excluded Stub and Start class articles from our sampling as these articles comparatively have fewer revisionsmeaning there is no potential requirement for compression. A-class contains a few set of articles which we merged with GA-class while performing the sampling. Since the majority of the Wikipedia articles with a number of revisions greater than 1000 fall in one of the mentioned categories, these four classes were chosen to cover the articles with more considerable lengths. Similar sampling approaches have been taken to cover articles from various topics [59,54]. For each article in the data set, its complete editing history in Knol-ML format was collected between the article's creation time to November 2019. The initial sampling resulted in 2000 articles. Among them, 118 articles had very few revisions (less than 100). These were excluded from the sampling, leaving the final data set of 1882 articles.
Each Knol-ML document contains an article's full edit history with additional information such as contributor's id, comments, and time stamp. Each instance (revision) in a Knol-ML document has an id tag, which always starts from one for the first instance. We leverage this information to perform random access on the compressed dataset. Table 9 presents the number of articles sampled from each class.   Table 10 shows the aggregate random retrieval time and compression ratio for different k values. The algorithm using k = √ n outperforms the fixed k method (Ferschke et al. [31]) by a large margin. We achieve an optimal random revision extraction time without compromising much on the compression ratio for all k values. More precisely, we achieve an average random retrieval time of 0.080 seconds, which is 16 times faster than the fixed k method (k = 1000). Moreover, we achieve the average compression ratio of 0.174, a ratio only 1.64 times more than the ratio observed using the fixed k method. We achieve a comparatively low standard deviation in terms of random revisions extraction time, indicating our method's stable performance over all the articles. However, in terms of compression ratio, we achieve a larger standard deviation. A large standard deviation is mainly because for smaller articles (revisions less than 500), our method estimates a comparatively smaller interval length, increasing the compression ratio.

Getting Started With KDAP
In this section we provide a brief demonstration about how to use KDAP.

Installation
KDAP is deployed on pip and can be installed using the command pip install kdap. The library is present on github and can be installed from there. The github repository will be updated after the acceptance. Please refer to the supplementary material [3] (section 2) for more information.

Downloading Dataset
Using kdap is very simple. You only need to create the knol object which can be further used to call the kdap methods. For example, the following lines of code will download and store the full revision history of Wikipedia article Gravity in the desired directory.

Frame-Wise Analysis
After downloading the relevant Knol-ML dataset, various analysis methods can be used. To perform more granular level analysis, one can retrieve the instances of a Knol-ML file as frames and use the frame-based analysis methods. For instance, the following lines of code extract the Wikipedia article's revision as frames and find information such as, contributor, time-stamp, score, etc.: 1 import kdap 2 knol = kdap . knol () 3 4 knol . g e t _ w i k i _ a r t i c l e ( ' Gravity ') 5 frame = knol . frame ( file_name = ' Gravity . knolml ') 6 7 for each in frame : 8 print ( each . get_editor () ) # prints each revision 's editor 's name and unique id 9 print ( each . get_timestamp () ) # prints the timestamp of each revision 's creation date 10 print ( each . get_score () ) # prints the score ( upvotes , downvotes ) associated with each revision , if present 11 each . get_text ( clean = True ) # returns the clean text of each instance Complex Analysis KDAP provides high-level complex methods to perform detailed analysis on the knowledge building dataset. For example, a comparison of knowledge building portals based on Global Gini coefficient which require multiple steps of processing can be easily performed using KDAP by writing the following lines of code: 1 import kdap 2 knol = kdap . knol () 3 stack_list = [ ' english ' , ' superuser ' , ' askubuntu ' , ' gaming ' , ' diy ' , ' tex '] 4 gini_list = [] 5 atoq_ratio = [] 6 for stackportal in stack_list : 7 knol . d o w n l o a d _ d a t a s e t ( sitename = ' stackexchange ' , portal = stackportal ) 8 gini_list . append ( knol . g e t _ g l o b a l _ g i n i _ c o e f f i c i e n t ( dir_path = ' d i r e c t o r y _ p a t h _ o f _ d a t a ') ) 9 questions = knol . g e t _ n u m _ i n s t a n c e s ( dir_path = stackportal + '/ Posts ' , instance_type = ' question ') 10 answers = knol . g e t _ n u m _ i n s t a n c e s ( dir_path = stackportal + '/ Posts ' , instance_type = ' answer ')