Skip to content

Fix incorrect type inference for country entities due to restrictive property domain and broken ontology paths#45

Open
anshuman9468 wants to merge 1 commit into
dbpedia:masterfrom
anshuman9468:fix/italy-person-misclassification-and-paths
Open

Fix incorrect type inference for country entities due to restrictive property domain and broken ontology paths#45
anshuman9468 wants to merge 1 commit into
dbpedia:masterfrom
anshuman9468:fix/italy-person-misclassification-and-paths

Conversation

@anshuman9468
Copy link
Copy Markdown

@anshuman9468 anshuman9468 commented Apr 11, 2026

Description

This PR fixes an issue where country entities (e.g., Italy) were incorrectly inferred as dbo:Person.

What was done

  • Identified that the :leadership property had an incorrect domain of :Person, which caused wrong type inference when used in country infobox mappings.
  • Updated the domain of :leadership to :PopulatedPlace in ontology/ontology.ttl to ensure correct classification.

Issue in Ontology Tracker

  • Discovered that the ontology-tracker had hardcoded file paths pointing to non-existent directories.
  • Because of this, the tool failed to load ontology and SHACL files, preventing proper validation and making it harder to detect such issues.

Fix

  • Corrected the file paths in the ontology-tracker to properly load ontology and SHACL files.
  • Restored validation functionality to ensure such inconsistencies can be detected in the future.

These changes prevent incorrect type propagation and improve overall ontology consistency and validation reliability.

Issue link-: #40

Summary by CodeRabbit

  • Bug Fixes

    • Corrected the domain classification of the leadership property to apply to populated places instead of persons. This ensures the ontology schema accurately reflects the appropriate entity types for this property.
  • Chores

    • Updated validation and test suite configurations to reference the latest ontology schema definitions and test resources, ensuring consistent usage across the ontology tracking system.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 11, 2026

📝 Walkthrough

Walkthrough

The changes update ontology schema definitions and adjust file path references across the codebase to align with restructured resource locations and renamed ontology files.

Changes

Cohort / File(s) Summary
Ontology Schema
ontology/ontology.ttl
Modified :leadership property's rdfs:domain from :Person to :PopulatedPlace.
File Path Updates
src/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.java, src/main/java/org/dbpedia/ontologytracker/ValidateOntology.java, src/test/java/org/dbpedia/ontologytracker/TestRunner.java
Updated resource references: defaultSchema redirected to guidelines/ directory; ontology file references changed from dbpedia_ontology.ttl to ontology.ttl.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically summarizes the two main fixes: changing the :leadership property domain from :Person to :PopulatedPlace to prevent incorrect type inference for countries, and correcting broken ontology file paths that were preventing validation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.java (1)

23-37: ⚠️ Potential issue | 🟠 Major

Use String value equality instead of reference comparison for schema routing (Line 34).

Line 34 compares String references (!=) instead of values. Constructor calls from ValidateOntology.java (lines 87, 117, 175) pass string variables that will never be reference-equal to the static defaultSchema even when values match, causing correct schema paths to be incorrectly parsed as inline TTL text.

Change the comparison from if(schemaSource != defaultSchema) to if (!defaultSchema.equals(schemaSource)). Also make defaultSchema private and final as a best practice.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.java` around lines
23 - 37, The constructor in RDFUnitValidate is using reference comparison for
schema routing; change the logic in the RDFUnitValidate(String schemaSource)
constructor to compare String values using defaultSchema.equals(schemaSource)
(i.e., if (!defaultSchema.equals(schemaSource)) ...) so schemaSource values
route correctly, and make the static defaultSchema field private and final
(private static final String defaultSchema = "guidelines/dbo.tests.shapes.ttl")
to follow best practices.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.java`:
- Around line 23-37: The constructor in RDFUnitValidate is using reference
comparison for schema routing; change the logic in the RDFUnitValidate(String
schemaSource) constructor to compare String values using
defaultSchema.equals(schemaSource) (i.e., if
(!defaultSchema.equals(schemaSource)) ...) so schemaSource values route
correctly, and make the static defaultSchema field private and final (private
static final String defaultSchema = "guidelines/dbo.tests.shapes.ttl") to follow
best practices.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a8068c08-de46-454a-8e26-75d3c7480234

📥 Commits

Reviewing files that changed from the base of the PR and between 51b93fa and a9e7fe3.

📒 Files selected for processing (4)
  • ontology/ontology.ttl
  • src/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.java
  • src/main/java/org/dbpedia/ontologytracker/ValidateOntology.java
  • src/test/java/org/dbpedia/ontologytracker/TestRunner.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant