Skip to content

URI metadata fields can remain String after PATCH, causing indexing failure #293

Description

@jvendetti

When patching the KISAO ontology through the API, the request failed during save with:

ArgumentError: ID must be set to be able to index

goo/lib/goo/search/search.rb:29:in `index_update`
ontologies_linked_data/models/ontology.rb:476:in `index_latest_submission`
...
ontologies_api/controllers/ontologies_controller.rb:92

The latest submission was invalid before indexing:

sub.valid?
# => false

sub.errors
# => {
#   publication: { uri: "All values in attribute `publication` must be `RDF::URI`" },
#   uri: { uri: "Attribute `uri` with the value `http://www.biomodels.net/kisao/KISAO#` must be `RDF::URI`" }
# }

sub.publication
# => ["https://doi.org/10.1038/msb.2011.77"]

sub.uri
# => "http://www.biomodels.net/kisao/KISAO#"

These two ontology submission attributes (:publication and :uri) are URI-typed in OntologySubmission. The URI strings themselves appear valid when wrapped as RDF::URI; the problem is that they remain plain Ruby String values. Goo’s :uri validator requires actual RDF::URI instances, not just valid URI text.

Expected behavior:

  • PATCH/update handling should coerce valid string values for URI-typed metadata fields into RDF::URI before save/indexing, or reject them with a clear validation response.
  • The API shouldn't surface the later Solr/indexing error as the primary failure when the latest submission is invalid.

Candidate areas to inspect:

  • Metadata assignment/coercion for OntologySubmission fields declared with type: :uri or type: %i[uri list].
  • The ontology save callback Ontology#index_latest_submission, which may need to avoid indexing an invalid latest submission or raise/report validation errors more clearly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions