Reusable Components in Knowledge-based Configuration Design Systems

Abstract This paper takes a look on how components for knowledge-based intelligent systems can be created for reuse. For this purpose, we use production rules as inspiration for a system that uses an ontology description for the method and the domain ontology for the knowledge about the domain the problem takes place in. In this paper we give a description of an approach that hopefully can give insight into such a system. The approach is based on previous work and other scientific publications concerning this field of study. The created ontology models are in no way guaranteed to be useful outside of this example and the approach itself might still need to be improved in the future.


I. INTRODUCTION
One if not the most expensive task of implementing an information technology solution to a problem is the development of a software solution [5].In order to cut the expenses associated with software development, the reuse of existing solutions would be preferred.
One possibility for reuse of existing solutions would be the reuse of problem solving methods in knowledge-based systems [6].This is often difficult since any problem-solving methods and problem solutions would be closely connected with the problem domain.An approach would have to be introduced that would disconnect domain knowledge and problemsolving methods.
This paper strives to provide a possible approach to this problem.By using production rules from an existing knowledge system, we try to create an ontology that describes these rules not only in a way that provides descriptions of all concepts within the rules, but also is reusable.By reusable we mean a description that is as independent as possible from the domain knowledge.

II. ANALYSIS OF THE PRODUCTION RULE EXAMPLE AND PREPARATION FOR CONVERSION
In order to find an approach we will construct several ontology models from an example of production rules.
The example used in this paper is a modification of the rules from the bagger problem.It was originally introduced by Patrick Winston of MIT [1].All the rules are given in Table I. step is bag-small-items there is a small item to be bagged there is a bag that is not yet full bag does not contain bottles put the small item in the bag B12 step is bag-small-items there is a small item to be bagged there is a bag that is not yet full put the small item in the bag B13 step is bag-small-items there is a small item to be bagged start fresh bag B14 step is bag-small-items stop From this description we can extract an ontology that describes the item domain.This ontology holds all the concepts and individuals that describe the items from the shopping list.The rules are similar to rules used in such systems as XCON [3].
But let us first take a look at the rules and their meaning.Rule B1.Since rules and every test within the rules are performed in order, the very first test is for the current active step.In case this test fails, the reasoner can immediately jump to the next rule and safe time this way.
Next, the rule wants to know if there is a "bag of potato chips" in the user's order.There are several ways of looking at some information given in these rules.There are at least 2 ways of implementing such a request.The first way is a direct check for the item "chips" not for its class or other property of the individual.The second way is to define "chips" as a subor super-concept of an item.For example, we could implement a concept "bag of potato chips" as a sub-concept of "mediumsized item".This way the rule would check for the existence of any potato chip product from several possible ones while at the same time working with a medium-sized item when needed.However, this would either indicate that all bags of potato chips are only ever medium sized or every item concept would need to be connected to a sub-concept of "bag of chips".The structure of the domain ontology and the connected requirements of the method ontology need to be defined in a matter that allows such tests.For the purposes of this paper we will define the test for a "bag of potato chips" as a direct search for a specific individual in order to explore the required specifications in the method ontology for such a search.
The final part of the IF statement of the first rule is the check for a soft drink bottle in the order.This problem is similar to the "bag of chips" one; however, we can see the mentioning of a "Bottle of soft drink" and "Pepsi"; therefore, we can implement this as Pepsi being an individual of the concept "bottle of soft drink" and it, in turn, is a sub-concept of a large item.For this item we will implement a more difficult structure of concepts.
The THEN part of the rule adds a specific individual to the order.
The next rule B2 exchanges the current step with the next one.The original version of rules like this made an extra step of stopping the execution of the current step before assigning the next.
Rule B3 tests to see if the order has large bottles that need to be bagged.From the rules alone it is unclear if "Large Bottle", "Bottle of soft drink" and "Bottle" are the same concepts; a concept hierarchy is any other structure of information.For example, we could have the concept "Bottle" as a sub-concept of "Item".The concept "Large Bottle" is a sub-concept of both "Bottle" and "Large Item".And, in its turn, the concept "Bottle of soft drink" is a sub-concept of "Bottle" or "Large Bottle".Again it is unclear if in this domain bottles of soft drink are always large.If they are not large, there should be additional concepts, such as "Large Bottle of soft drink", "Medium Bottle of soft drink" and "Small Bottle of soft drink".They all would be sub-concepts of "Bottle of soft drink" and the one concepts of either "Small Item", "Medium Item" or "Large Item".
This rule also tests if there are 6 large items in the bag in order to determine if there is still room to place a large item.
Should the rule fire, the large bottle in question would be placed inside the bag.
B4 is a shortened version of B3.Since rules are always fired in order, by the time the reasoner reaches, there will not be any large bottles left in the order and only remaining large items would be needed to be bagged.
Rule B5 is interesting since by the time this rule is reached there will be no free space in the bag left.The test for 6 items was performed in the previous rule.This way the rule system can determine when a bag change needs to be performed.
When B6 becomes the only available rule, it is clear that the next big step in the bagging process needs to be taken.
Rule B7 is the first rule of the next step, which bags medium items.However, in its original wording this first rule was not clearly meant to put items into a shopping bag.Instead it searched for items with the property "Frozen" (or another indicator for this) and put them only into a specialized freezer bag.Unfortunately there were several things unclear with this rule and could be interpreted very differently.If this step is meant to find all frozen items and put them into freezer bags then the test for room inside the shopping bag is meaningless since the item is placed inside the freezer bag and not the shopping bag, and until a rule is hit that will put it into a bag, the active bag can change.If the freezer bag were immediately placed inside the shopping bag, the test for room inside the shopping bag would make sense, however, the test for the item being inside a freezer bag (as it was in its original form) would not.Any item in a freezer bag would already be also inside the shopping bag and would not need to be bagged.For this paper the rule was changed removing the IF element "the medium item is not in a freezer bag" and modifying the THEN element to indicate that the item is put inside a freezer bag and inside the shopping bag at the same time.This modification of the THEN part also ensures that there is only one freezer bag in every shopping bag.This however would mean that implementation of this element would need to tell the system to check if there already is a freezer bag inside the shopping bag and put the frozen item inside that bag.
Another thing that needs to be noted is the test for an empty bag or a bag that contains medium items.It is interesting in two ways; first, it contains two tests separated with "or".And, second, it begins with the words "there is a(n)".This wording indicates that this element is not only a test, but it also changes the environment, in which the execution takes place.It seems that if there is a bag that fulfils the criteria of this test, that bag is made to be the current shopping bag that is being filled.If the current bag which was being filled at the time this rule fired did not fulfil the requirement of being empty or containing a medium item, and at the same time there were another bag that fulfilled it, from that moment onwards that bag would be considered the current active bag.
The other rules concerning medium items, similar to the rules about the large items, continue to become more and more general until the next step concerning small items needs to become activated.B11 is the first rule concerning small items.It searches for a bag that is not empty.It needs to be noted that "not empty" is different from "containing 6 large items" or "not empty".That makes at least 3 possible tests that can be performed on a bag concerning its fullness.The rule also searches for a bag that does not contain a bottle.However, in combination with rule B12, which puts a small item in any bag that is not full, this means that small items are preferably put in bags with no bottle, but can end up with one, if no empty bag is available.Still in combination with rule B13 a situation can arise that a small item is put in a bag with a bottle, but after that a new bag is started, leaving that small item in an undesired situation with no rule to put it to another bag.
Rule B14 ends the execution of the rules switching to the step "stop".

