This project is a proof of concept for a SPARQL AI Explorer. It is designed to be used with the ontop and Fuseki containers. The goal is to provide a web application that allows users to explore SPARQL queries and their results in a user-friendly way. Using an LLM based AI backend to help formulate valid SPARQL queries.
- Materialize tuples via ontop
- Fuseki Password
- Importing data into Fuseki
- Web application and AI backend setup
- Contributing
- License
To generate your own materialized tuples, you can use the ontop container. You will have to provide your own SQL database. The files in this repo can be used as a guide to start your own mapping. Once you have your own mapping, you can use the following command (substituting your own filenames) to generate the materialized tuples.
docker exec -it sparql-ai-explorer-ontop-1 /bin/bash -c 'ontop materialize --mapping=/tmp/ontop/odws.obda -t /tmp/ontop/odws.ttl --properties=/opt/ontop/configuration.properties -f turtle -o /tmp/ontop/odws-materialized.ttl'
Afterward, you can load the materialized tuples into the fuseki container.To prepare the date for loading move the file
to the fuseki/staging
folder.
Fuseki writes the generated Passwort to the console at first startup (of the container)
2025-01-16 16:58:58 ###################################
2025-01-16 16:58:58 Initializing Apache Jena Fuseki
2025-01-16 16:58:58
2025-01-16 16:58:58 Randomly generated admin password:
2025-01-16 16:58:58
2025-01-16 16:58:58 admin=password
2025-01-16 16:58:58
2025-01-16 16:58:58 ###################################
Usually it runs at http://localhost:3030/ .
- enter admin / password
- Add new Dataset
- Dataset name = odws
- Type = Persistent
- Execute "create dataset"
To load the data into the running fuseki container, you can use the following command:
docker exec -it sparql-ai-explorer-fuseki-1 /bin/bash -c './tdbloader2 --loc /fuseki/databases/odws /staging/odws-materialized.ttl'
Next add the dataset via the web interface, as persistent dataset.
SPARQL Queries:
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX parl: <http://opendata.parlament.ch/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?group ?name ?sn ?lan
WHERE {
?group a parl:group;
parl:wasNamed ?name.
?name parl:ShortName ?sn;
dc:language ?lan.
FILTER(?lan = "de"^^xsd:language)
}
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX parl: <http://opendata.parlament.ch/>
SELECT ?person ?property ?value
WHERE {
?person a parl:person ;
foaf:firstName ?firstName ;
foaf:familyName ?familyName ;
?property ?value .
FILTER(?firstName = "Carlo" && ?familyName = "Sommaruga")
}
Please read the corresponding README.md files under /ui and /aibackend
Your contributions are always welcome! Feel free to fork the repository and submit a pull request. If you have any questions or suggestions, please open an issue.
The Apache License Version 2.0, January 2004 - TI&M AG. Please have a look at the LICENSE for more details.