Skip to content

[FEATURE] Backend REST API Routes for SKOS Vocabulary Explorer #421

@ZohaibHassan16

Description

@ZohaibHassan16

Summary

The frontend React UI for the Vocabulary Workspace is complete (see PR #420), but the FastAPI backend routes required to serve the data do not currently exist in semantica/explorer/routes/.

To support the UI, we need to implement the vocabulary.py router and append the corresponding Pydantic schemas to schemas.py.

Required Endpoints (semantica/explorer/routes/vocabulary.py)

  1. GET /api/vocabulary/schemes
    • Returns: A list of available SKOS vocabularies/ontologies currently loaded in the graph.
  2. GET /api/vocabulary/hierarchy
    • Params: scheme (string URI)
    • Returns: A nested JSON tree representing the broader/narrower hierarchy of concepts for the selected scheme.
  3. POST /api/vocabulary/import
    • Accepts: UploadFile (multipart/form-data containing .ttl or .rdf files).
    • Action: Parses the file (likely via rdflib) and ingests the SKOS concepts into the current GraphSession.

Required Schemas (semantica/explorer/schemas.py)

class VocabularyScheme(BaseModel):
    uri: str
    label: str
    description: Optional[str] = None

class ConceptNode(BaseModel):
    uri: str
    pref_label: str
    alt_labels: List[str] = Field(default_factory=list)
    children: Optional[List['ConceptNode']] = None

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions