You will need Miniconda to manage dependencies and set up your environment. Download and install Miniconda by selecting the appropriate installer for your system (Windows, macOS, or Linux) from here.
After installation, confirm that Conda is installed:
conda --version
Once Miniconda is installed, use the provided environment.yml
file to create the environment. Alternatively, you can manually create the environment and install dependencies.
To create the environment directly:
conda env create -f environment.yml
To create the environment manually:
conda create -n spalod_env python=3.10
conda activate spalod_env
pip install django djangorestframework dj-rest-auth social-auth-app-django django-allauth pydeck rdflib pyproj folium shapely laspy
Activate the Conda environment using:
conda activate spalod_env
Make sure to use the exact environment name if specified differently in the environment.yml
file.
- With the environment activated, navigate to the project directory and run migrations:
python manage.py makemigrations spalod_app
python manage.py migrate
python manage.py createsuperuser
- Start the Django development server:
python manage.py runserver
Ensure that GraphDB is running and accessible at:
http://localhost:7200/repositories/Spalod
Register a new user:
curl -X POST http://127.0.0.1:8000/auth/registration/ -d "username=JJ&password1=GNybRXbC563&password2=GNybRXbC563"
Log in to obtain an authentication token:
curl -X POST http://127.0.0.1:8000/auth/login/ -d "username=JJ&password=GNybRXbC563"
Expected response:
{"key":"9b2b164be957dcfc9dcb399f91acc06d4b0f4228"}
Example SPARQL query request:
curl -X POST http://127.0.0.1:8000/api/sparql-query/ \
-H "Content-Type: application/json" \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228" \
-d '{"query": "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10"}'
To update ontology mappings with new properties and validation timestamps:
curl -X POST http://127.0.0.1:8000/api/update-ontology/ \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228" \
-H "Content-Type: application/json" \
-d '{
"mappings": [
{
"new_property": "http://your-ontology/newProperty1",
"old_property": "http://your-ontology/oldProperty1"
},
{
"new_property": "http://your-ontology/newProperty2",
"old_property": "http://your-ontology/oldProperty2"
}
]
}'
To retrieve properties that have a hasBeenValidatedBy
status of "none" or are missing this property:
curl -X GET http://127.0.0.1:8000/api/query-properties/ \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228"
Example file upload with associated metadata:
curl -X POST http://127.0.0.1:8000/api/upload-file/ \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228" \
-F "file=@/path/to/your/file.json" \
-F "metadata={\"description\": \"This is a shapefile\", \"source\": \"Survey XYZ\"}"
Response:
{
"message": "File uploaded and ontology processed successfully.",
"uuid": "04287a39-053d-435e-8064-a7664604edb9",
"ontology_url": "/media/uploads/04287a39-053d-435e-8064-a7664604edb9/04287a39-053d-435e-8064-a7664604edb9_ontology.owl",
"map_url": "/media/uploads/04287a39-053d-435e-8064-a7664604edb9/04287a39-053d-435e-8064-a7664604edb9_map.html"
}
To download:
curl -O http://127.0.0.1:8000/media/uploads/04287a39-053d-435e-8064-a7664604edb9/04287a39-053d-435e-8064-a7664604edb9_map.html
curl -X POST http://127.0.0.1:8000/api/upload-file/ \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228" \
-F "file=@/path/to/pointcloud.las" \
-F "metadata={\"description\": \"Pointcloud\", \"source\": \"BKG\"}"
Example SPARQL query:
curl -X POST http://localhost:8000/api/sparql-query/ \
-H "Content-Type: application/json" \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228" \
-d '{"query": "PREFIX geo: <http://www.opengis.net/ont/geosparql#> PREFIX ns2: <https://registry.gdi-de.org/id/hamburg/> PREFIX ex: <http://example.org/ns#> SELECT ?feature ?property ?value WHERE { ?feature a geo:Feature ; ?property ?value . }"}'
curl -X GET "http://127.0.0.1:8000/api/geo/catalog?id=http://spalod/catalog_acc53514-6a2f-4521-afa5-40783906d4ba" \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228"
curl -X GET "http://127.0.0.1:8000/api/geo/catalog/delete?id=http://spalod/catalog_acc53514-6a2f-4521-afa5-40783906d4ba" \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228"
curl -X GET "http://127.0.0.1:8000/api/geo/feature?id=https://registry.gdi-de.org/feature002755b6-8a27-4e58-a1e7-34635993696e&catalog_id=http://spalod/catalog_652579e3-1a45-4f6d-b55f-c4f1c1bfce20" \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228"
curl -X GET "http://127.0.0.1:8000/api/geo/getfeaturewkt?id=https://registry.gdi-de.org/feature002755b6-8a27-4e58-a1e7-34635993696e&catalog_id=http://spalod/catalog_652579e3-1a45-4f6d-b55f-c4f1c1bfce20" \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228"
curl -X GET "http://127.0.0.1:8000/api/geo/getwkt?catalog_id=http://spalod/catalog_652579e3-1a45-4f6d-b55f-c4f1c1bf
ce20" \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228"
curl -X GET "http://127.0.0.1:8000/api/geo/all" \
-H "Authorization: Token 9b2b164be957dcfc9dcb399f91acc06d4b0f4228"