|
1 | 1 | # MApp-KG (Old Knowledge Graph Repository) |
2 | 2 |
|
3 | | -The *MApp-KG* is developed as a Java-based Spring Boot service using the RDF4J framework to build the hook with a GraphDB repository instance. |
| 3 | +MApp-KG is a Java-based Spring Boot service that utilizes the RDF4J framework to interact with a **GraphDB repository instance**. |
4 | 4 |
|
5 | | -## Description |
| 5 | +## 📌 Description |
6 | 6 |
|
7 | | -This software component provides an API for querying, updating, and extracting knowledge from a graph database. |
| 7 | +This component provides a **REST API** for querying, updating, and extracting knowledge from a graph database. |
8 | 8 |
|
9 | | -## Used Technologies |
| 9 | +## 🛠️ Used Technologies |
10 | 10 |
|
11 | 11 | | Component | Description | Version | |
12 | 12 | |-------------|---------------------------------------------------------------------------------------|---------| |
13 | | -| Spring Boot | Collection of Java libraries for creating REST APIs | 2.7.1 | |
14 | | -| RDF4J | Java library for manipulating RDF graphs | 3.0.0 | |
15 | | -| GraphDB | GraphDB is an enterprise-ready Semantic Graph Database, compliant with W3C Standards. | 10.1.0 | |
| 13 | +| **Spring Boot** | Java framework for creating REST APIs | 2.7.1 | |
| 14 | +| **RDF4J** | Java library for manipulating RDF graphs | 3.0.0 | |
| 15 | +| **GraphDB** | Enterprise-ready **Semantic Graph Database**, compliant with W3C standards | 10.1.0 | |
16 | 16 |
|
17 | | -## How to Configure |
| 17 | +## ⚙️ Configuration |
18 | 18 |
|
19 | | -Configure the GraphDB connection by setting the proper values for `db.url`, `db.username`, and `db.password` in `src/main/resources/application.properties` and `src/main/resources/application-gessi.properties` (if you use docker) or and `src/main/resources/application-localhost.properties` (if you use localhost). |
| 19 | +To configure the **GraphDB connection**, set the appropriate values for: |
20 | 20 |
|
21 | | -Configure the RML file path by setting the proper value for `rml.path` to use a custom RML file for schema integration. |
| 21 | +- `db.url` |
| 22 | +- `db.username` |
| 23 | +- `db.password` |
22 | 24 |
|
23 | | -## How to Build |
| 25 | +These values should be updated in the respective properties files: |
24 | 26 |
|
25 | | -To build the project, run the following command: |
| 27 | +- **Docker deployment**: `src/main/resources/application-gessi.properties` |
| 28 | +- **Localhost deployment**: `src/main/resources/application-localhost.properties` |
| 29 | + |
| 30 | +To set a custom **RML file path**, configure `rml.path` accordingly. |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## 🚀 How to Build |
| 35 | + |
| 36 | +To build the project, run: |
26 | 37 |
|
27 | 38 | ```sh |
28 | 39 | mvn clean install package |
29 | 40 | ``` |
30 | 41 |
|
31 | | -## How to Use |
| 42 | +## ▶️ How to Run |
32 | 43 |
|
33 | | -To run the service using Java from the generated package (`.jar`), run the following command: |
| 44 | +### **Run using Java** |
34 | 45 |
|
35 | 46 | ```sh |
36 | 47 | java -jar target/repo-0.0.1-SNAPSHOT.jar |
37 | 48 | ``` |
38 | 49 |
|
39 | | -To deploy the service in a Docker container, follow these steps: |
| 50 | +### **Deploy using Docker** |
40 | 51 |
|
41 | | -### Build Docker Image |
| 52 | +#### **Step 1: Build Docker Image** |
42 | 53 | ```sh |
43 | | -docker build -t kg_repository . |
| 54 | +docker build -t mapp-kg . |
44 | 55 | ``` |
45 | 56 |
|
46 | | -### Run Docker Container |
| 57 | +#### **Step 2: Run Docker Container** |
47 | 58 | ```sh |
48 | | -docker run -d -p 3003:3003 --name KG_Repository kg_repository |
| 59 | +docker run -d -p 3003:3003 --name MApp-KG \ |
| 60 | + -e DB_USERNAME=my_db_user \ |
| 61 | + -e DB_PASSWORD=my_db_password \ |
| 62 | + -e REPO_NAME=my_repo_name \ |
| 63 | + mapp-kg |
49 | 64 | ``` |
50 | 65 |
|
51 | | -## How to Deploy (New Method) |
| 66 | +--- |
| 67 | + |
| 68 | +## 🌍 How to Deploy (New Method) |
52 | 69 |
|
53 | | -### Step 1: Pull Image |
| 70 | +### **Step 1: Pull Image from Repository** |
54 | 71 | ```sh |
55 | 72 | docker pull mtiessler/kg_repository:latest |
56 | 73 | ``` |
57 | 74 |
|
58 | | -### Step 2: Build Image (if needed) |
| 75 | +### **Step 2: Build Image (if needed)** |
59 | 76 | ```sh |
60 | 77 | docker build -t mtiessler/kg_repository:latest . |
61 | 78 | ``` |
62 | 79 |
|
63 | | -### Step 3: Create `kg_repository.env` File |
64 | | -This file contains the credentials required to access the SPARQL database. |
65 | | -The `.env` file must be in the same directory where the commands are executed. |
| 80 | +### **Step 3: Create `.env` File** |
| 81 | + |
| 82 | +Create a file named `kg_repository.env` in the same directory where you execute the Docker commands. This file should contain: |
66 | 83 |
|
67 | 84 | ``` |
68 | 85 | DB_USERNAME=username |
69 | 86 | DB_PASSWORD=password |
70 | 87 | ``` |
71 | 88 |
|
72 | | -## Features |
73 | | - |
74 | | -The API of the MAPP-KG is available in the [Postman Collection](https://www.postman.com/gessi-fib-upc/gessi-nlp4se/collection/ak3s503/mapp-kg-old-app-repo?action=share&source=copy-link&creator=32448387) |
75 | | - |
76 | | -### Main Data Import Methods: |
77 | | -- **Add Mobile Apps (JSON format)**: Store a list of mobile apps using a JSON Array of mobile apps as the body of the HTTP request. See the Swagger documentation for the schema. |
78 | | -- **Add Mobile Apps (RDF format)**: Store all triples within a given RDF file. |
79 | | -- **Add Mobile Apps (RML-based)**: Store all mobile apps extracted from a JSON file using a given RML mapping instance. |
80 | | - |
81 | | -### Inductive Knowledge Generation: |
82 | | -- **Extract Features**: Send a `POST` request to `/derivedNLFeatures` with textual data (descriptions, summaries, changelogs, and/or reviews) to extract potential app features. |
83 | | - - **Query parameters:** |
84 | | - - `documentType`: Type of document to be processed (DESCRIPTION, SUMMARY, CHANGELOG, REVIEWS, USER_ANNOTATED, ALL). |
85 | | - - `batch-size`: Number of documents processed at once. |
86 | | - - `from`: Offset to start processing from the nth document. |
87 | | - - (Optional) `maxSubj`: Subjectivity threshold (reviews above this won't be processed). |
88 | | -- **Feature Similarity Matching**: Send a `POST` request to `/computeFeatureSimilarity` to find and match synonyms between app features. |
89 | | - - Accepts a `threshold` parameter (between 0 and 1, default is 0.5). |
90 | | -- **Undo Feature Synonymy**: Send a `DELETE` request to `/deleteFeatureSimilarities` to undo feature synonymy computed with `/computeFeatureSimilarity`. |
91 | | - |
92 | | -## File Structure |
93 | | - |
94 | | -- `src/main/java/upc/edu/gessi/repo` |
95 | | - - **AppGraphRepoApplication.java**: Main class. |
96 | | - - **Controller Package**: Handles HTTP requests. |
97 | | - - `GraphDBController.java`: Logic for storing and retrieving data from the GraphDB repository. |
98 | | - - `InductiveKnowledgeController.java`: Auxiliary repository handling extended knowledge generation. |
99 | | - - **Domain Package**: Contains domain-specific entities. |
100 | | - - **Service Package**: Business logic and database interaction. |
101 | | - - `GraphDBService.java`: Main service containing methods for querying and updating the database. |
102 | | - - `NLFeatureService.java`: Auxiliary service that communicates with a remote NL service for feature extraction. |
103 | | - - **Utils Package**: Auxiliary functions. |
104 | | - |
105 | | -## RDF Graph Example |
106 | | - |
107 | | -You can find an RDF graph instance already populated with app info in [statements.zip](https://github.com/gessi-chatbots/app_data_repository/tree/master/data). |
108 | | - |
109 | | -The data was originally obtained using the [App Data Scanner Service](https://github.com/gessi-chatbots/app_data_scanner_service). |
110 | | - |
111 | | -App info includes: |
112 | | -- Package name |
113 | | -- Description |
114 | | -- Summary |
115 | | -- Changelog |
116 | | -- Reviews |
117 | | -- Annotated features |
| 89 | +--- |
| 90 | + |
| 91 | +## 🔗 API Documentation |
| 92 | + |
| 93 | +The API of MApp-KG is available in the **Postman Collection**: |
| 94 | +[Postman Collection - MApp-KG](https://www.postman.com/gessi-fib-upc/gessi-nlp4se/collection/ak3s503/mapp-kg-old-app-repo?action=share&source=copy-link&creator=32448387) |
| 95 | + |
| 96 | +--- |
| 97 | + |
0 commit comments