The aim of this little project is to build an application that integrates different point of interest (POI) which are geospatial data from mutiple sources.
The 3 data sources were downloaded from the public data plateform of France:
- Museums - https://www.data.gouv.fr/fr/datasets/liste-et-localisation-des-musees-de-france
- Public Libraries - https://www.data.gouv.fr/fr/datasets/adresses-des-bibliotheques-publiques-1
- Higher Education Libraries - https://www.data.gouv.fr/fr/datasets/bibliotheques-de-lenseignement-superieur
The ontology was modelled with Protégé then populated using rdf structure generated from the json files
SPARQL queries can be found here
This project is written in java and python:
- Java -> execute SPARQL queries, store the result in a json file and run the python script
- Python -> script loads the output.json file just generated and build a map corresponding to the query (the map is stored in map.html)
- 1️⃣ Set up the environment:
- 2️⃣ Set up path in JenaEngine.java:
- 3️⃣ Set up path in map.py:
- 4️⃣ Make sure folium library is installed
- 5️⃣ Get back to Java IDE and run main.java file
- 6️⃣ Select one POI query in console
- 7️⃣ Be patient and go to Map folder
- 8️⃣ Open map.html
- 9️⃣ Enjoy 😄
When running the main.java file, the following menu appears:
- 1 - List the instances of the geolocated POI
- 1 - The musees
- 2 - The public libraries
- 3 - The higher education libraries
- 2 - List the name of all POI, for each one, display its city
- 1 - The musees
- 2 - The public libraries
- 3 - The higher education libraries
- 3 - List the name of the trip that have Paris (or any other chosen city) as destination.
- 4 - List the name of travellers older than 51 years
- 5 - A query that contains at least 2 Optional Graph Patterns
- 6 - A query that contains at least 2 alternatives and conjunctions
- 7 - A query that contains a CONSTRUCT query form
- 8 - A query that contains a ASK query form
- 9 - A query that contains a DESCRIBE query form
- 10 - Find the musees in the city you want
- 11 - Find the public libraries in the city you want
- 12 - Find the higher education libraries in the city you want
- 13 - Display the list of travel achieved by the traveller you want
- 14 - Observe the list of the POI visited by the traveller you want
Let's take the public libraries of Paris for example.
The user choose the Query 11 and enters Paris
The following SPARQL query is written in query.txt
PREFIX ns: <http://www.owl-ontologies.com/unnamed.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ex: <http://www.semanticweb.org/mt181547/ontologies/2022/2/untitled-ontology-13#>
SELECT ?name ?adress ?zipcode ?lat ?long WHERE {
?pl rdf:type ex:PublicLibrary .
?pl ex:hasName ?name .
?pl ex:hasCommune 'Paris' .
?pl ex:hasAdress ?adress .
?pl ex:hasZipCode ?zipcode .
?pl ex:hasLatitude ?lat .
?pl ex:hasLongitude ?long
}
The java program execute the query and store the result in a json file.
Then, the python script is runned and produces the following map
The user choose the Query 14 and enters Marie
The following SPARQL query is written in query.txt
PREFIX ns: <http://www.owl-ontologies.com/unnamed.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ex: <http://www.semanticweb.org/mt181547/ontologies/2022/2/untitled-ontology-13#>
SELECT DISTINCT ?name ?city ?lat ?long WHERE {
?traveller rdf:type ex:Traveller .
?traveller ex:Name 'Marie' .
?traveller ex:Visit ?poi .
?poi ex:hasName ?name .
?poi ex:hasCommune ?city .
?poi ex:hasLatitude ?lat .
?poi ex:hasLongitude ?long .
}";
The java program execute the query and store the result in a json file.
Then, the python script is runned and produces the following map
Now, the user enters Alain
The following SPARQL query is written in query.txt
PREFIX ns: <http://www.owl-ontologies.com/unnamed.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ex: <http://www.semanticweb.org/mt181547/ontologies/2022/2/untitled-ontology-13#>
SELECT DISTINCT ?name ?city ?lat ?long WHERE {
?traveller rdf:type ex:Traveller .
?traveller ex:Name 'Marie' .
?traveller ex:Visit ?poi .
?poi ex:hasName ?name .
?poi ex:hasCommune ?city .
?poi ex:hasLatitude ?lat .
?poi ex:hasLongitude ?long .
}";
Again, the following map is generated
- TEMPO Chloé - @chlotmpo
- TRARIEUX Thibaud - @thibaudtrx
- THIBAUT Matthieu - @MatthieuThib