Prerequisites
Before you begin, ensure you have:- Java 17 or higher
- MySQL 8.0+
- Maven 3.6+
- curl or Postman for API testing
Quick Setup
Start MySQL Database
Create the database for the shipment service:The tables will be created automatically when you start the service.
Start the Semantic Service
Navigate to the semantic service directory and run:The service will start on port 8081 and create a
tdb_data/ directory for storing RDF triples.The semantic service must be running before the shipment service to enable automatic synchronization.
Start the Shipment Service
In a new terminal, navigate to the shipment service:The service will start on port 8080 and automatically:
- Create database tables
- Connect to the semantic service at
http://localhost:8081
Create Your First Shipment
Create a client first:Then create a shipment (assuming client ID 1, sucursales with IDs 1 and 2 exist):
The tracking code is auto-generated with format
ENV-{timestamp} and a 4-digit delivery password is created automatically.What Happens Behind the Scenes
When you create a shipment:- Shipment Service saves the data to MySQL
- Automatically sends the shipment data to Semantic Service
- Semantic Service converts it to RDF triples using the OWL ontology
- Stores triples in Apache Jena TDB for semantic querying
- Natural language queries are translated to SPARQL and executed against the knowledge graph
State Transitions
Shipments follow this lifecycle:Next Steps
Architecture Overview
Understand how the microservices communicate
Semantic Search Guide
Master natural language queries
SPARQL Queries
Write custom SPARQL queries
Ontology Reference
Explore the OWL ontology structure
Troubleshooting
Connection refused to semantic service
Connection refused to semantic service
Ensure the semantic service is running on port 8081 before starting the shipment service. Check the logs for connection errors.
MySQL authentication failed
MySQL authentication failed
Update credentials in
svc-envio-encomienda/src/main/resources/application.properties:No semantic search results
No semantic search results
The shipment may not have been synchronized to the semantic graph. Check if both services are running and try creating a new shipment.