A Semantic Web application that builds a Knowledge Graph (KG) from Bulbapedia, similar to how DBpedia was built from Wikipedia. This project captures Pokémon data from Bulbapedia, converts it into RDF format, and provides various interfaces to access and query the knowledge graph.
- Extracts data from Bulbapedia's wiki pages using MediaWiki API
- Converts wiki content into RDF triples with schema.org alignment
- Implements proper ontology and vocabulary design
- Maintains multilingual labels (English, Japanese, Romaji)
- Includes entity linking to DBpedia and Wikidata
- Supports multiple Pokemon generations
- Processes evolution chains with type preservation
- SHACL shapes for validating the knowledge graph structure
- Constraints on Pokémon properties (height, weight, types)
- Type hierarchy validation
- Property cardinality rules
- RDF quality checks using Jena validation
- SPARQL endpoint (port 3330)
- Support for inference in queries:
- RDFS subclass hierarchy
- Transitive properties (owl:sameAs)
- Property inheritance
- Predefined useful queries for common operations
- Content negotiation (HTML/RDF)
- Human-readable HTML views with:
- Pokemon details
- Type information
- Evolution chains
- External links
- Machine-readable RDF views (Turtle format)
- Proper hyperlinking between resources
- Java 11 or higher
- Maven
- Git
- Adequate disk space for the knowledge graph
- Clone the repository:
git clone https://github.com/anjola-adeuyi/bulbapedia-knowledge-graph.git
cd bulbapedia-knowledge-graph
- Build the project:
mvn clean install
- Start the application:
mvn exec:java -Dexec.mainClass="org.example.App"
This will start:
- Fuseki SPARQL endpoint on port 3330
- Linked Data interface on port 3331
- Verify the services are running:
# Test Fuseki
curl http://localhost:3330/pokemon/query
# Test Linked Data interface
curl -H "Accept: text/turtle" http://localhost:3331/resource/0001
# Example query to get all Pokémon names
curl -X POST \
-H "Content-Type: application/sparql-query" \
-d 'PREFIX schema: <http://schema.org/>
SELECT ?name WHERE {
?s schema:name ?name
}' \
http://localhost:3330/pokemon/query
- Create a new POST request to
http://localhost:3330/pokemon/query
- Set Content-Type header to
application/sparql-query
- In the body, enter your SPARQL query
- Send the request
- Get Pokémon and their types:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX pokemon: <http://example.org/pokemon/>
PREFIX schema: <http://schema.org/>
SELECT ?name ?primaryType ?secondaryType
WHERE {
?pokemon rdf:type pokemon:Pokemon ;
schema:name ?name ;
pokemon:primaryType ?primaryType .
OPTIONAL { ?pokemon pokemon:secondaryType ?secondaryType }
}
ORDER BY ?name
- Find evolution chains:
PREFIX pokemon: <http://example.org/pokemon/>
PREFIX schema: <http://schema.org/>
SELECT ?baseName ?evolvedName ?commonType
WHERE {
?base schema:name ?baseName ;
pokemon:primaryType ?commonType .
?evolved pokemon:evolvesFrom+ ?base ;
schema:name ?evolvedName ;
pokemon:primaryType ?commonType .
}
ORDER BY ?baseName ?evolvedName
- Visit
http://localhost:3331/resource/0001
for Bulbasaur - Navigate through Pokémon using the evolution chain links
# Get RDF data (Turtle format)
curl -H "Accept: text/turtle" http://localhost:3331/resource/0001
# Get HTML representation
curl -H "Accept: text/html" http://localhost:3331/resource/0001
The application automatically validates all data against SHACL shapes. You can find the shapes in:
pokemon-shapes.ttl
To manually validate:
- Extract the shapes file
- Use a SHACL validator (like Apache Jena SHACL)
- Run validation against your RDF data
bulbapedia-knowledge-graph/
├── src/
│ └── main/
│ ├── java/
│ │ └── org/example/
│ │ ├── App.java # Main application
│ │ ├── client/ # Wiki API client
│ │ ├── inference/ # RDF inference
│ │ ├── linking/ # Entity linking
│ │ ├── parser/ # Wiki parsing
│ │ ├── rdf/ # RDF conversion
│ │ ├── server/ # Web servers
│ │ └── validation/ # SHACL validation
│ └── resources/
│ ├── static/ # Web interface
│ ├── templates/ # HTML templates
│ └── queries/ # SPARQL queries
├── pokemon.ttl # Generated KG
├── pokemon-shapes.ttl # SHACL shapes
└── pom.xml
- BulbapediaClient: Handles API requests to Bulbapedia
- WikiInfoboxParser: Extracts structured data from wiki pages
- PokemonRDFConverter: Converts parsed data to RDF
- InferenceHandler: Implements RDFS and OWL inference
- LinkedDataServer: Provides web interface and content negotiation
- PokemonFusekiServer: Manages SPARQL endpoint
- SPARQL endpoint: http://localhost:3330/pokemon/query
- Linked Data interface: http://localhost:3331/
- Example Pokemon: http://localhost:3331/resource/0001
Model model = ModelFactory.createDefaultModel();
model.read("pokemon.ttl", "TURTLE");
System.out.println("Valid RDF with " + model.size() + " triples");
The project implements all required features from the course specification:
-
Knowledge Graph Creation ✓
- Captures wiki content as RDF
- Converts infoboxes to triples
- Preserves wiki links as RDF relationships
-
Multilingual Support ✓
- Labels in multiple languages
- Uses proper language tags
- Integrates Pokédex translations
-
Schema Validation ✓
- SHACL shapes for validation
- Derived from wiki templates
- Consistent vocabulary usage
-
External Linking ✓
- Links to DBpedia
- Links to Wikidata
- Preserves wiki page links
-
SPARQL Access ✓
- Full SPARQL endpoint
- Support for complex queries
- Inference capabilities
-
Linked Data Interface ✓
- Content negotiation
- HTML/RDF views
- Proper hyperlinking
- Fork the repository
- Create your feature branch (
git checkout -b feature/new-feature
) - Commit your changes (
git commit -m 'Add some new feature'
) - Push to the branch (
git push origin feature/new-feature
) - Open a Pull Request
- Professor Antoine Zimmermann and Professor Victor Charpenay for the course structure and guidance
- Bulbapedia community for maintaining the Pokémon wiki
- DBpedia and YAGO project for inspiration