This is a Prolog program that helps customers who are in solidarity with Gaza by providing alternatives to boycotting companies for their involvement in Israel's oppression of Palestinians.
To run the program, you need to have a Prolog interpreter installed on your machine. You can download the interpreter from the following link: SWI-Prolog
To run the program, simply open the Prolog interpreter and consult the file rules.pl
. Then, you can use the predicates defined in our program to execute queries and get answers.
list_orders(CustomerUsername, ListOfOrders)
: Predicate to list all orders of a specific customer, as a list.countOrdersOfCustomer(CustomerUsername, Count)
: Predicate to get the number of orders of a specific customer, given customer username.getItemsInOrderById(CustomerUsername, OrderID, Items)
: Predicate to list all items in a specific customer order, given customer username and order ID.getNumOfItems(CustomerUsername, OrderID, Count)
: Predicate to get the number of items in a specific customer order, given customer username and order ID.calcPriceOfOrder(CustomerUsername, OrderID, TotalPrice)
: Predicate to calculate the price of a given order, given customer username and order ID.isBoycott(Name)
: Predicate to determine whether we need to boycott or not, given item name or company name.whyToBoycott(Name, Justification)
: Predicate to find the justification why you need to boycott this company/item, given the company name or an item name.removeBoycottItemsFromAnOrder(CustomerUsername, OrderID, NewList)
: Predicate to remove all the boycott items from a given order, given a customer username and order ID.replaceBoycottItemsFromAnOrder(CustomerUsername, OrderID, NewList)
: Predicate to update the order such that all boycott items are replaced by an alternative (if exists), given a customer username and order ID.calcPriceAfterReplacingBoycottItemsFromAnOrder(CustomerUsername, OrderID, NewList, TotalPrice)
: Predicate to calculate the price of the order after replacing all boycott items by its alternative (if exists), given a customer username and order ID.getTheDifferenceInPriceBetweenItemAndAlternative(Item, Alternative, DiffPrice)
: Predicate to calculate the difference in price between the boycott item and its alternative.add/remove_item/alternative/boycott_company(Name, Brand, Price)
: Predicate to add/remove item/alternative/boycott company to/from the knowledge base.