Skip to content

GET /classes/:cls/paths_to_root returns HTTP 500 for SKOS concepts that have parents #253

Description

@matthewhorridge

Summary

The paths_to_root endpoint returns 500 Internal Server Error for SKOS concepts that have at least one parent (skos:broader). Every other class-hierarchy endpoint (/tree, /parents, /ancestors, /descendants) works for the same concept, and /paths_to_root works for OWL/OBO classes. A concept with no parents (a top concept) returns 200 [], so the crash is in the code path that walks parents.

Observed on stagedata.bioontology.org.

Steps to reproduce

Any SKOS concept that has a parent. Example — INJURYTYPES / "Sprain":

curl -H "Authorization: apikey token=$APIKEY" \
  "https://stagedata.bioontology.org/ontologies/INJURYTYPES/classes/http%3A%2F%2Fwww.fairdatacollective.com%2Ftemplate-vocabulary%2FSprain/paths_to_root?include=prefLabel,hasChildren"

Returns:

HTTP/1.1 500 Internal Server Error
Content-Type: text/html;charset=utf-8

<h1>Internal Server Error</h1>

Scope

include=prefLabel,hasChildren, valid apikey, raw HTTP:

Ontology Type Concept /paths_to_root
INJURYTYPES SKOS Sprain 500
PLOSTHES SKOS Atmosphere / Separation processes 500
I2SV SKOS Axiology 500
ISO639-1 SKOS iu (a top concept, no parents) 200 []
UBERON OWL (any deep class) 200
GO OBO general transcription… 200

Endpoint matrix for one failing SKOS concept (INJURYTYPES / Sprain):

Endpoint Result
/tree 200 (22 KB)
/parents 200
/ancestors 200
/descendants 200
/paths_to_root 500

So the failure is specific to /paths_to_root on SKOS concepts that have parents.

?display=all on the same endpoint returns a clean 422 {"errors":["all not allowed in include parameter for this endpoint"]}, so the route and parameter handling are reached; the 500 happens when the endpoint computes the paths.

Relevant source: ontologies_linked_data lib/ontologies_linked_data/concerns/concepts/concept_tree.rb (paths_to_root) and models/class.rb (traverse_path_to_root).

Suggested next step

The server log / backtrace for one of these 500s would pin the exact line.

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