The creation of geospatial enhancements to an existing digital infrastructure that will allow users to link to other scholarship, generate new research, and publish findings.
Metapolis aims to develop a digital research infrastructure to support scholarship in the humanities that seeks to geospatially reconstruct places throughout time. As an interactive map-based publication platform, it enables users to cross-pollinate archival, bibliographic and multimedia sources with interpretive research, allowing for their interlinking and visualization on a map. Built on top of ResearchSpace, an open-source Semantic Web research environment, it facilitates the reuse and publishing of Linked Open Data. A rich set of features support data enrichment with external knowledge bases such as VIAF, WikiData, OCLC, and the Getty vocabularies. Designed both as a research and publication tool, the software allows groups of scholars from a wide range of humanistic disciplines to connect their research and augment each other's findings through the layering of historical maps, interlinking them to sources to allow users to build knowledge about the world and its history.
For detailed technical specifications and additional documentation, see the wiki.
- Overview
- Prerequisites
- Quickstart Guide
- Next Steps
- Contributing
- Acknowledgements
- Technical Specifications
Metapolis is a ResearchSpace application that provides geospatial visualization and data management capabilities for humanities research. The platform enables scholars to:
- Create and manage geospatial entities (Buildings, Events, People, Sources)
- Link archival sources to buildings and geographical locations
- Visualize historical data on interactive maps
- Connect research findings through semantic relationships
- Publish and share Linked Open Data
The application integrates with PostgreSQL/PostGIS for spatial data storage and leverages ResearchSpace's semantic web infrastructure for knowledge management.
Before installing Metapolis, ensure you have:
- ResearchSpace Platform: Version 4.0 or later installed and running
- Docker & Docker Compose: For database setup (see Docker documentation)
- Basic Knowledge: Familiarity with SPARQL queries and semantic web concepts is helpful
- System Requirements: Sufficient resources to run ResearchSpace and PostgreSQL containers
This comprehensive guide will walk you through the complete setup process for Metapolis, from initial installation to creating your first geospatial entities.
This initial step ensures that the Metapolis application is properly integrated with your ResearchSpace instance.
- Download ResearchSpace: Obtain ResearchSpace version 4.0 or later from the official repository
- Follow Installation Instructions: Complete the ResearchSpace installation process according to the official documentation
- Start the Instance: Launch your ResearchSpace instance and verify it's running correctly
- Access the Platform: Navigate to your ResearchSpace instance in a web browser (typically
http://localhost:10214)
-
Clone the Metapolis Repository:
git clone https://github.com/villaitatti/metapolis.git
-
Add App to ResearchSpace: Follow the Official ResearchSpace documentation for adding apps to your instance.
-
Verify App Installation:
- Navigate to the Admin page by clicking the System Settings button (gear icon) in the top right corner
- Select "Apps & Storages" in the System Management group
- Verify that Metapolis appears in the list of installed apps
- Confirm the app status shows as "Active" or "Connected"
The setup repository contains essential configuration files and database initialization scripts:
-
Clone the Setup Repository:
git clone https://github.com/villaitatti/metapolis_setup.git cd metapolis_setup -
Review Directory Structure: Familiarize yourself with the provided files:
configurations/- ResearchSpace configuration filesmetapolis-db/- Database setup scripts and Docker configurationREADME.md- Detailed setup instructions
This repository will be used extensively in the following steps for configuring your Metapolis instance.
This step establishes the semantic foundation for Metapolis by importing ontology definitions and entity configurations into your ResearchSpace instance.
-
Navigate to Data Import: Access the import interface using one of these methods:
- Direct URL: Navigate to
resource/Admin:DataImportExport - Via Settings: Click the System Settings button (gear icon) → Select "Data Import & Download" from the menu
- Direct URL: Navigate to
-
Prepare for Import: Ensure you have the configuration files from the
metapolis_setup/configurationsfolder ready
The ontology file defines the conceptual framework for all Metapolis entities:
- Locate the File: Find
Metapolis_Ontology.trigin themetapolis_setup/configurations/directory - Upload the File:
- Click the "Choose File" or "Browse" button in the import interface
- Select
Metapolis_Ontology.trig
- Configure Import Options:
- ✅ Check "Keep source named graphs" to preserve the ontology structure
- This ensures proper namespace and graph organization
- Execute Import: Click "Import" and wait for confirmation
- Verify Success: Check for success message indicating the ontology was imported
What This File Contains:
- Base entity class:
metapolis_ontology:Metapolis_Entity - Four main entity types: Building, Event, Person, Source
- OWL-compliant class hierarchies
- Multilingual labels and descriptions
The entity configuration file connects the ontology to ResearchSpace forms and navigation:
- Locate the File: Find
Metapolis_Entity.trigin themetapolis_setup/configurations/directory - Upload the File:
- Click "Choose File" or "Browse" again
- Select
Metapolis_Entity.trig
- Configure Import Options:
- ✅ Check "Keep source named graphs" to maintain entity relationships
- Execute Import: Click "Import" and wait for confirmation
- Verify Success: Confirm the import completed without errors
What This File Contains:
- Entity definitions for all four Metapolis types
- Form connections linking entities to semantic forms
- Navigation integration for the Finder interface
- Search and list view configurations
- Metadata tracking using CIDOC-CRM standards
After importing both files, verify the configuration is active:
-
Check the Finder Sidebar: Look for the following entities in the left sidebar:
- Metapolis Building
- Metapolis Event
- Metapolis Person
- Metapolis Source
-
Test Entity Access: Click on any entity type to verify it opens without errors
-
Verify Forms: Try clicking "New [Entity Type]" to ensure forms are properly connected
If entities don't appear, try refreshing the page or restarting the ResearchSpace instance. If it still not showing up, please write a issue describing the problem.
Metapolis requires a PostgreSQL database with PostGIS extension for storing and querying geospatial data. This step guides you through setting up the database using Docker.
From the metapolis_setup repository you cloned in Step 0:
cd metapolis_setup/metapolis-dbThis directory contains all necessary files for database setup:
docker-compose.yml- Container configuration.env.template- Environment variables templateinit-scripts/- Automatic database initialization scripts
Before launching the database, configure your credentials and settings:
-
Create Environment File:
cp .env.template .env
-
Edit the
.envFile: Open the file in your preferred text editor and configure:# Database Configuration POSTGRES_DB=metapolis POSTGRES_USER=postgres POSTGRES_PASSWORD=your_secure_password_here # Authentication Method POSTGRES_HOST_AUTH_METHOD=md5 # Use md5 or scram-sha-256 for production
-
Update Repository Configuration: The database credentials must be synchronized in two locations:
- Metapolis Setup: Update the
.envfile inmetapolis_setup/metapolis-db/.env(completed in step 2 above) - Metapolis Repository: Update the repository configuration in the Metapolis app at
config/repositories/metapolis.ttl
In the
metapolis.ttlfile, update the connection parameters to match your.envvalues:sql:jdbcUrl "jdbc:postgresql://localhost:5432/metapolis" ; sql:username "postgres" ; sql:password "your_secure_password_here" ;
Important: Both files must have matching credentials for the connection to work properly.
- Metapolis Setup: Update the
-
Security Considerations:
- Development: You can use
trustauthentication for local testing - Production: Always use
md5orscram-sha-256with strong passwords - Password Strength: Choose a unique, complex password for
POSTGRES_PASSWORD - File Security: The
.envfile is git-ignored to prevent credential exposure - Credential Sync: Always update both locations when changing database credentials
- Development: You can use
The init-scripts/ directory contains three SQL scripts that run automatically on first startup:
-
01-init-database.sql:- Enables PostGIS and PostGIS Topology extensions
- Creates the
metapolisschema for organized data storage - Configures search paths for efficient queries
-
02-create-buildings-table.sql:- Defines the Buildings table structure with geometry support
- Creates spatial indexes for efficient geospatial queries
- Sets up automatic timestamp tracking
-
03-insert-sample-buildings.sql:- Inserts 5 famous Florence buildings as sample data
- Provides realistic coordinates and building functions
- Includes verification queries for data validation
Start the PostgreSQL container with PostGIS:
# Ensure you're in the metapolis-db directory
cd metapolis_setup/metapolis-db
# Start the database services
docker-compose up -dWhat Happens During Startup:
- Docker pulls the
postgis/postgis:15-3.3image (if not already present) - Creates a container named
metapolis-postgres - Executes initialization scripts in alphabetical order
- Sets up PostGIS extensions and sample data
- Exposes the database on port 5432
After the container starts, verify everything is working correctly:
-
Check Container Status:
docker ps | grep metapolis-postgresYou should see the container running with status "Up"
-
Test Database Connection:
docker exec -it metapolis-postgres psql -U postgres -d metapolis -c "SELECT version();"
This should return the PostgreSQL version information
-
Verify PostGIS Installation:
docker exec -it metapolis-postgres psql -U postgres -d metapolis -c "SELECT PostGIS_Version();"
This should return the PostGIS version (e.g., "3.3")
-
Check Buildings Table:
docker exec -it metapolis-postgres psql -U postgres -d metapolis -c "\dt metapolis.*"
You should see the
buildingstable listed -
Verify Sample Data:
docker exec -it metapolis-postgres psql -U postgres -d metapolis -c "SELECT name, function FROM metapolis.buildings;"
This should return the 5 Florence buildings (Palazzo Vecchio, Duomo, etc.)
Problem: Container Already Exists
If you see "Container already exists" or initialization scripts don't run:
# Stop and remove the container
docker-compose down
# Remove the persistent volume (⚠️ This deletes existing data)
docker volume rm metapolis-db_postgres_data
# Verify volume is removed
docker volume ls | grep metapolis
# Start fresh
docker-compose up -dProblem: Connection Refused
If you can't connect to the database:
- Verify the container is running:
docker ps - Check logs for errors:
docker-compose logs -f postgres - Ensure port 5432 is not already in use
- Verify your
.envfile has correct credentials
Problem: Scripts Not Executing
If sample data is missing:
- Check container logs:
docker-compose logs postgres - Manually execute scripts (see metapolis_setup README for details)
- Verify scripts have proper line endings (Unix format, not Windows)
For detailed troubleshooting, refer to the metapolis_setup repository README.
Congratulations! Your Metapolis system is now up and running with a properly configured database. You can proceed to the next steps to test queries and start creating geospatial entities.
Important Security Note: For production systems, make sure to update the default database password to a strong, unique password in both config/repositories/metapolis.ttl and metapolis_setup/metapolis-db/.env files.
After completing the basic setup (Steps 0-2), you can proceed with testing and using your Metapolis instance.
This step verifies that ResearchSpace can successfully query the PostgreSQL/PostGIS database and retrieve geospatial data. You'll test both direct repository queries and federated queries.
-
Navigate to SPARQL Interface:
- Go to
/sparqlin your ResearchSpace instance - Or click "SPARQL" from the main navigation menu
- Go to
-
Select Repository:
- In the repository dropdown, select "metapolis"
- This connects to the PostgreSQL database you configured
Test the connection with a simple query that retrieves all buildings:
-
Enter the Query: Copy and paste this SPARQL query into the editor:
PREFIX rs_sql_sail: <http://www.researchspace.org/resource/system/sql#> PREFIX metapolis_sql: <http://www.researchspace.org/resource/system/service/metapolis_sql#> SELECT * WHERE { ?s rs_sql_sail:hasQueryId "all_buildings"; metapolis_sql:building_id ?building_id; metapolis_sql:name ?name; metapolis_sql:function ?function; metapolis_sql:wkt ?wkt }
-
Select the repository "Metapolis"
-
Execute the Query: Click the "Execute" button
-
Verify Results: You should see results containing:
building_id: Unique identifier for each buildingname: Building names (e.g., "Palazzo Vecchio", "Duomo di Firenze")function: Building types (e.g., "Government", "Religious")wkt: Well-Known Text geometry representation (polygon coordinates)
-
Expected Results: The query should return 5 rows representing the Florence sample buildings
What This Query Does:
- Uses the SQL Sail bridge to query PostgreSQL directly from SPARQL
- Executes the predefined
all_buildingsquery from the service configuration - Retrieves building data including spatial geometry in WKT format
- Demonstrates the integration between semantic web and relational database
At this point the system is running and you can navigate the map.
TODO: add here information on how to navigate the map
To enable querying Metapolis data from other repositories in your ResearchSpace instance, configure Ephedra federation:
-
Navigate to Repository Configuration:
- Go to System Settings (gear icon) → "System Configurations"
- Select "Repositories" from the configuration menu
-
Locate Federation Configuration:
- Find the
fedsail:memberconfiguration section - This defines which repositories participate in federated queries
- Find the
-
Add Metapolis to Federation:
- Scroll to the last element in the
fedsail:memberlist - Append this configuration after the last element (note the comma before the opening bracket):
, [ ephedra:delegateRepositoryID "metapolis"; ephedra:serviceReference <http://www.researchspace.org/resource/system/repository/federation#metapolis> ] - Scroll to the last element in the
-
Save Configuration:
- Click "Update" or "Save" to apply changes
- The system may require a restart to activate the new configuration
-
Verify Federation: Check that the configuration was saved without syntax errors
Why This Matters:
- Enables cross-repository queries combining Metapolis spatial data with other semantic data
- Allows integration with external knowledge bases (VIAF, Wikidata, Getty vocabularies)
- Supports complex queries that join geospatial and non-geospatial information
Now test that you can access Metapolis data from the federated repository:
-
Switch Repository: In the SPARQL interface, select the "ephedra" repository (or your default federated repository)
-
Enter Federated Query: Copy and paste this query:
PREFIX rs_sql_sail: <http://www.researchspace.org/resource/system/sql#> PREFIX metapolis_sql: <http://www.researchspace.org/resource/system/service/metapolis_sql#> SELECT * WHERE { SERVICE <http://www.researchspace.org/resource/system/repository/federation#metapolis> { ?s rs_sql_sail:hasQueryId "all_buildings"; metapolis_sql:building_id ?building_id; metapolis_sql:name ?name; metapolis_sql:function ?function; metapolis_sql:wkt ?wkt } }
-
Execute the Query: Click "Execute"
-
Verify Results: You should see the same building data as before, but now queried through the federation layer
Understanding the Federated Query:
- The
SERVICEclause directs the query to the metapolis repository - The federation layer handles routing and result aggregation
- This pattern allows combining Metapolis data with other data sources in a single query
- You can now join building data with entities from other repositories
The Metapolis service configuration includes 15+ predefined queries. Try these examples:
Query Buildings by Function:
PREFIX rs_sql_sail: <http://www.researchspace.org/resource/system/sql#>
PREFIX metapolis_sql: <http://www.researchspace.org/resource/system/service/metapolis_sql#>
SELECT * WHERE {
?s rs_sql_sail:hasQueryId "buildings_by_function";
rs_sql_sail:hasParameter [
rs_sql_sail:parameterName "function_type";
rs_sql_sail:parameterValue "Religious"
];
metapolis_sql:building_id ?building_id;
metapolis_sql:name ?name;
metapolis_sql:function ?function;
metapolis_sql:wkt ?wkt
}Query Buildings Near a Point:
PREFIX rs_sql_sail: <http://www.researchspace.org/resource/system/sql#>
PREFIX metapolis_sql: <http://www.researchspace.org/resource/system/service/metapolis_sql#>
SELECT * WHERE {
?s rs_sql_sail:hasQueryId "buildings_near_point";
rs_sql_sail:hasParameter [
rs_sql_sail:parameterName "longitude";
rs_sql_sail:parameterValue "11.2558"
];
rs_sql_sail:hasParameter [
rs_sql_sail:parameterName "latitude";
rs_sql_sail:parameterValue "43.7696"
];
rs_sql_sail:hasParameter [
rs_sql_sail:parameterName "distance_meters";
rs_sql_sail:parameterValue "500"
];
metapolis_sql:building_id ?building_id;
metapolis_sql:name ?name;
metapolis_sql:distance ?distance
}These queries demonstrate the power of combining SPARQL with spatial SQL queries for geospatial analysis.
Once you've verified that database queries work correctly, you can start creating Building entities in Metapolis and linking them to geographical features in your PostGIS database. This step demonstrates the core workflow for managing geospatial data.
Before creating buildings, ensure:
- ✅ Steps 1-3 are completed successfully
- ✅ PostGIS database contains geographical features (buildings, monuments, etc.)
- ✅ You have feature names ready for linking
- ✅ The Finder sidebar shows Metapolis entities
The Finder is your primary navigation tool for managing Metapolis entities:
- Locate the Finder Sidebar: Look for the left sidebar in your ResearchSpace interface
- Find Metapolis Entities: Scroll to locate the Metapolis entity types
- Verify Access: Ensure you can see all four entity types (Building, Event, Person, Source)
-
Select Building Entity Type:
- In the Finder sidebar, locate and click on "Metapolis Building"
- This opens the Buildings list view showing existing building entities
-
Initiate Creation:
- Click the "New Metapolis Building" button (typically blue and prominent)
- This opens the Building creation form with all available fields
-
Understand the Form Structure: The form includes several sections:
- Basic Information: Name, description, and classification
- Relationships: Connections to other entities (Events, People, Sources)
- Spatial Data: Link to PostGIS geographical features
- Metadata: Creation date, contributors, and provenance information
This is the critical step that connects semantic entities to geospatial data:
-
Understand the Connection:
- Your PostGIS database contains geographical features (polygons, points) representing physical buildings
- These features may not yet be linked to Metapolis Building entities
- For example, "Galleria degli Uffizi" might exist in PostGIS but not as a Metapolis entity
-
Find the Feature Field:
- Locate the "Has Related Feature" field in the Building creation form
- This field provides autocomplete functionality connected to the PostGIS database
-
Search for Features:
- Start typing the name of the geographical feature (e.g., "Galleria degli Uffizi")
- As you type, the system queries the PostGIS database in real-time
- A dropdown appears showing matching features from the database
-
Select the Feature:
- Review the suggestions and select the appropriate feature
- The system will link the Building entity to the selected PostGIS geometry
- The spatial coordinates and geometry are now associated with your entity
Fill in additional information to enrich your Building entity:
-
Required Fields:
- Name: The building's common name (e.g., "Galleria degli Uffizi")
- Has Related Feature: The PostGIS feature link (completed in step 4.4)
-
Optional Fields:
- Function: Building type or purpose (e.g., "Museum", "Government", "Religious")
- Related Events: Link to historical events that occurred at this location
- Related People: Connect to people associated with the building
- Related Sources: Link to archival sources, documents, or references
- Description: Additional context and historical information
- Time Period: When the building was constructed or in use
-
Save the Entity:
- Review all entered information for accuracy
- Click "Create Metapolis Building" to save the entity
- Wait for confirmation that the entity was created successfully
After creating the building, verify everything is working correctly:
-
Check Entity Page:
- The system should redirect you to the new Building entity's page
- Verify all information displays correctly
-
View on Map:
- Navigate to map visualization components
- The building should appear on the map at its correct location
- The spatial data from PostGIS is now visualized TODO complete
-
Test Queries:
- Use the SPARQL endpoint to query for your new building
- Verify it appears in results alongside the sample buildings
-
Verify Relationships:
- If you linked Events, People, or Sources, check that these connections work
- Navigate between related entities to test bidirectional links
Expand your Metapolis instance by adding more geographical features:
Method 1: Manual Creation in Metapolis
- Repeat steps 4.2-4.6 for each unlinked feature in your PostGIS database
- Suitable for small numbers of buildings or when detailed curation is needed
- Allows careful review and enrichment of each entity
Method 2: Batch Processing
- For multiple buildings, create a systematic workflow
- Use spreadsheets to organize building information before entry
- Consider creating templates for common building types
Method 3: GIS Software Integration
You can add new geographical features using GIS software (e.g., QGIS, ArcGIS) that connects to the same PostGIS database:
-
Connect GIS Software to PostGIS:
- Open QGIS or your preferred GIS application
- Create a new PostGIS connection using your database credentials
- Connect to the
metapolisdatabase andmetapolisschema
-
Create or Import Building Footprints:
- Use GIS tools to digitize building footprints from maps or satellite imagery
- Import existing shapefiles or GeoJSON data
- Ensure geometries are in WGS84 (EPSG:4326) coordinate system
-
Add to Buildings Table:
- Export or insert features into the
metapolis.buildingstable - Ensure required fields are populated (name, function, geom)
- Verify spatial data integrity
- Export or insert features into the
-
Link in Metapolis:
- The new features automatically become available in Metapolis
- Follow steps 4.2-4.6 to create corresponding Building entities
- Link each entity to its PostGIS feature using the autocomplete field
Follow these guidelines for effective data management:
Naming Conventions:
- Keep feature names consistent between GIS software and Metapolis
- Use descriptive names that make features easy to identify
- Include location information when multiple buildings share similar names
- Consider using standardized naming schemes (e.g., "Building Name, City")
Data Quality:
- Verify spatial data accuracy before linking to ensure proper map visualization
- Check that polygon geometries are valid and don't have self-intersections
- Ensure coordinates are in the correct coordinate reference system (WGS84)
- Review building functions and classifications for consistency
Documentation:
- Document any custom attributes or metadata in both the GIS database and Metapolis entities
- Maintain records of data sources and provenance
- Create internal guidelines for data entry and quality control
- Use the Description field to provide context and historical information
Relationships:
- Link buildings to relevant Events, People, and Sources as you discover connections
- Build a network of relationships that enriches the research value
- Consider temporal relationships (when buildings were constructed, modified, or demolished)
- Document uncertainty or ambiguity in relationships
After completing the setup and creating your first buildings, explore these additional capabilities:
Expand Your Dataset:
- Create Events: Document historical events and link them to buildings and locations
- Add People: Create Person entities for architects, owners, residents, and other associated individuals
- Link Sources: Connect archival sources, documents, photographs, and references to your entities
- Import More Data: Use GIS software to add more geographical features to your PostGIS database
Visualize Your Data:
- Access Map Components: Navigate to map visualization pages to see your buildings displayed geographically
- Layer Historical Maps: Upload and overlay historical maps to provide temporal context
- Create Custom Views: Design specialized map views for different research questions or time periods
- Export Visualizations: Generate maps and diagrams for publications and presentations
Advanced Queries:
- Spatial Analysis: Use SPARQL queries to find buildings within specific areas or distances
- Temporal Queries: Filter entities by time periods or date ranges
- Relationship Exploration: Query complex networks of relationships between entities
- Data Export: Extract data in various formats for external analysis
Collaboration:
- User Management: Add collaborators to your ResearchSpace instance
- Access Control: Configure permissions for different user roles
- Shared Research: Enable multiple scholars to contribute to the same dataset
- Publication: Prepare your data for public access and Linked Open Data publication
Integration:
- External Knowledge Bases: Link your entities to VIAF, Wikidata, OCLC, and Getty vocabularies
- Authority Control: Use standardized identifiers for people, places, and concepts
- Data Enrichment: Leverage external data sources to enhance your entities
- Interoperability: Ensure your data can be discovered and reused by other projects
Contributions to Metapolis are welcome! To contribute:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Please ensure your code follows the project's coding standards and includes appropriate tests.
Funded by the National Endowment for the Humanities (NEH) as part of the Digital Humanities Advancement Grants.
Project Title: Metapolis: Spatializing Histories through Archival Sources HAA-287761-22
Project Director: Lukas Klic
Project Description: The creation of geospatial enhancements to an existing digital infrastructure that will allow users to link to other scholarship, generate new research, and publish findings.
For detailed technical specifications and additional documentation, see the wiki.

