From 3abaee176b20148453731eeff7ca4ee987e2d636 Mon Sep 17 00:00:00 2001 From: Victor Agreda Jr Date: Wed, 9 Oct 2024 11:54:06 -0400 Subject: [PATCH] New genai demo --- genai-demos/CONTRIBUTING.md | 55 ++++++++++++++++ genai-demos/LICENSE | 37 +++++++++++ genai-demos/README.md | 96 +++++++++++++++++++++++++++ genai-demos/SECURITY.md | 38 +++++++++++ genai-demos/data/create_data.sql | 25 +++++++ genai-demos/data/create_tables.sql | 98 ++++++++++++++++++++++++++++ genai-demos/install.sql | 23 +++++++ genai-demos/run.sql | 55 ++++++++++++++++ genai-demos/sonar-project.properties | 12 ++++ genai-demos/src/procedures.sql | 43 ++++++++++++ 10 files changed, 482 insertions(+) create mode 100644 genai-demos/CONTRIBUTING.md create mode 100644 genai-demos/LICENSE create mode 100644 genai-demos/README.md create mode 100644 genai-demos/SECURITY.md create mode 100644 genai-demos/data/create_data.sql create mode 100644 genai-demos/data/create_tables.sql create mode 100644 genai-demos/install.sql create mode 100644 genai-demos/run.sql create mode 100644 genai-demos/sonar-project.properties create mode 100644 genai-demos/src/procedures.sql diff --git a/genai-demos/CONTRIBUTING.md b/genai-demos/CONTRIBUTING.md new file mode 100644 index 0000000..93cb5e8 --- /dev/null +++ b/genai-demos/CONTRIBUTING.md @@ -0,0 +1,55 @@ +# Contributing to this repository + +We welcome your contributions! There are multiple ways to contribute. + +## Opening issues + +For bugs or enhancement requests, please file a GitHub issue unless it's +security related. When filing a bug remember that the better written the bug is, +the more likely it is to be fixed. If you think you've found a security +vulnerability, do not raise a GitHub issue and follow the instructions in our +[security policy](./SECURITY.md). + +## Contributing code + +We welcome your code contributions. Before submitting code via a pull request, +you will need to have signed the [Oracle Contributor Agreement][OCA] (OCA) and +your commits need to include the following line using the name and e-mail +address you used to sign the OCA: + +```text +Signed-off-by: Your Name +``` + +This can be automatically added to pull requests by committing with `--sign-off` +or `-s`, e.g. + +```text +git commit --signoff +``` + +Only pull requests from committers that can be verified as having signed the OCA +can be accepted. + +## Pull request process + +1. Ensure there is an issue created to track and discuss the fix or enhancement + you intend to submit. +1. Fork this repository. +1. Create a branch in your fork to implement the changes. We recommend using + the issue number as part of your branch name, e.g. `1234-fixes`. +1. Ensure that any documentation is updated with the changes that are required + by your change. +1. Ensure that any samples are updated if the base image has been changed. +1. Submit the pull request. *Do not leave the pull request blank*. Explain exactly + what your changes are meant to do and provide simple steps on how to validate. + your changes. Ensure that you reference the issue you created as well. +1. We will assign the pull request to 2-3 people for review before it is merged. + +## Code of conduct + +Follow the [Golden Rule](https://en.wikipedia.org/wiki/Golden_Rule). If you'd +like more specific guidelines, see the [Contributor Covenant Code of Conduct][COC]. + +[OCA]: https://oca.opensource.oracle.com +[COC]: https://www.contributor-covenant.org/version/1/4/code-of-conduct/ \ No newline at end of file diff --git a/genai-demos/LICENSE b/genai-demos/LICENSE new file mode 100644 index 0000000..4102989 --- /dev/null +++ b/genai-demos/LICENSE @@ -0,0 +1,37 @@ +/* +** Copyright (c) 2024, Oracle and/or its affiliates. +** +** The Universal Permissive License (UPL), Version 1.0 +** +** Subject to the condition set forth below, permission is hereby granted to any +** person obtaining a copy of this software, associated documentation and/or data +** (collectively the "Software"), free of charge and under any and all copyright +** rights in the Software, and any and all patent rights owned or freely +** licensable by each licensor hereunder covering either (i) the unmodified +** Software as contributed to or provided by such licensor, or (ii) the Larger +** Works (as defined below), to deal in both +** +** (a) the Software, and +** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +** one is included with the Software (each a "Larger Work" to which the Software +** is contributed by such licensors), +** +** without restriction, including without limitation the rights to copy, create +** derivative works of, display, perform, and distribute the Software and make, +** use, sell, offer for sale, import, export, have made, and have sold the +** Software and the Larger Work(s), and to sublicense the foregoing rights on +** either these or other terms. +** +** This license is subject to the following condition: +** The above copyright notice and either this complete permission notice or at +** a minimum a reference to the UPL must be included in all copies or +** substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +** SOFTWARE. +*/ \ No newline at end of file diff --git a/genai-demos/README.md b/genai-demos/README.md new file mode 100644 index 0000000..1b51258 --- /dev/null +++ b/genai-demos/README.md @@ -0,0 +1,96 @@ +# Quickly Generate Text Summaries for Ecommerce Product Reviews Using HeatWave GenAI + +[![License: UPL](https://img.shields.io/badge/license-UPL-green)](https://img.shields.io/badge/license-UPL-green) [![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=oracle-devrel_heatwave-genai-demos)](https://sonarcloud.io/dashboard?id=oracle-devrel_heatwave-genai-demos) + +> This repository contains code samples to demonstrates how to use HeatWave GenAI to summarize and/or translate text for example products reviews from an e-commerce website. With just a few steps, one can leverage HeatWave GenAI to enhance an e-commerce website with new capabilities. + +## Introduction +HeatWave GenAI allows you to perform natural language queries on unstructured data using a familiar SQL and JavaScript interface. In the following code samples we can show how easy is it setup and run GenAI applications. + +## Getting Started + +### Prerequisites +**HeatWave-Enabled Database System**: Ensure you have a database system(version 9.1 or above) with HeatWave enabled. Refer to the [Getting Started with MySQL HeatWave on OCI]( https://www.oracle.com/developer/getting-started-with-mysql-heatwave-on-oci/) guide for setup instructions. + +### Steps + +To run the following steps, you need to be in the folder where this README is contained. + +1. Setup the database and create the procedures. + +**Note**: this will remove the `ecommerce` database if you already have it. +``` +mysql -h your_host_name -u yourusername -p < install.sql +``` + +Expected output: +``` +-- Installation: STARTED --- + +-- Dropping database if exists --- + +-- Creating tables --- + +-- Populating data --- + +-- Creating stored procedures --- + +-- Installation: DONE --- +``` + +2. Insert a new review, compute the sentiment of the new review, summarize and translate the summaries +``` +mysql -h your_host_name -u yourusername -p < run.sql +``` + +Expected output: +``` +################### Computing summaries for EXISTING reviews on a product ################### + + +--- English summary of positive reviews on the T-Shirt --- +The T-Shirt is made from high-quality cotton and has a comfortable fit, making it perfect for everyday wear. The washing instructions are clear and easy to follow. However, the lack of bleach instructions may be a concern for some customers. Overall, the T-Shirt is a good option for casual outings and special occasion clothes. +--- English summary of negative reviews on the T-Shirt --- +The reviewer found the T-shirt to be of poor quality, with unsatisfactory material and unclear washing instructions. They would not recommend it to those seeking a long-lasting and easy-to-care-for shirt. Another reviewer also found the T-shirt to fall short of their expectations, citing unbreathable material and an ill-fitting size. They too would not recommend this product to others. +--- Spanish summary of positive reviews on the T-Shirt --- +La camiseta está hecha de algodón de alta calidad y tiene un ajuste cómodo, lo que la hace perfecta para usar a diario. Las instrucciones de lavado son claras y fáciles de seguir. Sin embargo, la falta de instrucciones sobre el uso de blanqueador puede ser una preocupación para algunos clientes. En general, la camiseta es una buena opción para salidas informales y ropa para ocasiones especiales. +--- Spanish summary of negative reviews on the T-Shirt --- +El revisor encontró que la camiseta era de baja calidad, con un material insatisfactorio y unas instrucciones de lavado poco claras. No la recomendaría a aquellos que buscan una prenda duradera y fácil de cuidar. Otro revisor también encontró que la camiseta no cumplía con sus expectativas, citando un material que no permite la transpiración y una talla inadecuada. Tampoco recomendaría este producto a otros. + +################### Insert a new review ################### + +Review: The T-Shirt is fantastic as it is not only comfortable but it is also made of sustainable material. The organic cotton feels like normal cotton while being environment-friendly. However, the washing instruction is difficult to follow. + +################### Done: Insert a new review ################### + + +--- New review --- +Review: The T-Shirt is fantastic as it is not only comfortable but it is also made of sustainable material. The organic cotton feels like normal cotton while being environment-friendly. However, the washing instruction is difficult to follow. +--- Sentiment of the new review --- +POSITIVE + +################### Computing summaries AFTER the review is inserted ################### + + +--- UPDATED English summary of positive reviews on the T-Shirt --- +The T-Shirt is a soft and comfortable option for everyday wear due to its high-quality cotton material and comfortable fit. The washing instructions are clear and easy to follow, ensuring that the T-Shirt retains its quality. However, some customers may be concerned about the lack of bleach instructions. Overall, the T-Shirt is a good option for casual outings and special occasion clothes. It is also made from sustainable material, making it environmentally friendly. +--- UPDATED English summary of negative reviews on the T-Shirt --- +The reviewer found the T-shirt to be of poor quality, with unsatisfactory material and unclear washing instructions. They would not recommend it to those seeking a long-lasting and easy-to-care-for shirt. Another reviewer also found the T-shirt to fall short of their expectations, citing unbreathable material and an ill-fitting size. They too would not recommend this product to others. +--- UPDATED Spanish summary of positive reviews on the T-Shirt --- +La camiseta es una opción suave y cómoda para el uso diario gracias a su material de algodón de alta calidad y su ajuste confortable. Las instrucciones de lavado son claras y fáciles de seguir, lo que garantiza que la camiseta mantenga su calidad. Sin embargo, algunos clientes pueden estar preocupados por la falta de instrucciones sobre el uso de lejía. En general, la camiseta es una buena opción para salidas informales y ropa para ocasiones especiales. También está hecha de material sostenible, lo que la hace respetuosa con el medio ambiente. +--- UPDATED Spanish summary of negative reviews on the T-Shirt --- +El revisor encontró que la camiseta era de baja calidad, con un material insatisfactorio y unas instrucciones de lavado poco claras. No la recomendaría a aquellos que buscan una prenda duradera y fácil de cuidar. Otro revisor también encontró que la camiseta no cumplía con sus expectativas, citando un material que no permite la transpiración y una talla inadecuada. Tampoco recomendaría este producto a otros. +``` + + +## Contributing +This project is open source. Please submit your contributions by forking this repository and submitting a pull request! Oracle appreciates any contributions that are made by the open source community. + +## License +Copyright (c) 2024 Oracle and/or its affiliates. + +Licensed under the Universal Permissive License (UPL), Version 1.0. + +See [LICENSE](LICENSE) for more details. + +ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK. \ No newline at end of file diff --git a/genai-demos/SECURITY.md b/genai-demos/SECURITY.md new file mode 100644 index 0000000..fb42c94 --- /dev/null +++ b/genai-demos/SECURITY.md @@ -0,0 +1,38 @@ +# Reporting security vulnerabilities + +Oracle values the independent security research community and believes that +responsible disclosure of security vulnerabilities helps us ensure the security +and privacy of all our users. + +Please do NOT raise a GitHub Issue to report a security vulnerability. If you +believe you have found a security vulnerability, please submit a report to +[secalert_us@oracle.com][1] preferably with a proof of concept. Please review +some additional information on [how to report security vulnerabilities to Oracle][2]. +We encourage people who contact Oracle Security to use email encryption using +[our encryption key][3]. + +We ask that you do not use other channels or contact the project maintainers +directly. + +Non-vulnerability related security issues including ideas for new or improved +security features are welcome on GitHub Issues. + +## Security updates, alerts and bulletins + +Security updates will be released on a regular cadence. Many of our projects +will typically release security fixes in conjunction with the +Oracle Critical Patch Update program. Additional +information, including past advisories, is available on our [security alerts][4] +page. + +## Security-related information + +We will provide security related information such as a threat model, considerations +for secure use, or any known security issues in our documentation. Please note +that labs and sample code are intended to demonstrate a concept and may not be +sufficiently hardened for production use. + +[1]: mailto:secalert_us@oracle.com +[2]: https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html +[3]: https://www.oracle.com/security-alerts/encryptionkey.html +[4]: https://www.oracle.com/security-alerts/ \ No newline at end of file diff --git a/genai-demos/data/create_data.sql b/genai-demos/data/create_data.sql new file mode 100644 index 0000000..26b25f4 --- /dev/null +++ b/genai-demos/data/create_data.sql @@ -0,0 +1,25 @@ +-- Copyright (c) 2024, Oracle and/or its affiliates. +-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + +-- using database ecommerce as an example +-- the following data have been generated automatically + +USE ecommerce; + +INSERT INTO `customers` VALUES (1,'David','Johnson',NULL,NULL,NULL,'They generally buy everyday wear clothes and prefers soft type of fabric.'),(2,'Sarah','Williams',NULL,NULL,NULL,'They generally buy weekend adventures clothes and prefers durable type of fabric.'),(3,'John','Brown',NULL,NULL,NULL,'They generally buy casual outings clothes and prefers durable type of fabric.'),(4,'Jane','Jackson',NULL,NULL,NULL,'They generally buy everyday wear clothes and prefers soft type of fabric.'),(5,'Sue','Anderson',NULL,NULL,NULL,'They generally buy special occasions clothes and prefers soft type of fabric.'),(6,'Mark','Miller',NULL,NULL,NULL,'They generally buy everyday wear clothes and prefers soft type of fabric.'),(7,'Emily','Clark',NULL,NULL,NULL,'They generally buy casual outings clothes and prefers durable type of fabric.'),(8,'James','Lee',NULL,NULL,NULL,'They generally buy everyday wear clothes and prefers durable type of fabric.'),(9,'Fred','Smith',NULL,NULL,NULL,'They generally buy special occasions clothes and prefers durable type of fabric.'),(10,'Sofia','Martinez',NULL,NULL,NULL,'They generally buy special occasions clothes and prefers breathable type of fabric.'),(11,'Michael','Rodriguez',NULL,NULL,NULL,'They generally buy everyday wear clothes and prefers durable type of fabric.'),(12,'Chris','Davis',NULL,NULL,NULL,'They generally buy special occasions clothes and prefers breathable type of fabric.'),(13,'Jose','Garcia',NULL,NULL,NULL,'They generally buy weekend adventures clothes and prefers durable type of fabric.'),(14,'Will','Robinson',NULL,NULL,NULL,'They generally buy casual outings clothes and prefers breathable type of fabric.'),(15,'Jennifer','Lewis',NULL,NULL,NULL,'They generally buy everyday wear clothes and prefers soft type of fabric.'),(16,'John','Allen',NULL,NULL,NULL,'They generally buy special occasions clothes and prefers soft type of fabric.'),(17,'Bill','Harris',NULL,NULL,NULL,'They generally buy weekend adventures clothes and prefers breathable type of fabric.'),(18,'Grant','Adams',NULL,NULL,NULL,'They generally buy weekend adventures clothes and prefers soft type of fabric.'),(19,'Jill','Baker',NULL,NULL,NULL,'They generally buy special occasions clothes and prefers soft type of fabric.'),(20,'Vince','Roberts',NULL,NULL,NULL,'They generally buy special occasions clothes and prefers soft type of fabric.'); + +INSERT INTO `languages` VALUES (1,'en','English'),(2,'fr','French'),(3,'de','German'),(4,'es','Spanish'),(5,'it','Italian'); + +INSERT INTO `orderitems` VALUES (1,1,2,3,75.55),(2,2,3,5,25.54),(3,3,7,2,64.51),(4,4,9,4,56.14),(5,5,6,4,61.52),(6,6,8,3,78.44),(7,7,8,5,50.32),(8,8,10,1,82.25),(9,9,5,3,44.79),(10,10,5,1,62.69),(11,11,5,1,41.83),(12,12,1,3,11.91),(13,13,8,2,94.47),(14,14,10,3,14.02),(15,15,3,2,94.42),(16,16,7,2,78.27),(17,17,4,3,38.50),(18,18,7,2,29.36),(19,19,2,1,80.66),(20,20,2,4,44.79),(21,21,1,5,65.34),(22,22,6,4,20.47),(23,23,6,1,50.32),(24,24,6,3,74.47),(25,25,7,3,63.17),(26,26,4,1,51.43),(27,27,10,4,90.09),(28,28,10,4,58.32),(29,29,1,1,12.77),(30,30,1,5,54.06),(31,31,4,1,85.52),(32,32,10,4,42.01),(33,33,4,4,35.37),(34,34,1,2,54.10),(35,35,4,1,50.30),(36,36,5,4,48.49),(37,37,10,2,12.81),(38,38,8,3,56.88),(39,39,2,4,80.84),(40,40,4,4,66.87),(41,41,3,4,31.77),(42,42,6,5,73.16),(43,43,6,1,82.47),(44,44,9,2,63.17),(45,45,8,4,26.56),(46,46,7,2,84.89),(47,47,6,4,25.48),(48,48,9,5,64.10),(49,49,2,5,63.55),(50,50,3,1,15.40),(51,51,8,1,88.77),(52,52,7,5,99.65),(53,53,4,5,30.36),(54,54,3,4,31.26),(55,55,9,1,53.85),(56,56,9,5,41.46),(57,57,3,2,88.83),(58,58,8,5,61.06),(59,59,3,3,61.34),(60,60,5,2,89.01),(61,61,10,5,55.97),(62,62,3,4,83.26),(63,63,3,1,18.92),(64,64,2,4,91.75),(65,65,7,4,80.81),(66,66,4,2,58.04),(67,67,7,5,55.55),(68,68,8,1,96.34),(69,69,10,5,73.40),(70,70,9,2,66.95),(71,71,10,4,98.36),(72,72,9,1,84.22),(73,73,9,1,43.47),(74,74,7,2,20.97),(75,75,10,4,25.00),(76,76,5,2,58.02),(77,77,2,1,11.50),(78,78,3,5,77.52),(79,79,6,1,62.54),(80,80,7,1,65.06),(81,81,8,5,44.20),(82,82,5,3,38.99),(83,83,5,3,17.81),(84,84,2,5,99.39),(85,85,10,4,16.53),(86,86,9,5,97.85),(87,87,10,1,47.77),(88,88,8,5,60.28),(89,89,4,5,58.28),(90,90,9,1,71.21),(91,91,5,3,26.80),(92,92,1,4,74.09),(93,93,1,4,99.47),(94,94,9,2,49.78),(95,95,7,5,48.23),(96,96,4,4,90.96),(97,97,9,3,14.43),(98,98,6,3,42.94),(99,99,6,4,76.89),(100,100,4,2,98.54); + +INSERT INTO `orders` VALUES (1,16,'2024-05-11',164.34),(2,8,'2024-05-09',133.87),(3,5,'2024-05-15',195.29),(4,3,'2024-05-02',72.51),(5,4,'2024-05-14',139.33),(6,8,'2024-05-23',80.79),(7,14,'2024-05-13',150.67),(8,9,'2024-05-19',168.53),(9,16,'2024-05-07',51.46),(10,19,'2024-05-28',184.44),(11,1,'2024-05-20',88.74),(12,16,'2024-05-11',128.83),(13,1,'2024-05-07',171.78),(14,4,'2024-05-08',130.32),(15,16,'2024-05-12',187.74),(16,9,'2024-05-26',118.98),(17,12,'2024-05-25',145.70),(18,5,'2024-05-09',160.29),(19,9,'2024-05-27',173.75),(20,17,'2024-05-18',110.27),(21,12,'2024-05-12',196.51),(22,14,'2024-05-24',172.60),(23,4,'2024-05-04',124.91),(24,20,'2024-05-19',54.13),(25,19,'2024-05-18',190.37),(26,5,'2024-05-07',125.87),(27,8,'2024-05-21',147.55),(28,8,'2024-05-20',109.25),(29,1,'2024-05-27',146.71),(30,1,'2024-05-14',97.97),(31,15,'2024-05-04',112.62),(32,4,'2024-05-12',52.63),(33,13,'2024-05-03',122.38),(34,1,'2024-05-24',54.38),(35,3,'2024-05-24',85.32),(36,7,'2024-05-11',58.85),(37,4,'2024-05-13',174.69),(38,7,'2024-05-28',188.13),(39,9,'2024-05-01',72.27),(40,11,'2024-05-09',72.21),(41,20,'2024-05-18',141.75),(42,1,'2024-05-25',186.27),(43,16,'2024-05-20',169.30),(44,1,'2024-05-21',89.59),(45,13,'2024-05-21',157.81),(46,19,'2024-05-02',171.67),(47,10,'2024-05-12',166.79),(48,3,'2024-05-25',187.22),(49,15,'2024-05-11',139.88),(50,11,'2024-05-23',180.40),(51,20,'2024-05-15',173.52),(52,15,'2024-05-20',167.14),(53,4,'2024-05-18',84.02),(54,6,'2024-05-27',171.21),(55,16,'2024-05-18',175.88),(56,4,'2024-05-02',179.93),(57,13,'2024-05-25',118.41),(58,18,'2024-05-20',154.70),(59,4,'2024-05-15',173.51),(60,1,'2024-05-10',187.46),(61,9,'2024-05-12',105.78),(62,11,'2024-05-06',80.33),(63,5,'2024-05-18',195.97),(64,18,'2024-05-18',61.00),(65,8,'2024-05-25',116.92),(66,6,'2024-05-24',157.83),(67,20,'2024-05-25',166.13),(68,14,'2024-05-06',81.06),(69,13,'2024-05-26',130.23),(70,2,'2024-05-12',135.72),(71,9,'2024-05-25',77.79),(72,17,'2024-05-26',90.23),(73,15,'2024-05-12',171.29),(74,6,'2024-05-22',67.08),(75,4,'2024-05-02',118.46),(76,5,'2024-05-12',102.40),(77,1,'2024-05-17',96.84),(78,4,'2024-05-17',126.79),(79,20,'2024-05-20',174.39),(80,10,'2024-05-15',100.44),(81,7,'2024-05-14',179.00),(82,14,'2024-05-04',89.10),(83,16,'2024-05-15',136.89),(84,11,'2024-05-07',161.39),(85,15,'2024-05-01',111.48),(86,9,'2024-05-03',128.04),(87,10,'2024-05-01',198.61),(88,14,'2024-05-08',124.96),(89,6,'2024-05-02',57.57),(90,3,'2024-05-19',109.33),(91,7,'2024-05-14',195.75),(92,3,'2024-05-06',130.86),(93,9,'2024-05-11',170.94),(94,2,'2024-05-07',100.13),(95,14,'2024-05-15',170.53),(96,7,'2024-05-12',173.57),(97,7,'2024-05-23',170.64),(98,15,'2024-05-18',154.39),(99,15,'2024-05-20',139.30),(100,16,'2024-05-22',158.95); + +INSERT INTO `productcategories` VALUES (1,'Clothing','clothing'),(2,'Kitchenware','kitchenware'),(3,'Accessories','accessories'); + +INSERT INTO `productdescriptions` VALUES (1,1,'it','Camicetta di alta qualità fatta da cotone respirabile. Ideale per uscite informali. Disponibile in molti colori e dimensioni.'),(2,1,'es','Camiseta de alta calidad hecha de algodón respiradorio. Ideal para salidas informales. Disponible en varias colores y tamaños.'),(3,1,'de','Hochwertige T-Shirt aus atemlüftiger Baumwolle. Ideal für kasuelle Ausflüge. Verfügbar in vielen Farben und Größen.'),(4,1,'fr','Une T-shirt de haute qualité fabriquée à partir de coton respirable. Idéale pour des sorties courantes. Disponible en plusieurs couleurs et tailles.'),(5,1,'en','A high-quality T-shirt manufactured from breathable cotton is perfect for casual outings. It comes in a variety of colors and sizes.'),(6,2,'it','Coppa di caffè di alta qualità in nero. Perfetta per l\'uso quotidiano.'),(7,2,'es','Copa de café de alta calidad en negro. Ideal para uso diario.'),(8,2,'de','Ein hochwertiger Kaffeekuppel in schwarz. Ideal für jeden Taglichen Gebrauch.'),(9,2,'fr','Une tasse de café de haute qualité en noir. Idéale pour l\'utilisation quotidienne.'),(10,2,'en','A high-quality coffee cup in black is perfect for everyday use.'),(11,3,'it','Coperchio webcam di alta qualità, realizzato in ABS. Ideale per la privacy.'),(12,3,'es','Cubierta de cámara web de alta calidad hecha de ABS. Ideal para la privacidad.'),(13,3,'de','Hochwertige Webcam-Cover aus ABS. Ideal für die Privatsphäre.'),(14,3,'fr','Couverture de caméra web de haute qualité, fabriquée à partir d\'ABS. Idéale pour la protection de la vie privée.'),(15,3,'en','High-quality webcam cover crafted from ABS. Ideal for maintaining privacy.'),(16,4,'it','Sacca di alta qualità, realizzata da denimo di alta resistenza. Ideale per l\'uso quotidiano.'),(17,4,'es','Un saco de alta calidad fabricado de fuerte denim. Ideal para uso diario.'),(18,4,'de','Ein hochwertiger Tragekoffer aus hoher Stärke Denim gefertigt. Ideal für jeden Taggebrauch.'),(19,4,'fr','Un sac à main de haute qualité fabriqué à partir d\'un denim fort. Idéal pour l\'utilisation quotidienne.'),(20,4,'en','A sturdy carry bag crafted from robust denim fabric. Ideal for daily usage.'),(21,5,'it','Muggia di alta qualità. Ideale per l\'uso quotidiano.'),(22,5,'es','Mug de Café de Alta Calidad. Ideal para uso diario.'),(23,5,'de','Hochwertiger Kaffeekuppel. Ideal für tägliche Benutzung.'),(24,5,'fr','Une tasse de café de haute qualité. Idéale pour l\'utilisation quotidienne.'),(25,5,'en','Premium Coffee Mug. Ideal for daily use.'),(26,6,'it','Capo da Baseball di alta qualità, realizzato con tessuto cotonato twill. Ideale per uscite informali.'),(27,6,'es','Cap de calidad hecha de tela de liña de algodón. Ideal para salidas informales.'),(28,6,'de','Hochwertige Baseballcap aus Baumwolle Twill. Ideal für kasuelle Ausflüge.'),(29,6,'fr','Chapeau de base-ball de haute qualité fabriqué à partir de toile de coton tissu. Idéal pour des sorties causales.'),(30,6,'en','A high-quality baseball cap crafted from cotton twill is ideal for leisurely excursions.'),(31,7,'it','Coppa di caffè di alta qualità in bianco. Ideale per l\'uso quotidiano.'),(32,7,'es','Copa de café de alta calidad en blanco. Ideal para uso diario.'),(33,7,'de','Ein hochwertiger Kaffeekuppel in Weiß. Ideal für den täglichen Gebrauch.'),(34,7,'fr','Une tasse de café de haute qualité en blanc. Idéale pour l\'utilisation quotidienne.'),(35,7,'en','A high-quality white coffee cup that is suitable for daily use.'),(36,8,'it','Camicia da ginnica di alta qualità, fatta da cotone respirabile. Ideale per uscite informali. Disponibile in molti colori e dimensioni.'),(37,8,'es','Camiseta de alta calidad hecha de algodón respiradorio. Ideal para salidas informales. Disponible en varias colores y tamaños.'),(38,8,'de','Hochwertige Hoodie aus atemlüftigem Baumwolle. Ideal für unformelle Ausflüge. Verfügbar in vielen Farben und Größen.'),(39,8,'fr','Un vêtement de pull de haute qualité, fabriqué à partir de coton respirable. Idéal pour des sorties courantes. Disponible en plusieurs couleurs et tailles.'),(40,8,'en','A high-quality hoodie, crafted from breathable cotton, is perfect for casual excursions. It comes in a variety of colors and sizes.'),(41,9,'it','Stichetto di alta qualità. Utilizzilo in qualsiasi luogo.'),(42,9,'es','Alta calidad etiqueta. Utilízelo en cualquier lugar.'),(43,9,'de','Hochwertiger Klebeband. Sie können ihn überall verwenden.'),(44,9,'fr','Haute qualité étiquette. Utilisez-la partout.'),(45,9,'en','High-quality adhesive. Apply it in any location.'),(46,10,'it','Calzoni di alta qualità fatti da tessuto canapa. Ideali per l\'uso quotidiano. Disponibili in molti colori e dimensioni.'),(47,10,'es','Zapatillas de alta calidad hechas de tela de algodón y cáñamo. Ideales para uso diario. Disponibles en varios colores y tamaños.'),(48,10,'de','Hochwertige Schuhe aus Baumwolle-Canvas. Ideal für den Alltagseinsatz. Verfügbar in verschiedenen Farben und Größen.'),(49,10,'fr','Des chaussures de haute qualité fabriquées à partir de toile de coton. Idéales pour l\'utilisation quotidienne. Disponibles en plusieurs couleurs et tailles.'),(50,10,'en','High-quality sneakers crafted from cotton canvas are ideal for daily wear. They come in a variety of colors and sizes.'); + +INSERT INTO `productdetails` VALUES (1,1,'en','XXL','Cotton','Do not bleach'),(2,2,'en','M','Ceramic','Hand wash only'),(3,3,'en','XXL','ABS Plastic','Keep away from direct sunlight'),(4,4,'en','S','Cotton','Do not bleach'),(5,5,'en','XL','Ceramic','Hand wash only'),(6,6,'en','M','Cotton','Hand wash only'),(7,7,'en','XL','Ceramic','Hand wash only'),(8,8,'en','M','Cotton','Machine wash cold'),(9,9,'en','S','Sticker','Apply to clean surfaces only'),(10,10,'en','XXL','Cotton Canvas','Machine wash cold'); + +INSERT INTO `products` VALUES (1,'T-Shirt',24.99,'Clothing','t-shirt-circles-black.png'),(2,'Black Coffee Cup',19.99,'Kitchenware','cup-black.png'),(3,'Web Cam Cover',12.99,'Accessories','webcam-cover.png'),(4,'Carry Bag',29.99,'Clothing','bag-white.png'),(5,'Coffee Mug',24.99,'Kitchenware','mug-1.png'),(6,'Baseball Cap',17.99,'Clothing','hat-1.png'),(7,'White Coffee Cup',12.99,'Kitchenware','cup-white.png'),(8,'Hoodie',59.99,'Clothing','hoodie-1.png'),(9,'Sticker',4.99,'Accessories','sticker-rainbow.png'),(10,'Sneakers',19.99,'Clothing','shoes-1.png'); + +INSERT INTO `reviews` VALUES (3,'en',1,1,5,' Review: \"I highly recommend this T-Shirt. The softness of the cotton material and the comfortable fit make it perfect for everyday wear. The washing instructions are clear and easy to follow, ensuring that the T-Shirt retains its quality.\"','POSITIVE'),(4,'en',1,3,3,' Review: The T-Shirt is made from high-quality cotton and is perfect for casual outings. However, the lack of bleach instructions may be a concern for some customers. Overall, I would rate it 3 out of 5 stars.','POSITIVE'),(5,'en',1,9,2,' Review: This T-Shirt is not up to the mark. The material is not durable enough and the washing instructions are not clear. I would not recommend this product to anyone looking for a long-lasting and easy-to-care-for T-Shirt.','NEGATIVE'),(6,'en',1,12,2,' Review: This T-Shirt is not up to my expectations. The material is not breathable enough and the size is too small. I would not recommend this product to others.','NEGATIVE'),(7,'en',1,16,3,' Review: This T-Shirt is a decent choice for those who prefer soft fabrics and special occasion clothes. However, the lack of bleach instructions may be a concern for some. Overall, it is a good option for casual outings.','POSITIVE'),(8,'en',2,1,2,' Review: This coffee cup is not suitable for everyday use as it is made of ceramic and requires hand washing only. The soft fabric preference of the customer may not be met with this product.','NEGATIVE'),(9,'en',2,9,2,' Review: This coffee cup is not durable enough for frequent use and the hand wash only instructions make it less convenient to clean.','NEGATIVE'),(10,'en',2,11,4,' Review: The Black Coffee Cup is a high-quality product that is perfect for everyday use. The ceramic material is durable and easy to clean, making it a great choice for those who prefer to wash their cups by hand. Overall, I would rate this product 4 out of 5 stars.','POSITIVE'),(11,'en',2,15,3,' Review: The Black Coffee Cup is a high-quality product that is perfect for everyday use. However, the hand wash only washing instructions may be a drawback for some users. Overall, I would rate it 3 out of 5 stars.','POSITIVE'),(12,'en',2,16,3,' Review: The Black Coffee Cup is a high-quality product that is perfect for everyday use. However, the hand wash only washing instructions may not be suitable for all users. Overall, I would rate it 3 out of 5 stars.','POSITIVE'),(13,'en',2,17,4,' Review: This Black Coffee Cup is a great addition to any coffee lover\'s collection. The high-quality ceramic material and the hand wash only instructions make it a durable and easy-to-care-for choice. However, the lack of breathable fabric may not be suitable for those who prefer weekend adventures. Overall, I would rate this product 4 out of 5 stars.','POSITIVE'),(14,'en',2,18,5,' Review: This Black Coffee Cup is perfect for everyday use and the high-quality ceramic material ensures durability. The hand wash only instructions make it easy to clean and maintain. Overall, I highly recommend this product. Rating: 5/5 stars.','POSITIVE'),(15,'en',3,4,4,' Review: The Web Cam Cover is a high-quality product made from ABS Plastic. It is perfect for privacy and provides excellent coverage. However, it is not suitable for direct sunlight and should be kept away from it. Overall, I would rate it 4 out of 5 stars.','POSITIVE'),(16,'en',3,5,3,' Review:\n\nI would rate this web cam cover a 3 out of 5 stars. While the material is high-quality, the size and washing instructions may not be suitable for all users.','NEGATIVE'),(17,'en',3,6,4,' Review: This web cam cover is a great option for those who want to protect their privacy. The ABS plastic material is durable and easy to clean, making it a practical choice for everyday wear. However, it\'s important to keep it away from direct sunlight to prevent discoloration. Overall, I would rate this product 4 out of 5 stars.','POSITIVE'),(18,'en',3,8,2,' Review: The Web Cam Cover XXL made from ABS Plastic is a decent product for privacy. However, the durability of the material is questionable and the washing instructions are not clear.','NEGATIVE'),(19,'en',3,11,5,' Review: This Web Cam Cover is perfect for those who value privacy and durability. The ABS Plastic material is of high quality and the XXL size ensures a perfect fit. The washing instructions are clear and easy to follow. Overall, I highly recommend this product.','POSITIVE'),(20,'en',3,13,1,' Review: This product does not meet my expectations. The material is not durable and the washing instructions are not clear. I would not recommend this product to others.','NEGATIVE'),(21,'en',3,16,4,' Review: The Web Cam Cover is a high-quality product made from ABS Plastic. It is perfect for privacy and is easy to use. However, it is not suitable for direct sunlight and should be kept away from it. Overall, I would rate it 4 out of 5 stars.','POSITIVE'),(22,'en',3,20,5,' Review: This Web Cam Cover is perfect for those who value privacy. The high-quality ABS material ensures durability and protection from prying eyes. I highly recommend this product to anyone looking for a reliable and effective web cam cover.','POSITIVE'),(23,'en',4,3,4,' Review: This carry bag is a great choice for those who prefer durable and high-quality materials. The cotton fabric is soft and comfortable to carry, making it perfect for everyday use. However, the lack of bleach instructions may be a concern for some users. Overall, I would rate this carry bag 4 out of 5 stars.','POSITIVE'),(24,'en',4,4,4,' Review: This carry bag is a great option for everyday wear. The high-quality denim material is durable and comfortable to carry. However, the lack of bleach instructions may be a concern for some. Overall, I would rate this product 4 out of 5 stars.','POSITIVE'),(25,'en',4,5,2,' Review: This carry bag is not suitable for special occasions as it is made from denim, which is not a soft fabric. Additionally, the washing instructions do not allow for bleaching, which may not be ideal for those who prefer to clean their clothes with bleach. Overall, I would rate this product 2 out of 5 stars.','NEGATIVE'),(26,'en',4,6,5,' Review: This carry bag is perfect for everyday use and made from high strength denim. The soft fabric and washing instructions make it a great choice for those who prefer comfortable and easy-to-care-for clothing. I highly recommend this product and give it a rating of 5 out of 5 stars.','POSITIVE'),(27,'en',4,7,5,' Review: This carry bag is perfect for everyday use. The high-quality denim material is both durable and stylish, making it a great choice for casual outings. I highly recommend this product to anyone looking for a reliable and fashionable carry bag.','POSITIVE'),(28,'en',4,11,3,' Review: The Carry Bag is a decent product, but the material could be more durable. The washing instructions are clear and easy to follow. Overall, I would rate it 3 out of 5 stars.','POSITIVE'),(29,'en',4,12,2,' Review: This carry bag is not suitable for special occasions as it is made from denim, which is not breathable. The washing instructions are also not suitable for special occasion clothes. Therefore, I would rate this product 2 out of 5 stars.','NEGATIVE'),(30,'en',4,13,4,' Review: The Carry Bag is a great choice for those who want a durable and high-quality bag for everyday use. The cotton material is soft and comfortable to carry, and the high-strength denim construction ensures that it will last for years to come. Overall, I would give this bag a rating of 4 out of 5 stars.','POSITIVE'),(31,'en',4,15,2,' Review: This carry bag is made from high strength denim, but the material is not soft enough for my preferences. The washing instructions are also not suitable for my needs. Overall, I would rate this product 2 out of 5 stars.','NEGATIVE'),(32,'en',4,16,2,' Review: This carry bag is not suitable for special occasions as it is made from denim, which is not a soft type of fabric. Additionally, the washing instructions do not allow for bleaching, which may not be ideal for those who prefer to clean their clothes with bleach. Overall, I would rate this product 2 out of 5 stars.','NEGATIVE'),(33,'en',5,1,3,' Review: This coffee mug is a good choice for everyday use, but the hand wash only washing instructions may be a drawback for some. Overall, I would rate it 3 out of 5 stars.','POSITIVE'),(34,'en',5,5,2,' Review: This coffee mug is not suitable for Sue Anderson as it is not made of soft fabric and it is not suitable for washing in a dishwasher.','NEGATIVE'),(35,'en',5,7,1,' Review: This coffee mug is not suitable for my casual outings style. The material is not durable enough for frequent use and the washing instructions limit its versatility. I would not recommend this product to others who prefer durable and versatile options.','NEGATIVE'),(36,'en',5,14,5,' Review: This Coffee Mug is perfect for everyday use and the high-quality ceramic material ensures durability. The hand wash only instructions make it easy to clean and maintain. I highly recommend this product! 5/5 stars.','POSITIVE'),(37,'en',5,16,4,' Review: This Coffee Mug is a great addition to any coffee lover\'s collection. The ceramic material is durable and easy to clean, making it perfect for everyday use. However, the hand wash only washing instructions may be a drawback for some users. Overall, I would rate this Coffee Mug 4 out of 5 stars.','POSITIVE'),(38,'en',5,19,2,' Review: This coffee mug is not suitable for Jill Baker as it is not made of soft fabric and it is not suitable for washing in a dishwasher.','NEGATIVE'),(39,'en',6,1,2,' Review: The Baseball Cap is made from cotton twill, which is a soft and comfortable material. However, the washing instructions are limited to hand wash only, which may not be suitable for all users. Overall, I would rate this product 2 out of 5 stars.','NEGATIVE'),(40,'en',6,4,2,' Review: This Baseball Cap is made from cotton twill and is perfect for casual outings. However, the washing instructions are limited to hand wash only, which may not be suitable for all users. Overall, I would rate this product 2 out of 5 stars.','NEGATIVE'),(41,'en',6,10,1,' Review: This Baseball Cap is not suitable for Sofia Martinez as it is not made from breathable fabric and it cannot be washed in a washing machine.','NEGATIVE'),(42,'en',6,14,2,' Review: This Baseball Cap is made from cotton twill and is perfect for casual outings. However, the washing instructions are limited to hand wash only, which may not be suitable for all users. Overall, I would rate this product 2 out of 5 stars.','NEGATIVE'),(43,'en',6,15,1,' Review: This Baseball Cap is not worth the price. The material is not soft enough and the washing instructions are too restrictive.','NEGATIVE'),(44,'en',6,16,2,' Review: The Baseball Cap is made of high-quality cotton twill, but the hand wash only instructions make it less practical for everyday use. Overall, I would rate it 2 out of 5 stars.','NEGATIVE'),(45,'en',6,20,5,' Review: This Baseball Cap is perfect for casual outings and made from high-quality cotton twill. I highly recommend it to anyone looking for a comfortable and stylish accessory.','POSITIVE'),(46,'en',7,5,1,' Review: This product does not meet my expectations. The material is not soft and the washing instructions are not suitable for my needs. I would not recommend this product to others.','NEGATIVE'),(47,'en',7,6,4,' Review: This White Coffee Cup is a great addition to any coffee lover\'s collection. The ceramic material is durable and easy to clean, making it perfect for everyday use. However, the hand wash only washing instructions may be a drawback for some users. Overall, I would rate this product 4 out of 5 stars.','POSITIVE'),(48,'en',7,8,3,' Review: The ceramic coffee cup is of good quality and suitable for everyday use. However, the hand wash only washing instructions may be a drawback for some users. Overall, I would rate it 3 out of 5 stars.','POSITIVE'),(49,'en',7,9,2,' Review: This cup is not durable enough for frequent use and the hand wash only instructions make it less convenient to clean.','NEGATIVE'),(50,'en',7,10,2,' Review: This cup is not suitable for Sofia as it is not breathable and made of ceramic. She prefers special occasion clothes and breathable fabrics.','NEGATIVE'),(51,'en',7,14,5,' Review: This is a great cup for everyday use. The white color and high-quality material make it perfect for casual outings. The hand wash only instructions make it easy to clean and maintain. I would highly recommend this cup to anyone looking for a reliable and stylish coffee cup for their daily routine.','POSITIVE'),(52,'en',7,15,5,' Review: This is a great everyday cup for coffee lovers who prefer soft fabric. The ceramic material is of high quality and the hand wash only instructions make it easy to clean. Overall, I highly recommend this product. 5/5 stars.','POSITIVE'),(53,'en',7,19,4,' Review: This white coffee cup is of high quality and perfect for everyday use. However, it is not suitable for machine washing and should only be hand washed. Overall, I would rate it 4 out of 5 stars.','POSITIVE'),(54,'en',7,20,2,' Review: This cup is not suitable for someone who prefers soft fabrics. The hand wash only instructions make it less convenient to clean.','NEGATIVE'),(55,'en',8,1,5,' Review: \"I absolutely love this Hoodie! The softness of the cotton and the comfortable fit make it perfect for everyday wear. The washing instructions are also very convenient, making it easy to keep clean. Overall, I highly recommend this product!\"','POSITIVE'),(56,'en',8,7,5,' Review: This Hoodie is perfect for casual outings and made from high-quality cotton. The durability of the fabric and the machine wash cold instructions make it a great addition to any wardrobe. I highly recommend this product and give it a rating of 5 out of 5 stars.','POSITIVE'),(57,'en',8,8,5,' Review: This Hoodie is perfect for everyday wear and made from high-quality cotton. The durability of the fabric and the machine washable instructions make it a great addition to any wardrobe. I highly recommend this product and give it a well-deserved 5 out of 5 stars.','POSITIVE'),(58,'en',8,13,5,' Review: 5/5 stars. This Hoodie is perfect for weekend adventures and is made from durable cotton. The machine wash instructions make it easy to clean and maintain.','POSITIVE'),(59,'en',8,14,3,' Review: This Hoodie is a decent choice for casual outings, but could be improved with better breathability and a more comfortable fit. Overall, I would rate it 3 out of 5 stars.','POSITIVE'),(60,'en',8,18,1,' Review: This hoodie is not the best choice for someone who prefers soft type of fabric. The washing instructions are also not suitable for someone who generally buys weekend adventure clothes. Overall, I would not recommend this product.','NEGATIVE'),(61,'en',8,20,3,' Review: This Hoodie is a decent choice for casual outings, but the quality could be better. The softness of the fabric is a nice touch, but the overall construction feels a bit cheap.','NEGATIVE'),(62,'en',9,1,4,' Review: The Sticker is a high-quality product that can be used anywhere. However, it is not suitable for washing surfaces. Therefore, I would rate it 4 out of 5 stars.','POSITIVE'),(63,'en',9,2,3,' Review: The sticker is of good quality, but it is limited to clean surfaces only.','POSITIVE'),(64,'en',9,3,5,' Review: 5/5 stars. This sticker is of high quality and can be used anywhere. It is perfect for casual outings and prefers durable type of fabric. The washing instructions are clear and easy to follow. Overall, I highly recommend this product.','POSITIVE'),(65,'en',9,4,2,' Review: This sticker is not suitable for everyday wear clothes as it is not made of soft fabric. The washing instructions are also not suitable for everyday wear clothes. Therefore, I would rate this product 2 out of 5 stars.','NEGATIVE'),(66,'en',9,7,1,' Review: This product is not suitable for their needs as it is not made of durable fabric and cannot be washed.','NEGATIVE'),(67,'en',9,9,4,' Review: This sticker is a great option for special occasions, but it may not be suitable for everyday use. The material is durable and the instructions are clear, making it easy to apply. Overall, I would rate it 4 out of 5 stars.','POSITIVE'),(68,'en',9,15,3,' Review: The sticker is of good quality, but it can only be used on clean surfaces. Therefore, I would rate it 3 out of 5 stars.','POSITIVE'),(69,'en',9,16,5,' Review: 5/5 stars. This high-quality sticker is perfect for special occasions and can be used on any clean surface. The soft fabric makes it a great addition to any outfit.','POSITIVE'),(70,'en',9,17,3,' Review: This sticker is a good option for those looking for a high-quality sticker that can be used anywhere. However, it may not be suitable for washing surfaces as the instructions indicate. Overall, I would rate it 3 out of 5 stars.','POSITIVE'),(71,'en',10,4,2,' Review: These sneakers are not the best choice for someone who prefers soft fabrics. The cotton canvas material is not as comfortable as other materials, and the washing instructions are not suitable for someone who wants to keep their sneakers looking new. Overall, I would rate these sneakers a 2 out of 5 stars.','NEGATIVE'),(72,'en',10,8,3,' Review: These sneakers are made from high-quality cotton canvas and are perfect for everyday use. However, they could be more durable and have better washing instructions. Overall, I would rate them 3 out of 5 stars.','POSITIVE'),(73,'en',10,9,3,' Review: These sneakers are made from high-quality cotton canvas and are perfect for everyday use. However, they are not as durable as expected and may not hold up well with frequent washing. Overall, I would rate them 3 out of 5 stars.','POSITIVE'),(74,'en',10,10,1,' Review: 1/5 stars. Not suitable for special occasions. The material is not breathable enough for everyday use.','NEGATIVE'),(75,'en',10,13,2,' Review: These sneakers are not the best choice for someone looking for durable and long-lasting footwear. The cotton canvas material may not hold up well to frequent use and may require frequent replacement. Additionally, the washing instructions may not be suitable for someone who prefers to wash their clothes in hot water. Overall, I would not recommend these sneakers to someone who values durability and longevity in their footwear.','NEGATIVE'),(76,'en',10,15,5,' Review: These sneakers are perfect for everyday wear and made from high-quality cotton canvas. The XXL size fits comfortably and the washing instructions make them easy to care for. I highly recommend these sneakers and give them a well-deserved 5 out of 5 stars.','POSITIVE'); \ No newline at end of file diff --git a/genai-demos/data/create_tables.sql b/genai-demos/data/create_tables.sql new file mode 100644 index 0000000..0aa490c --- /dev/null +++ b/genai-demos/data/create_tables.sql @@ -0,0 +1,98 @@ +-- Copyright (c) 2024, Oracle and/or its affiliates. +-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + +-- using database ecommerce as an example + +CREATE DATABASE IF NOT EXISTS ecommerce; +USE ecommerce; + +DROP TABLE IF EXISTS `customers`; +CREATE TABLE `customers` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `first_name` varchar(50) NOT NULL, + `last_name` varchar(50) NOT NULL, + `email` varchar(100) DEFAULT NULL, + `phone` varchar(20) DEFAULT NULL, + `address` text, + `personality` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +DROP TABLE IF EXISTS `languages`; +CREATE TABLE `languages` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `language_code` varchar(10) NOT NULL, + `language_name` varchar(50) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `language_code` (`language_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +DROP TABLE IF EXISTS `orderitems`; +CREATE TABLE `orderitems` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `order_id` int unsigned DEFAULT NULL, + `product_id` int unsigned DEFAULT NULL, + `quantity` int DEFAULT NULL, + `price` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +DROP TABLE IF EXISTS `orders`; +CREATE TABLE `orders` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `customer_id` int unsigned DEFAULT NULL, + `order_date` date DEFAULT NULL, + `total` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +DROP TABLE IF EXISTS `productcategories`; +CREATE TABLE `productcategories` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) DEFAULT NULL, + `path` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +DROP TABLE IF EXISTS `productdescriptions`; +CREATE TABLE `productdescriptions` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `product_id` int unsigned DEFAULT NULL, + `language_code` varchar(10) DEFAULT NULL, + `description` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +DROP TABLE IF EXISTS `productdetails`; +CREATE TABLE `productdetails` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `product_id` int unsigned DEFAULT NULL, + `language_code` varchar(10) DEFAULT NULL, + `size` varchar(50) DEFAULT NULL, + `material` varchar(100) DEFAULT NULL, + `washing_instructions` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +DROP TABLE IF EXISTS `products`; +CREATE TABLE `products` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `price` decimal(10,2) NOT NULL, + `category` varchar(255) NOT NULL, + `image` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +DROP TABLE IF EXISTS `reviews`; +CREATE TABLE `reviews` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `language_code` varchar(10) DEFAULT NULL, + `product_id` int unsigned DEFAULT NULL, + `customer_id` int unsigned DEFAULT NULL, + `rating` int DEFAULT NULL, + `review_text` text, + `sentiment` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `reviews_chk_1` CHECK ((`rating` between 1 and 5)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; \ No newline at end of file diff --git a/genai-demos/install.sql b/genai-demos/install.sql new file mode 100644 index 0000000..b95cd20 --- /dev/null +++ b/genai-demos/install.sql @@ -0,0 +1,23 @@ +-- Copyright (c) 2024, Oracle and/or its affiliates. +-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + +SELECT "-- Installation: STARTED ---" AS ""; + +SELECT "-- Dropping database if exists ---" AS ""; + +DROP DATABASE IF EXISTS ecommerce; + +SELECT "-- Creating tables ---" AS ""; + +source data/create_tables.sql + +SELECT "-- Populating data ---" AS ""; + +source data/create_data.sql + +SELECT "-- Creating stored procedures ---" AS ""; + +source src/procedures.sql + +SELECT "-- Installation: DONE ---" AS ""; + diff --git a/genai-demos/run.sql b/genai-demos/run.sql new file mode 100644 index 0000000..5c468e7 --- /dev/null +++ b/genai-demos/run.sql @@ -0,0 +1,55 @@ +-- Copyright (c) 2024, Oracle and/or its affiliates. +-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + +USE ecommerce; + +SELECT "################### Computing summaries for EXISTING reviews on a product ###################" AS ""; +SELECT "" AS ""; + +CALL SUMMARIZE_TRANSLATE(1, "POSITIVE", "en", @positive_english_summary); +SELECT @positive_english_summary AS "--- English summary of positive reviews on the T-Shirt ---"; + +CALL SUMMARIZE_TRANSLATE(1, "NEGATIVE", "en", @negative_english_summary); +SELECT @negative_english_summary AS "--- English summary of negative reviews on the T-Shirt ---"; + +CALL SUMMARIZE_TRANSLATE(1, "POSITIVE", "es", @positive_spanish_summary); +SELECT @positive_spanish_summary AS "--- Spanish summary of positive reviews on the T-Shirt ---"; + +CALL SUMMARIZE_TRANSLATE(1, "NEGATIVE", "es", @negative_spanish_summary); +SELECT @negative_spanish_summary AS "--- Spanish summary of negative reviews on the T-Shirt ---"; + +SELECT '################### Insert a new review ###################' AS ''; + +SET @review='Review: The T-Shirt is fantastic as it is not only comfortable but it is also made of sustainable material. The organic cotton feels like normal cotton while being environment-friendly. However, the washing instruction is difficult to follow.'; +SET @review_id = 1337; + +SELECT @review AS ""; + +-- Insert a new review +INSERT INTO reviews(id, language_code, product_id, customer_id, rating, review_text) VALUES (@review_id,'en',1,20,4,@review); + +SELECT '################### Done: Insert a new review ###################' AS ''; +SELECT "" AS ""; + +-- Sentiment analysis +SELECT review_text INTO @review_text FROM reviews WHERE id = @review_id; +CALL SENTIMENT_ANALYSIS(@review_text, @review_id); +-- Check the updated sentiment column +SELECT @review AS "--- New review ---"; +SELECT sentiment AS "--- Sentiment of the new review ---" FROM reviews WHERE id = @review_id; + +SELECT "################### Computing summaries AFTER the review is inserted ###################" AS ""; +SELECT "" AS ""; + +-- Summarize the reviews +CALL SUMMARIZE_TRANSLATE(1, "POSITIVE", "en", @positive_english_summary); +SELECT @positive_english_summary AS "--- UPDATED English summary of positive reviews on the T-Shirt ---"; + +CALL SUMMARIZE_TRANSLATE(1, "NEGATIVE", "en", @negative_english_summary); +SELECT @negative_english_summary AS "--- UPDATED English summary of negative reviews on the T-Shirt ---"; + +CALL SUMMARIZE_TRANSLATE(1, "POSITIVE", "es", @positive_spanish_summary); +SELECT @positive_spanish_summary AS "--- UPDATED Spanish summary of positive reviews on the T-Shirt ---"; + +CALL SUMMARIZE_TRANSLATE(1, "NEGATIVE", "es", @negative_spanish_summary); +SELECT @negative_spanish_summary AS "--- UPDATED Spanish summary of negative reviews on the T-Shirt ---"; diff --git a/genai-demos/sonar-project.properties b/genai-demos/sonar-project.properties new file mode 100644 index 0000000..38ff60c --- /dev/null +++ b/genai-demos/sonar-project.properties @@ -0,0 +1,12 @@ +sonar.projectKey=oracle-devrel_heatwave-genai-demos +sonar.organization=oracle-devrel + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=test +#sonar.projectVersion=1.0 + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 \ No newline at end of file diff --git a/genai-demos/src/procedures.sql b/genai-demos/src/procedures.sql new file mode 100644 index 0000000..66d20bd --- /dev/null +++ b/genai-demos/src/procedures.sql @@ -0,0 +1,43 @@ +-- Copyright (c) 2024, Oracle and/or its affiliates. +-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ + +USE ecommerce; + +DROP PROCEDURE IF EXISTS SENTIMENT_ANALYSIS; +CREATE PROCEDURE SENTIMENT_ANALYSIS( + IN review TEXT, + IN review_id INT +) LANGUAGE JAVASCRIPT AS $$ + + let prompt = `Classify the review into NEGATIVE or POSITIVE \n${review}. + Please provide a single word to describe the sentiment: "POSITIVE" or "NEGATIVE". \nSentiment:`; + + let sentiment = ml.generate(prompt); + let processed_sentiment = sentiment.toUpperCase().search("POSITIVE") ? "POSITIVE" : "NEGATIVE"; + + let sql = session.prepare(`UPDATE reviews SET sentiment = ? WHERE id = ?`); + sql.bind(processed_sentiment, review_id).execute(); +$$; + +DROP PROCEDURE IF EXISTS SUMMARIZE_TRANSLATE; +CREATE PROCEDURE SUMMARIZE_TRANSLATE( + IN product_id INT, + IN sentiment VARCHAR(20), + IN language VARCHAR(64), + OUT processed_summary TEXT +) LANGUAGE JAVASCRIPT AS $$ + + let sql = session.prepare("SELECT review_text FROM reviews WHERE product_id = ? AND sentiment = ?"); + let reviews = sql.bind(product_id, sentiment).execute(); + let all_reviews = Array.from(reviews).map(review => review.review_text).join("\n"); + + let summary = ml.generate(all_reviews, {task: "summarization"}); + processed_summary = summary.trim(); + + if (language != "en") { + let prompt = `Translate the Original Text to ${language}. \n + - Original Text: "${processed_summary}"\n - ${language} Translation:`; + let translation = ml.generate(prompt, {model_id: "cohere.command-r-plus", max_tokens: 800, language: language}); + processed_summary = translation.split('\n')[0]; + } +$$; \ No newline at end of file