How It Works
TheBusquedaSemanticaService (svc-web-semantica/src/main/java/org/jchilon3mas/springcloud/svc/web/semantica/svc_web_semantica/services/BusquedaSemanticaService.java:18) processes natural language:
Basic Search
Simple Queries
Response Format
Search by State
The system recognizes multiple Spanish terms for each state:PENDIENTE (Pending)
EN_TRANSITO (In Transit)
DISPONIBLE (Available)
ENTREGADO (Delivered)
CANCELADO (Canceled)
Search by Weight
Exact Weight
Weight Range
Greater Than
Less Than
Search by Date
Relative Dates
Exact Dates
Month and Year
Date Ranges
Search by Location
Destination City
Origin City
Supported Cities
The system recognizes these Peruvian cities:- Cajamarca
- Lima
- Cusco
- Arequipa
- Trujillo
- Piura
- Huanuco
- Ica
- Tacna
- Puno
- Chiclayo
Search by Identifiers
DNI (8 digits)
Phone Number (9 digits)
Tracking Code
Vehicle Plate
Package Dimensions
Search by Price
Combined Queries
Combine multiple criteria in one search:Free Text Search
Search in description and names:How Parameters are Extracted
TheBusquedaSemanticaService uses regex patterns to extract parameters (svc-web-semantica/src/main/java/org/jchilon3mas/springcloud/svc/web/semantica/svc_web_semantica/services/BusquedaSemanticaService.java:56):
Tracking Code
DNI (8 digits)
Weight Range
Date Relative
Generated SPARQL Examples
Example 1: “envios pendientes”
Extracted Parameters:- Estado:
PENDIENTE
Example 2: “entre 2 y 5 kg a Lima”
Extracted Parameters:- Peso min:
2 - Peso max:
5 - Ciudad destino:
lima
Example 3: “entregados hoy”
Extracted Parameters:- Estado:
ENTREGADO - Fecha contenido:
2026-03-09(today’s date)
Search Tips
Use Spanish Terms
The system is optimized for Spanish queries: “envios”, “pendientes”, “entre”, “desde”, etc.
Combine Criteria
You can combine multiple filters: state + weight + location + date
Case Insensitive
Searches are case-insensitive: “Lima” = “lima” = “LIMA”
Stopwords Removed
Common words like “el”, “la”, “de”, “que” are automatically filtered
Advanced Features
URL Encoding
When using curl, encode special characters:JavaScript/Fetch
Python Requests
Limitations
Performance
- Fast: Searches execute in milliseconds against TDB
- Scalable: Can handle millions of triples
- Indexed: SPARQL engine uses optimized indexes
Troubleshooting
No results returned
No results returned
Possible causes:
- No shipments match your criteria
- Semantic service not synchronized with MySQL data
- Typo in search terms
- Try broader search: just “pendientes”
- Sync all shipments:
POST /api/v1/envios/sincronizar-todos - Check spelling
Wrong results returned
Wrong results returned
Possible causes:
- Free text search matching unintended fields
- Date interpretation issue
- Be more specific with identifiers (DNI, tracking code)
- Use exact date formats: DD/MM/YYYY or YYYY-MM-DD
500 Internal Server Error
500 Internal Server Error
Possible causes:
- Malformed SPARQL query generated
- TDB corruption
- Check semantic service logs
- Restart semantic service
- Rebuild TDB: delete
tdb_data/, restart, resync
Next Steps
SPARQL Queries
Write custom SPARQL for advanced queries
Ontology Reference
Understand the semantic structure
Creating Shipments
Create data to search
Semantic Web Concepts
Learn the underlying technology