III. THE DOMAIN ONTOLOGY
From the rule description it made sense to arrange the items around concepts describing the item sizes.It was done this way since many rules address the items in question as "Large Item", "Medium Item" and "Small Item".Only rarely an item was addressed directly or as something else.In the case of the Pepsi item, in order to take a full advantage of all its properties it was made into an instance of "Bottle", "Large Item" and "Soft drink", making it a "Large Bottle of soft drink".Figure 1 shows a graphic representation of the domain ontology.Other items "Pepsi 0.5L" and "Ice Pop" were added to show, that the domain ontology could hold other information that is not necessarily used to solve a given task.Let' us assume that the Fig. 1.Domain ontology store's policy is not to put small frozen products into freezer bags since the shopper might like to enjoy it right away.Therefore the "Ice Pop" will not be put into a freezer bag by the current rules.The property "Frozen" in this ontology is given by using a property with the individual "Frozen" as a target.Not every domain ontology model might use this approach.For example one ontology model might have a literal value "Frozen".Every frozen item would have a property with that literal value as a target.Such problems might be solved by the mapping process if they are considered correctly.

IV. IMPLEMENTATION OF THE RULE EXECUTION
Depending on the system that is constructed we can have several different implementations of the bagger method [8], [9].They can range from very basic and simple ones to very specific and complex implementations.For example, it would be valid to provide a very simplistic method ontology that simply provides the rules in a concept hierarchy with the rules as individuals.Such an ontology would only describe the rules and execution would be manual or in a system that would access the individuals from the ontology and parse their names.
However, in this paper we will try to construct a more complex method ontology that provides all necessary elements and data for direct execution.This study is the continuation of the theme of the previous paper about ontology construction from guidelines [10].The previous study also provided inside into ontology models capable of execution, based on GEM [11] guidelines.

