**Algorithm for extracting taxonomical constraints from ontology**

Algorithm for extracting taxonomical constraints runs as follows: given the PROO ontology, all the super concept and sub concept hierarchies are identified. Super concept node is called parent and sub concept node is called child. The rules are then obtained as of the predicate on the hierarchy as the relation between parent and child concepts leading to target class. Content constraint is initialized to the false value in the beginning. It is then changed to true value after taxonomical constraints are obtained. The Algorithm also tests for descendant child nodes in the hierarchy. A descendant node is a node which is derived from the ancestor node. An ancestor node is the parent node in the given hierarchy. All the child nodes for a given parent are known as descendant nodes. The intermediate parent node is devised as another child node to satisfy the descendant property. At this level, the content constraint value is changed to true. The rules are then obtained as of the predicate on the hierarchy as the relation between parent, newly created child and the datatype property leading to target class.

else if(object\_property(nodei

write(object\_property(nodei

write(object\_property(nodei

➔ target\_class(nodej

➔ target\_class(nodei

contentconstraint = true;

) );

**Figure 1.** Class hierarchies and related classes in PROO.

) ); **}}**

[datatype\_property(nodei

datatype\_property (nodej

, nodej ) ^

,rel(int)) v

,nodej

,nodej

**Algorithm for extracting nontaxonomical constraints from ontology**

)^datatype\_property(nodej

)^datatype\_property(nodei

Algorithm for extracting nontaxonomical constraints runs as follows: given the ontology, all the related class nodes that are bound with the object properties are identified. Content constraint is initialized to the false value in the beginning. It is then changed to true value once related class nodes are obtained. The rules are then obtained with the object property as the relation between the related classes leading to the target class. The Algorithm also tests the relation between related classes and datatype properties. The related class node and the datatype property are associated using the conditions that are imposed on the ontology. This is identified by the algorithm. The content constraint value is changed to true. The rules are then generated from the relation between object property and the datatype property leading to the target class. The PROO ontology concepts namely Opinion and Feature and the properties namely ObjectPart and ObjectPartFeature are used in generating the machine interpretable rules on target sentiment class. These articulate that they are the features to acquire positively oriented sentiment when the opinion strength on these features has a value greater than or equal to 2.5. The corresponding

class hierarchies and the related classes of the PROO ontology are presented in **Figure 1**.

The sentiments of the product features that are present near to the root of the ontology are to be improved. The features located at the higher level near the root of the ontology are considered to be more important as compared with the lower level features [16]. The product features that are present near the ontology root are the parent features obtained from the taxonomical constraints and the other features present at the same level as the parent features. Other features are obtained from the non-taxonomical constraints. In order to achieve this goal, a framework is presented in **Figure 2**.

,rel(int))

http://dx.doi.org/10.5772/intechopen.72514

189

Sentiment-Based Semantic Rule Learning for Improved Product Recommendations

,rel(int))

,rel(int))])
