{'fraction_non_alphanumeric': 0.027228238234069137, 'fraction_numerical': 0.0066118284048313205, 'mean_word_length': 4.952587542609234, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Using Market Basket Analysis to Find Semantic Duplicates in Ontology

This paper proposes a novel approach to detecting semantic duplicates in an ontology that was integrated from many other ontologies. The proposed approach is based on using: (1) a query log that was issued against the ontology; and (2) the Apriori and FP algorithms from market basket analysis, where sales transactions are viewed as queries and items in a sales transaction are viewed as search terms in a query. To prove the viability of the proposed approach, the paper also presents the results of four experiments that were conducted on the OntoLife ontology.


Introduction
The main purpose of ontology-based data integration is to solve the semantic heterogeneity problem in data integration. Semantic heterogeneity refers to the ambiguous interpretation of similar terms, which are being used to describe the meaning of data in heterogeneous resources such as websites or databases. However, during an ontologybased data integration, the newly merged ontology can contain semantic duplicates, e.g., similar attributes. These attributes can cause incomplete query results.
As an example, consider a user who submits the following query against the Wikipedia ontology: "Which performers were born in Chicago?" In response to this query, the query-answering system will return only one result (viz. Michael Ian Black). However, if it were known that actor and comedian are subclasses of performer and that their attributes birthplace, birth place, city of birth, place of birth and origin are semantic duplicates of performer's location, the query-answering system could return 163 additional results [1]. Thus, the recall of query results can be greatly improved by finding similar attributes.
In this paper, we propose to use market basket analysis to find similar attributes. In market basket analysis, two items (or products) are considered to be similar if the purchase patterns of their customers are similar. Analogously, two attributes are considered to be similar if the querying patterns of their users are similar [2]. Continuing the example with the Wikipedia ontology: If it were known that there are many users who have asked about the actor's birth place together with the actor's name and birth date, and that there are many users who have asked about the actor's origin together with the actor's name and birth date, we could conclude that attributes birth place and origin in a class actor are similar to each other.

Market Basket Analysis
Baskets are defined as sets of products bought together by customers in sales transactions during their visits to supermarkets or online shops. Market basket analysis examines the buying behaviour of customers and it is used to identify similar products based on the purchase patterns. A typical example of similar products are Becks and Heineken beers. At the first sight, these two products may appear dissimilar as they do not have many common customers: the customers buy either Becks or Heineken, but not both. However, it was observed that together with Becks and Heineken, many of the customers buy the same products such as chips, sausages and pretzels. Based on this observation, a similarity measure is defined as two products are found to be similar, if the purchase patterns of their customers are similar.
The aim of market basket analysis is that of finding sets of items (products) that appear together in (are related to) many baskets. Let products be attributes in an ontology (search terms in queries issued against the ontology), baskets be queries and a sales transaction database be a query log. While market basket analysis aims at finding frequent itemsets, this information is often presented as a set of "if-then" rules called association rules. For example, if customers buy Heineken, then they also buy chips, sausages and pretzels.
To prove the applicability of market basket analysis to finding similar attributes in an ontology, we experimented with three algorithms: • ICD (Iterated Contextual Distance) algorithm [17]: This is an array-based algorithm, which returns the distances between attributes. • Apriori algorithm [3]: This is an array-based algorithm, which returns association rules. • FP (Frequent Pattern) Growth algorithm [15]: This is a tree-based algorithm, which returns association rules.
In our experiments, we looked for sets of attributes that appear together in many queries, by analysing many-to-many relationships between the querying patterns and the user behaviours. We assumed that users who have similar questions in mind tend to submit similar queries, which have similar querying patterns.
In our previous work [2,16], we used the ICD and Apriori algorithms to detect semantic duplicates in an ontology. In this paper, we employ the FP Growth algorithm, which is an improvement of the Apriori algorithm. The Apriori algorithm finds frequent itemsets and consequently querying patterns, by generating candidate itemsets. In contrast, the FP Growth algorithm finds querying patterns without the need for candidate generation, rather by constructing an FP tree, which maintains the associations between frequent itemsets.

OntoLife
OntoLife [4] is an ontology for semantically managing personal information. This ontology has 110 attributes called datatype properties in the OWL terminology. It was developed by Intelligent System and Knowledge Processing Research Group (ISKP) by merging 10 other ontologies: We selected OntoLife for our experiments because it is from an easy-to-understand application domain. Furthermore, the ontology has many attributes and is merged out of many other ontologies from the same application domain. Thus, it is likely to have semantic duplicates.

Assumptions
To run the Apriori and FP Growth algorithms against the OntoLife ontology, we made a number of assumptions about how data are stored and manipulated when searching for frequent itemsets (similar attributes): • In market basket analysis, a basket contains only a small set of products from all products available in the supermarket or online shop. Similarly, it is also assumed that users do not inquire about all attributes in the ontology at once in a single query. • In market basket analysis, a basket can contain any number of products. Similarly, it is also assumed that a query can contain any number of attributes (i.e., the query can be of any size). • In market basket analysis, the details on sales transactions such as the date of purchase, product price and product quantities are ignored. Similarly, the values of attributes in the ontology are ignored. • In market basket analysis, the order of products in a sales transaction is ignored.
Similarly, the order of attributes in a query is ignored. • In market basket analysis, sales transactions are mined for a long period of time (at least for 6 months). As a result, the sales transaction database is large. Similarly, it is also assumed that the log of queries issued against the ontology is large. • All queries are taken into account, regardless of whether they return results or not.

Query Log
As input, the Apriori and FP Growth algorithms took the query log. This log was the result of the past user interactions with the OntoLife ontology. Figure 1 shows an excerpt of the query log, which comprises 30 queries. These queries are written in SPARQL and contain 41 attributes, which constitute approximately 37% of the total attributes in the ontology. The shortest query has one attribute, whereas the longest query has 5 attributes. Not only can queries be distinguished by their size, but also by their frequency occurrence in the query log. A unique query appears only once in the query log. An example of a unique query is: "Who have "rain man" as their nickname?" In contrast, repeated queries are the queries, which appear more than once in the query log. They queried on the same attributes but possibly with different values or in a different order. An example of repeated queries is: "Who were injured on November 22, 2009, were 50% disabled by that injury and worked in the public sector?" and "Who were injured on January 2, 1989, worked in the government sector and were 20% disabled by that injury?".
The query log was converted into a sales transaction database, which contains 30 sales transactions (one sales transaction per query) represented as rows. Figure 2 shows an excerpt of the sales transaction database. In this database, each query is identified by TID (transaction identifier). For each row, if an attribute does not appear in the query, it will not appear in the corresponding row either.

Minimum Support Threshold and Minimum Confidence Threshold
The Apriori and FP Growth algorithms find frequent itemsets, by pruning those itemsets whose support is lower than a user-defined minimum support threshold. After that, the algorithms generate strong association rules from the frequent itemsets, by pruning those association rules whose confidence is lower than a user-defined minimum confidence threshold. We conducted four experiments with different values for the minimum support threshold and the minimum confidence threshold because these values had impact on the results of our experiments.
A support reveals the probability of occurrence of an attribute set X in queries. A frequent itemset has a support, which is greater than or equal to the minimum support threshold, where P denotes the probability. A confidence refers to a conditional probability. This is the probability that an attribute set Y occurs in queries given that an attribute set X has already occurred in the same queries. A confidence is used to generate strong association rules from the frequent itemsets that meet the minimum confidence threshold.
Like in market basket analysis, false positives and false negatives are inevitable when the thresholds are set either too low or too high, respectively. For example, when the minimum support threshold was too low, false positives tended to occur as those originally infrequent attributes were falsely found as frequent. When the minimum support threshold was too high, false negatives tended to occur where those originally frequent attributes were falsely found as infrequent. Figure 3 shows the results of our first experiment, where the minimum support threshold was 12% and the minimum confidence threshold was 55%. In this experiment, 24 strong association rules were generated by the algorithms. Two pairs of attributes were found similar:
Among the strong association rules, we looked for sets of attributes that frequently appeared together in the consequents (right-hand sides) of those rules. When we found such rules, we had candidates for similar attributes that appeared in the antecedents (left-hand sides) of those rules. For example, the consequents of Rule 17 and Rule 20 (marked in blue in Fig. 3) suggested a pair of similar attributes: resource's title and resource's name. Furthermore, the consequents of Rule 11 and Rule 14 (marked in red in Fig. 3) suggested another pair of similar attributes: specificDate and sickness_in-juryDesc. However, intuitively these attributes were not similar and thus, such a finding was a false positive. One possible reason for this false positive was the small size of the query log (which contained only 30 queries).
The size of the query log was a crucial factor that could affect the experiment results. This is because the two algorithms assume that a sales transaction database is large. It was observed that there was yet another pair of similar attributes but it was not found (false negative): publication's description and biography's description. Again, due to the small size of the query log, there were no common query patterns, which inquired both attributes.
There was no significant difference in the runtime between the algorithms, as both took about 16 ms, but in the made count. In particular, the Apriori algorithm made 70 counts on the itemsets, whereas the FP Growth made 30 counts.
In summary, using the first experiment results, the OntoLife ontology could be refined. In particular, OWL has a construct owl:equivalentProperty to specify that resource's title is a semantic duplicate of resource's name. Figure 4 shows the results of our second experiment, where the minimum support threshold was 12% and the minimum confidence threshold was 90%. In this experiment, 16 strong association rules were generated by the algorithms. One pair of attributes was found similar: specificDate and sickness injuryDesc. However, it was the same false positive discovered before.

Experiment 2
Since the minimum support threshold was still 12%, the algorithms showed the same runtime and made the same count on the itemsets as they did in the first experiment. Figure 5 shows the results of our third experiment, where the minimum support threshold was 10% and the minimum confidence threshold was 90%. In this experiment, 51 strong association rules were generated by the algorithms. Four pairs of attributes were found similar:
However, all these pairs were false positives. The first pair was caused by the small size of the query log. The second pair was caused by redundant association rules: Rule 13 and Rule 30. (An association rule is redundant if a more general rules with the same or a higher confidence exists, i.e., if it has the same consequent but one or more items were removed from the antecedent.) The third pair was also caused by redundant association rules: Rule 17 and Rule 33. The fourth pair was discovered due to the transitivity. Since disab percentage is similar to hasGovernmentalInvolvement and hasGovernmentalInvolvement is similar to sector, so is disab percentage similar to sector.
In the third experiment, the FP Growth algorithm was again faster than the Apriori algorithm. In particular, the former ran 16 ms, whereas the latter ran about 31 ms. During its run, the Apriori algorithm made 131 counts on the itemsets, whereas the FP Growth made 30 counts.

Experiment 4
In the fourth experiment, the minimum support threshold was 28% and the minimum confidence threshold was 55%. Here no strong association rules were generated by the algorithms. Therefore, we concluded that this minimum support threshold was too high it pruned all the frequent itemsets.
In the fourth experiment, the FP Growth algorithm was again faster than the Apriori algorithm. In particular, the former ran about 1 ms, whereas the latter ran about 3 ms. During its run, the Apriori algorithm made 3 counts on the itemsets, whereas the FP Growth made 30 counts.

Related Work
Different approaches to finding similar attributes in an ontology have been proposed in the literature [18]. These approaches fall into four main categories: • Term-based approach: In this approach, two attributes are considered to be similar if their names are similar. However, many false negatives and false positives can be found in the presence of synonyms and homonyms. Synonyms are different terms used to name same attributes (e.g., "bear" and "support"). Homonyms are same terms used to name different attributes. They have the same spelling but different meanings (e.g., "bear" can refer to an animal or can mean "support", depending on the contexts they are used in). • Value-based approach: In this approach, two attributes are considered to be similar if their values are similar. This approach can detect semantic duplicates in an ontology more accurately than the term-based approach. However, without information about data instances, this approach is not feasible. • Structure-based approach: In this approach, two attributes are considered to be similar if their structures are similar. Structures can be either internal or external. Examples of internal structures are data types, cardinalities, domains and transitivity of the attributes. However, internal structures are the subject of false negatives and false positives. For example, many attributes can have the same data types, but they are not necessarily similar. In case of external structures, an ontology is viewed as a graph, where vertices represent concepts and edges represent semantic relations between those concepts. This approach attempts to find similar classes and attributes, by identifying the structural isomorphism between sub-graphs of an ontology. For example, three types of relations can be identified between classes: taxonomic, mereologic and all the involved relations. In the taxonomic structure, the graph depicts the subClassOf relations. These relations indicate that the connected concepts are similar. One of the common similarity measures is to count the number of edges in the taxonomy between two classes to determine their similarity.
In the mereologic structure, the graph depicts the PartOf relations. In all the involved relations structure, classes are related via their attribute definitions. External structures are also the subject of false negatives and false positives. For example, it is difficult to distinguish the PartOf relations from the subClassOf relations. • Context-based approach: In this approach, two attributes are considered to be similar if the contexts of their usage are similar. However, it can be difficult to identify similar contexts. In this paper, we proposed to use market basket analysis to solve this problem.

Conclusion
During an ontology-based data integration, the newly merged ontology such as OntoLife can contain semantic duplicates (e.g., similar attributes). These attributes can cause incomplete query results. In this paper, we focused on finding semantic duplicates in the OntoLife ontology. The approach we proposed is as follows: (1) the Apriori or FP Growth algorithm is applied to find strong association rules derived from a query log, where each query is a set of search terms being attributes in the ontology, and (2) candidates for semantic duplicates are determined as antecedents of the strong association rules having similar consequents. In addition, we conducted a number of experiments on the query log, which was a list of queries posed by users to inquire the OntoLife ontology. The Apriori algorithm scanned the query log multiple times for generating candidate itemsets. In contrast, FP Growth algorithm scanned the query log only twice for constructing an FP tree. In all our experiments, the FP Growth algorithm made a constant of 30 counts on the itemsets. In contrast, the Apriori algorithm made a number of counts, which varied from 3 to 131 counts, depending on the minimum support threshold. The more counts the Apriori algorithm made, the longer time it ran. Despite the different runtime (the FP Growth algorithm was faster than the Apriori algorithm), it was observed that the algorithms returned the same results.
Overall, the results of our experiments showed that market basket analysis in general and the Apriori and FP Growth algorithms in particular are capable of finding similar attributes in an ontology, although user involvement is required to identify the optimal values for the minimum support threshold and the minimum confidence threshold.