Skip to content

🏛 An application that integrates different point of interest which are geospatial data from multiple sources.

Notifications You must be signed in to change notification settings

chlotmpo/CultureOntologyApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Culture Ontology App

💡 Project

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:

The ontology was modelled with Protégé then populated using rdf structure generated from the json files

SPARQL queries can be found here

📝 How it works

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)

🔍 How to use it

  • 1️⃣ Set up the environment:
    • Open the project in a Java IDE (Eclipse for example)
    • Make sure to add Jena and json libraries to the project.
  • 2️⃣ Set up path in JenaEngine.java:
    • Line 140: FileWriter("ABSOLUTE\PATH\TO\...Map\output.json");
    • Line 146: Runtime.getRuntime().exec(new String[] {"PATH\TO\python.exe", "ABSOLUTE\PATH\TO\...Map\map.py"});
  • 3️⃣ Set up path in map.py:
    • Line 5: data = json.load(open(r"ABSOLUTE\PATH\TO\...Map\output.json"))
    • Line 44: map.save(r"ABSOLUTE\PATH\TO\...Map\map.html")
  • 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 😄

Queries:

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

Example

Public Libraries of Paris

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

POI visited by a Traveller

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

👏 Contributors

About

🏛 An application that integrates different point of interest which are geospatial data from multiple sources.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published