Skip to content

Refactor GenderExtractor to use context.ontology instead of hardcoded URIs #825

@vaibhav45sktech

Description

@vaibhav45sktech

Summary
The GenderExtractor.scala component currently utilizes literal string constants for RDF and OWL identifiers. To improve maintainability and ensure alignment with our core framework, these should be transitioned to dynamic lookups via the context.ontology service.

Current Implementation
At present, the extractor manually defines property and class URIs. This approach bypasses the centralized ontology management system and introduces potential for "magic string" errors.

Affected Code Snippets:

// Hardcoded FOAF property
private val genderProperty = "http://xmlns.com/foaf/0.1/gender"

// Hardcoded RDF type property
private val typeProperty = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"

// Hardcoded DBpedia Class
private val personUri = "http://dbpedia.org/ontology/Person"

Recommended Refactor:

  • Gender Property: Use context.ontology.properties("foaf:gender")

  • Type Property: Use context.ontology.properties("rdf:type")

  • Person Class: Use context.ontology.classes("Person")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions