Closed rioug closed 9 months ago
@lecoqlibre all done!
Like you said @rioug it would be nice to be able to navigate the tree like narrowers and broaders. It was the plan but I was not sure it would be used and at the beginning the connector was not supposed to provide a SKOS parser. But I think it is useful for everyone to have it.
I am curious of what you are doing in the other language, looks like you are just querying the parse JSON for php, is that right ?
This PR fixes the following issues :
Additional background : https://github.com/datafoodconsortium/connector-ruby/issues/13#issuecomment-1786333685
It allows the ruby connector to use intermediate SKOS concept for Product Types and Facets ie:
connector.FACETS.TERRITORIALORIGIN.EUROPE.FRANCE
connector.PRODUCT_TYPES.DRINK.SOFT_DRINK
It didn't make sense to use intermediate for Measures so I kept the original behaviour (it can be easily fixed if needed)
I am not familiar with the design, but I don't think it makes sense for
DataFoodConsortium::Connector::SKOSConcept
to be a subclass ofDataFoodConsortium::Connector::SKOSInstance
, so I used a helper module to share method needed by both class. This also populatesnarrowers
andbroaders
forSKOSConcept
so it's easier to navigate the tree. Ideally I would have like them to return a list of methods so could do something like below without additional steps :I didn't want to alter the existing behaviour of
DataFoodConsortium::Connector::SKOSConcept#narrowers
, that said the original values would still be available viaskos:narrower
semantic property. Any thought ?This also populates
prefLabels
forDataFoodConsortium::Connector::SKOSConcept
, I used an hash with locale has keys for ease of use ie :