Fix structural inconsistency: Corrected 'Infrastucture' typo in ontology and snapshots#47
Fix structural inconsistency: Corrected 'Infrastucture' typo in ontology and snapshots#47anshuman9468 wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughThis PR corrects a misspelling of "Infrastucture" to "Infrastructure" across all DBpedia ontology snapshot formats and main ontology files. The ElectricalSubstation class hierarchy is updated to reference the correctly spelled Infrastructure class. Java code is realigned to reference the correct ontology file paths. ChangesInfrastructure Spelling Correction and Resource Alignment
🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
Actionable comments posted: 3
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)
34-37:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winUse content equality for
Stringbranch selection (reference comparison is incorrect).At Line 34,
schemaSource != defaultSchemacompares object identity, not string value. When a caller passes a newStringinstance with identical content todefaultSchema(e.g., from user input or configuration), the comparison fails and the code incorrectly treats a file path as TTL text content, causing parsing to fail.Proposed fix
- if(schemaSource != defaultSchema) + if(!defaultSchema.equals(schemaSource)) ontologyShaclReader = new RdfModelReader(RdfReaderFactory.createReaderFromText(schemaSource, "TTL").read()); else ontologyShaclReader = new RdfModelReader(RdfReaderFactory.createFileOrResourceReader(schemaSource, "").read());🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.java` around lines 34 - 37, The code in RDFUnitValidate currently uses reference comparison (schemaSource != defaultSchema) to choose the reader, which is wrong for Strings; change the branch to use content equality (e.g., !defaultSchema.equals(schemaSource) or Objects.equals/defaultSchema.equals(schemaSource) with null-safety) so the selection between RdfReaderFactory.createReaderFromText(..., "TTL") and createFileOrResourceReader(...) is based on string value; update the conditional around schemaSource/defaultSchema used to set ontologyShaclReader (the RdfModelReader assignment) accordingly.
🧹 Nitpick comments (1)
src/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.java (1)
23-23: ⚡ Quick winMake
defaultSchemaa constant (private static final).Line 23 behaves like a constant but is currently mutable and package-visible. Locking it down prevents accidental reassignment.
♻️ Proposed refactor
- static String defaultSchema = "guidelines/dbo.tests.shapes.ttl"; + private static final String DEFAULT_SCHEMA = "guidelines/dbo.tests.shapes.ttl"; ... - this(defaultSchema); + this(DEFAULT_SCHEMA); ... - if(!defaultSchema.equals(schemaSource)) + if(!DEFAULT_SCHEMA.equals(schemaSource))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.java` at line 23, The field defaultSchema in class RDFUnitValidate should be made an immutable constant: change its declaration to a private static final String and (optionally) rename it to a conventional constant name like DEFAULT_SCHEMA; update any references in RDFUnitValidate to use the new name if renamed and ensure visibility is limited to the class (private) to prevent accidental reassignment or package access.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@databus/dbpedia/ontology/dbo-snapshots/dbo-snapshots.nt`:
- Around line 5795-5800: Remove the six duplicate N-Triples for
<http://dbpedia.org/ontology/Infrastructure> (the duplicates for rdf:type
owl:Class, rdfs:label "@ur", rdfs:label "infrastructure"@en, rdfs:label
"infrastructure"@fr, rdfs:subClassOf
<http://dbpedia.org/ontology/ArchitecturalStructure>, and prov:wasDerivedFrom
<http://mappings.dbpedia.org/index.php/OntologyClass:Infrastructure>) that were
appended by the URI substitution; delete those exact triples from
dbo-snapshots.nt and re-run or add the deduplication step for dbo-snapshots.nt
so future URI-replacements (fixing dbo:Infrastucture → dbo:Infrastructure) do
not create duplicate triples.
In `@databus/dbpedia/ontology/dbo-snapshots/dbo-snapshots.owl`:
- Around line 364-365: The file contains duplicate owl:Class blocks for the
class http://dbpedia.org/ontology/Infrastructure (dbo:Infrastructure) with
overlapping axioms (rdfs:subClassOf and prov:wasDerivedFrom); remove the
redundant duplicate block and keep a single canonical declaration for
dbo:Infrastructure that includes all required axioms (rdfs:label entries,
rdfs:subClassOf pointing to http://dbpedia.org/ontology/ArchitecturalStructure,
and prov:wasDerivedFrom pointing to the mapping URI), and do the same for the
other duplicate occurrence referenced in the comment (lines around 957-958) so
there is exactly one owl:Class
rdf:about="http://dbpedia.org/ontology/Infrastructure" in the snapshot.
In `@ontology/ontology.ttl`:
- Line 17398: The PR unintentionally changes the ontology domain of :leadership
to :PopulatedPlace, which is a semantic (behavioral) change outside a typo-fix;
revert the domain change for :leadership back to its original domain (undo the
edit that sets "rdfs:domain :PopulatedPlace ;" for :leadership) in this PR, or
else remove that line and split the domain change into a separate PR that
includes targeted validation/tests for the :leadership domain change and
reasoning impact. Ensure the change is made by editing the :leadership triple
(the rdfs:domain statement) so the ontology semantics are unchanged in this
branch.
---
Outside diff comments:
In `@src/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.java`:
- Around line 34-37: The code in RDFUnitValidate currently uses reference
comparison (schemaSource != defaultSchema) to choose the reader, which is wrong
for Strings; change the branch to use content equality (e.g.,
!defaultSchema.equals(schemaSource) or
Objects.equals/defaultSchema.equals(schemaSource) with null-safety) so the
selection between RdfReaderFactory.createReaderFromText(..., "TTL") and
createFileOrResourceReader(...) is based on string value; update the conditional
around schemaSource/defaultSchema used to set ontologyShaclReader (the
RdfModelReader assignment) accordingly.
---
Nitpick comments:
In `@src/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.java`:
- Line 23: The field defaultSchema in class RDFUnitValidate should be made an
immutable constant: change its declaration to a private static final String and
(optionally) rename it to a conventional constant name like DEFAULT_SCHEMA;
update any references in RDFUnitValidate to use the new name if renamed and
ensure visibility is limited to the class (private) to prevent accidental
reassignment or package access.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c4005c6e-c895-40dd-9236-39470455cbb2
📒 Files selected for processing (9)
databus/dbpedia/ontology/dbo-snapshots/dbo-snapshots.dldatabus/dbpedia/ontology/dbo-snapshots/dbo-snapshots.ntdatabus/dbpedia/ontology/dbo-snapshots/dbo-snapshots.owldatabus/dbpedia/ontology/dbo-snapshots/dbo-snapshots.ttlontology/ontology.owlontology/ontology.ttlsrc/main/java/org/dbpedia/ontologytracker/RDFUnitValidate.javasrc/main/java/org/dbpedia/ontologytracker/ValidateOntology.javasrc/test/java/org/dbpedia/ontologytracker/TestRunner.java
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> . | ||
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "\u0628\u0646\u06CC\u0627\u062F\u06CC \u0688\u06BE\u0627\u0646\u0686\u06C1"@ur . | ||
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "infrastructure"@en . | ||
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "infrastructure"@fr . | ||
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://dbpedia.org/ontology/ArchitecturalStructure> . | ||
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/ns/prov#wasDerivedFrom> <http://mappings.dbpedia.org/index.php/OntologyClass:Infrastructure> . |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Confirm all duplicate triples for dbo:Infrastructure in the .nt file
rg -n 'dbpedia\.org/ontology/Infrastructure' databus/dbpedia/ontology/dbo-snapshots/dbo-snapshots.nt \
| sort -t':' -k2Repository: dbpedia/ontology-tracker
Length of output: 6727
Remove 6 duplicate triples for dbo:Infrastructure — deduplication missed multiple lines.
The addition of dbo:Infrastructure introduced six exact duplicates of already-present triples:
| Lines | Duplicate of | Triple content |
|---|---|---|
| 5795 | 5784 | rdf:type owl:Class |
| 5796 | 5787 | rdfs:label "..."@ur (Urdu) |
| 5797 | 5789 | rdfs:label "infrastructure"@en |
| 5798 | 5790 | rdfs:label "infrastructure"@fr |
| 5799 | 5793 | rdfs:subClassOf dbo:ArchitecturalStructure |
| 5800 | 5794 | prov:wasDerivedFrom <...OntologyClass:Infrastructure> |
This occurred because the misspelled dbo:Infrastucture block was replaced via URI substitution, appending all triples under the correct URI without checking for pre-existing ones. The PR notes deduplication was applied to dbo-snapshots.dl, but this .nt file was skipped.
🗑️ Proposed fix — remove the six duplicate triples
<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> .
<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "Infrastruktur"@de .
<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "Υποδομή"@el .
<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "\u0628\u0646\u06CC\u0627\u062F\u06CC \u0688\u06BE\u0627\u0646\u0686\u06C1"@ur .
<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "インフラストラクチャー"@ja .
<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "infrastructure"@en .
<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "infrastructure"@fr .
<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "infrastructure"@nl .
<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "infrastruktur"@da .
<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://dbpedia.org/ontology/ArchitecturalStructure> .
<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/ns/prov#wasDerivedFrom> <http://mappings.dbpedia.org/index.php/OntologyClass:Infrastructure> .
-<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> .
-<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "\u0628\u0646\u06CC\u0627\u062F\u06CC \u0688\u06BE\u0627\u0646\u0686\u06C1"@ur .
-<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "infrastructure"@en .
-<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "infrastructure"@fr .
-<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://dbpedia.org/ontology/ArchitecturalStructure> .
-<http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/ns/prov#wasDerivedFrom> <http://mappings.dbpedia.org/index.php/OntologyClass:Infrastructure> .📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> . | |
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "\u0628\u0646\u06CC\u0627\u062F\u06CC \u0688\u06BE\u0627\u0646\u0686\u06C1"@ur . | |
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "infrastructure"@en . | |
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#label> "infrastructure"@fr . | |
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://dbpedia.org/ontology/ArchitecturalStructure> . | |
| <http://dbpedia.org/ontology/Infrastructure> <http://www.w3.org/ns/prov#wasDerivedFrom> <http://mappings.dbpedia.org/index.php/OntologyClass:Infrastructure> . |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@databus/dbpedia/ontology/dbo-snapshots/dbo-snapshots.nt` around lines 5795 -
5800, Remove the six duplicate N-Triples for
<http://dbpedia.org/ontology/Infrastructure> (the duplicates for rdf:type
owl:Class, rdfs:label "@ur", rdfs:label "infrastructure"@en, rdfs:label
"infrastructure"@fr, rdfs:subClassOf
<http://dbpedia.org/ontology/ArchitecturalStructure>, and prov:wasDerivedFrom
<http://mappings.dbpedia.org/index.php/OntologyClass:Infrastructure>) that were
appended by the URI substitution; delete those exact triples from
dbo-snapshots.nt and re-run or add the deduplication step for dbo-snapshots.nt
so future URI-replacements (fixing dbo:Infrastucture → dbo:Infrastructure) do
not create duplicate triples.
| </owl:Class><owl:Class rdf:about="http://dbpedia.org/ontology/Infrastructure"> | ||
| <rdfs:label xml:lang="en">infrastructure</rdfs:label><rdfs:label xml:lang="fr">infrastructure</rdfs:label><rdfs:label xml:lang="ur">بنیادی ڈھانچہ</rdfs:label><rdfs:subClassOf rdf:resource="http://dbpedia.org/ontology/ArchitecturalStructure"/><prov:wasDerivedFrom rdf:resource="http://mappings.dbpedia.org/index.php/OntologyClass:Infrastructure"/> |
There was a problem hiding this comment.
Remove duplicated dbo:Infrastructure class block/triples.
http://dbpedia.org/ontology/Infrastructure is declared twice in this file with overlapping axioms (rdfs:subClassOf and prov:wasDerivedFrom). Even if semantically mergeable, this creates redundant snapshot data and unnecessary churn. Prefer a single canonical class declaration here.
Also applies to: 957-958
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@databus/dbpedia/ontology/dbo-snapshots/dbo-snapshots.owl` around lines 364 -
365, The file contains duplicate owl:Class blocks for the class
http://dbpedia.org/ontology/Infrastructure (dbo:Infrastructure) with overlapping
axioms (rdfs:subClassOf and prov:wasDerivedFrom); remove the redundant duplicate
block and keep a single canonical declaration for dbo:Infrastructure that
includes all required axioms (rdfs:label entries, rdfs:subClassOf pointing to
http://dbpedia.org/ontology/ArchitecturalStructure, and prov:wasDerivedFrom
pointing to the mapping URI), and do the same for the other duplicate occurrence
referenced in the comment (lines around 957-958) so there is exactly one
owl:Class rdf:about="http://dbpedia.org/ontology/Infrastructure" in the
snapshot.
| :leadership | ||
| a rdf:Property, owl:DatatypeProperty ; | ||
| rdfs:domain :Person ; | ||
| rdfs:domain :PopulatedPlace ; |
There was a problem hiding this comment.
Unscoped ontology semantic change in this PR.
Line 17398 changes :leadership domain to :PopulatedPlace, which is a behavioral ontology change and not part of the typo-fix objective. Please either revert this here or split it into a separate PR with targeted validation coverage, since domain changes can impact downstream reasoning.
Suggested minimal fix in this PR
:leadership
a rdf:Property, owl:DatatypeProperty ;
- rdfs:domain :PopulatedPlace ;
+ rdfs:domain :Person ;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| rdfs:domain :PopulatedPlace ; | |
| :leadership | |
| a rdf:Property, owl:DatatypeProperty ; | |
| rdfs:domain :Person ; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@ontology/ontology.ttl` at line 17398, The PR unintentionally changes the
ontology domain of :leadership to :PopulatedPlace, which is a semantic
(behavioral) change outside a typo-fix; revert the domain change for :leadership
back to its original domain (undo the edit that sets "rdfs:domain
:PopulatedPlace ;" for :leadership) in this PR, or else remove that line and
split the domain change into a separate PR that includes targeted
validation/tests for the :leadership domain change and reasoning impact. Ensure
the change is made by editing the :leadership triple (the rdfs:domain statement)
so the ontology semantics are unchanged in this branch.
Description
This PR addresses a structural inconsistency in the DBpedia ontology where the class
dbo:ElectricalSubstationincorrectly referenced a misspelled superclassdbo:Infrastucture(missing the 'r').The correct class
dbo:Infrastructurewas already defined, but the typo caused hierarchy fragmentation and affected ontology reasoning consistency.Changes Made
ontology/ontology.owlandontology/ontology.ttlto pointElectricalSubstationto the correctInfrastructuresuperclass.databus/dbpedia/ontology/dbo-snapshots/(.owl,.ttl,.nt,.dl).wasDerivedFromrelations in thedbo-snapshots.dlfile caused by the correction.Verification
Infrastuctureremain in the project.mvn test -Dtest=TestRunner), which confirmed thatElectricalSubstationandInfrastructureare now correctly recognized as valid classes without errors.Fixes #44
Summary by CodeRabbit
Bug Fixes
Chores