# A Hybrid Ontology-Based Recommendation System in e-Commerce
## 3 The Hybrid Ontology-based Approach
### The ontology model
#### 3.2.2 Ontology model classes  
In order to develop the ontology-based recommendation system, four main classes are created. The four classes of our ontology model are Person, User, Neighbour, and Product. In order to create them, we have followed the top-down method [25], which consists of starting the development of the class hierarchy by the most general concepts of the domain and subsequent specialization of the concepts.  
Figure 2 shows the relationship between the four classes and their respective attributes.  
The classes and attributes are the following:  
* **Person:** a class that represents a person that have made reviews of products, with the following attributes:  
* ReviewerID--identifies the person who made the review;  
Figure 2: Ontology used, respectively classes and attributes.  
* Name--name of the person;
* Gender--identifies the gender of the reviewer based on the Name;
* AveragePrice--the average amount spent by the reviewer;
* ProductsIds--represents the Ids of products purchased by the reviewer.
* **User**: a subclass of person that represents the user to whom the system will recommend new products. This class has the same attributes as Person plus the following:
* MinPrice--the price of the product with the lowest value of all products purchased by the user;
* MaxPrice--the price of the product with the highest value of all products purchased by the user;
* ReviewersIds--identifies the IDs of reviewers that have purchased at least one product from the ProductsIds list.
* **Neighbour**: a subclass of person that represents a reviewer that purchased at least one product from the ProductsIds of User and purchased different products. This class has the same attributes as Person plus the following:
* OtherCategories--represents whether a Neighbour has purchased products in different categories of User;
* Features--represents the features vector that will be used to calculate the Euclidean distance and find the nearest Neighbours of User.
* **Product**: a class that represents a product purchased by a Neighbour. This class has the following attributes:
* ProductID--identifies the product;
* Price--the price of the product;
* Overall--identifies the score given by the Neighbour in the revision and can be a value between 1 and 5;
* Category--the category of the product;
* TopFiveWords--identifies the 5 most common words in all the reviews of the product, concerning all persons who purchased the product;
* Features--represents the features vector that will be used to calculate the Euclidean distance and find the nearest products to recommend to User.  
Table 1 shows the classes Person, User, Neighbour, Product and the corresponding properties and facets of the ontology.  
The next subsections explain how the recommendation system works. This includes the process of creating the classes and applying the KNN algorithm, finding the nearest Neighbours and then the nearest products according to the metrics.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Class** & **Properties** & **Facets** \\ \hline \multirow{4}{*}{Person} & ReviewerID & string \\ \cline{2-3}  & Name & string \\ \cline{2-3}  & Gender & number \\ \cline{2-3}  & AveragePrice & number \\ \cline{2-3}  & ProductsIds & list \\ \hline \hline \end{tabular}
\end{table}
Table 1: Classes, properties and facets of ontology.