V. METHOD ONTOLOGY
This is a general description of one possible definition of the method ontology.
The method ontology must contain all elements and descriptions for the bagger problem to be executed.The method ontology must have a description of how it works in general.The concept "Method description" can do this.However, depending on how fine a description needs to be provided, it may be better to define several sub-concepts and a structure that is better suited for providing information of a method.The main idea is to have a specific element within the ontology that will describe what information needs to be given in the beginning and what information is returned in the end.The bagger method requires a list of items picked by a user to be provided in the beginning -the order list.In its turn, the method returns a list of bags and their content.
Next, the method ontology defines an internal and external part of the execution.In the external part, we can see parts of the structure of the domain ontology.This is needed since several IF elements require tests for specific concepts (Large item, soft drink bottle).Moreover, several individuals are in the method ontology since they are referenced directly by the rules.Besides, having the concept structure of the domain ontology in the method ontology helps finding mapping solutions in cases of new domain ontology models that do not have mapping information, since this is the part that will serve as an interface to the domain ontology after the mapping process.
In the internal part, the ontology describes all elements needed for rule execution.First, there is a list of all step values that are used by the rules.In this case they are: check-order, bag-large-items, bag-medium-items and bag-small-items.
Next, we have the rule concept and its associated IF and THEN parts.Dissection of a rule individual can be seen in Table II.Also we can extract from the tasks in the IF and THEN parts some useful sub-functions that can be called recurrently rather than having to give the same description of actions for several rules.
The temporal part is a special part of this ontology.During execution, individuals contained in it will change several times.
In this example, a function is a hard-coded set of static activities and does not need inputs.However, every function that is connected via an "IF_x" property has a Boolean operator output, for every such function has to be true for the rule to be true.Some IF functions and every THEN function affect the state of a working-ontology.This working-ontology holds the information necessary to describe the change during the execution of the rules.
It is necessary to note, that the IF and THEN properties of rule individuals have to be numbered, for the order of activating them can have an effect on how a rule is determined to behave.
One thing that is not given in the picture above is the element that describes the activity of every function.This can be given in the ontology as a property value or the individual itself gives a link to the resource that describes the action.
A sub-function is a simpler and frequently used function.It is used for actions that can be generalized and, therefore, save the number of definitions that need to be given for the execution of actions.A the example of sub-function' property is given in Table III.Functions that are described in the IF part of the ontology, the functions of the THEN concept and sub-functions use other elements given in the method ontology.For example, the IF function "step is bag-large-items" has to have a reference to the individual "bag-large-item" of the "Step" concept.This makes it clear how this function operates and does not have to rely solely on its personal definition.However, since tests for the current step are common in this method it also uses a subfunction -"is step" sub-function.This sub-function receives the individual "bag-large-items" as an input from the "step is bag-large-item" function.In order to test whether or not this individual is in fact the current step it needs to be connected to the "current step" individual of the concept "current variable".Having access to this variable the sub-function can examine it for its current connection to a "step" individual.If they are equal to the sub-function and the main function, both hold true.

70
The temporal part of the method ontology contains individuals that will change properties during execution.Also new individuals will be created.Let us take a closer look at it.

VI. TEMPORAL ELEMENTS
Here we can see the ontology that describes the current state of the bagging algorithm.It will be either part of the method ontology and actively used in it or a separate instance of this ontology can be created.The "Active element" concept and "Current Step" individual will be used in order to point to the current step, which is being performed.In order to use this ontology, it will always have to be liked in some way to the method ontology.
The concept "Bag" describes any bag that is used in the bagging problem.Another "Active element" concept, that is "Current Bag", is linked to the bag that is being used by the algorithm at the time.During execution, the property of the individual "Current Bag", which points to one of the concepts "Bag", will change several times.
The concept "Freezer Bag" holds individuals of any freezer bag used during the bagging process.The concept "Cart" (or order) holds only one individual.This individual describes the current cart or order of the user.This individual needs to be linked with the items described in the domain ontology.During execution, the cart will lose items by giving them to bags.By the end the user's cart or order will be empty.
In order to operate with several items, the properties of bags and carts will have to hold a numeric value, which indicates the number of the same item they hold, for example, "Contains 2".A more specific graphical representation of the temporal ontology is given in Fig. 3.

VII. USING THE METHOD ONTOLOGY
If we desire that the method ontology is used as a set of instructions that describe specific actions of a system, we must define a way that would make that possible.
One possible way would be to let the structural representation of the ontology speak for itself.A user or sufficiently intelligent software agent could understand the described actions from the element names alone.Another solution would be to give every function element an additional description for the actions that need to be taken.
Also some sort of language could be introduced in order to make it machine readable and executable.For example, the sub-function "set step" could have an additional description that would state: Set (target at property "uses_1") to (target at property "uses_2"); In such a language the system would have to know the commands "Set" and "to", and understand what other individuals are referenced.This way it would be possible to introduce system specific commands that would carry out the required actions.Using a system that provides the possibility for plug-in development that has a component-based ontology [2], [4], usage in mind would be recommended.

VIII. CONCLUSION
In this paper we described one possible way of creating and implementing a reusable method ontology that fulfils the bagger algorithm.Reusability would arise from the possibility of mapping the method ontology, which describes the actions, to a new domain ontology model [7].Some aspects of this approach need to be tested further.In the provided example a specific hierarchy of concepts and even some individuals were given in the method ontology.How will the mapping process be done, when a new domain ontology model is mapped to this method ontology?Solving the problem of concept names not being the same would be easy enough, but what would happen if the structure were not the same.However it seems that in the case of the bagger, successful execution would be possible with a strange domain ontology, as long as only generic items are used and none of the specific cases happen.There also needs to be a more specific description of the reasoning system and how it operates with the ontology models.

TABLE III DEFINITION
OF SUB-FUNCTION "STEP IS"