ontoportal-lirmm / goo

Graph Oriented Objects (GOO) for Ruby. A RDF/SPARQL based ORM.
http://ncbo.github.io/goo/
Other
0 stars 4 forks source link

add `type` dsl to define property data type #22

Closed syphax-bouazzouni closed 10 months ago

syphax-bouazzouni commented 1 year ago

Requirement

Currently, to define a property type we use the enforce statement, like so

 attribute :uri, enforce:  [:URI, :existence, :unique]

The problem is that the validators (existence and uniqueness) are mixed with the property range (URI)

The proposition would be to add the 'type' argument and transform it like the following

 attribute :URI, type: :URI , enforce:  [:existence, :unique]

It will still be backward compatible because we it's only a redirection, i.e type: :uri will be added to the enforce clause in the back

syphax-bouazzouni commented 10 months ago

implemented in https://github.com/ontoportal-lirmm/goo/pull/27