Fix incorrect type inference for country entities due to restrictive property domain and broken ontology paths#45
Conversation
📝 WalkthroughWalkthroughThe changes update ontology schema definitions and adjust file path references across the codebase to align with restructured resource locations and renamed ontology files. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 | 🟠 MajorUse 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 staticdefaultSchemaeven when values match, causing correct schema paths to be incorrectly parsed as inline TTL text.Change the comparison from
if(schemaSource != defaultSchema)toif (!defaultSchema.equals(schemaSource)). Also makedefaultSchemaprivate 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
📒 Files selected for processing (4)
ontology/ontology.ttlsrc/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.javasrc/main/java/org/dbpedia/ontologytracker/ValidateOntology.javasrc/test/java/org/dbpedia/ontologytracker/TestRunner.java
Description
This PR fixes an issue where country entities (e.g., Italy) were incorrectly inferred as
dbo:Person.What was done
:leadershipproperty had an incorrect domain of:Person, which caused wrong type inference when used in country infobox mappings.:leadershipto:PopulatedPlaceinontology/ontology.ttlto ensure correct classification.Issue in Ontology Tracker
Fix
These changes prevent incorrect type propagation and improve overall ontology consistency and validation reliability.
Issue link-: #40
Summary by CodeRabbit
Bug Fixes
Chores