innoq / iqvoc

iQvoc - A SKOS(-XL) Vocabulary Management System for the Semantic Web
http://iqvoc.net/
Other
117 stars 44 forks source link

Additional hierarchy levels #359

Closed metaweidner closed 7 years ago

metaweidner commented 7 years ago

Is there any way to increase the number of levels that are returned with the hierarchy API call?

We have a metadata creation application (https://github.com/uhlibraries-digital/brays) that retrieves place names for a type-ahead from our controlled vocabulary application based on iQvoc: https://github.com/uhlibraries-digital/cedar

We've noticed that the returned hierarchy only goes four layers deep, and we have place names at lower levels: https://vocab.lib.uh.edu/en/hierarchy/place.html

mjansing commented 7 years ago

Currently iQvoc's maximum hierarchy depth is fixed at four level because it's a very expensive operation to traverse such a deep tree: https://github.com/innoq/iqvoc/blob/master/app/controllers/hierarchy_controller.rb#L107

You can control it with depth-param as mentioned in hierarchy-api documentation: https://vocab.lib.uh.edu/apidoc/4.9.0/hierarchy/show.html

Example:

Try to modify max_depth-variable in app/controllers/hierarchy_controller.rb#L107.

metaweidner commented 7 years ago

Thanks @mjansing. Your suggestion to override the hierarchy_controller worked perfectly. https://github.com/uhlibraries-digital/cedar/commit/72d849c6b28552f9022e754ee5d5d7720c38bfb1