Properly create Enumerations whose values need to be managed as well??

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Properly create Enumerations whose values need to be managed as well??

MartyStache
This post was updated on .
Hi! I would like to know the proper way to approach Enumerations with OWLReady2 in order to manage the values as managed properties. 1. I consider enumerations a Datatype and wonder why the capability does not exist in OwlReady2 to create DataType? e.g., class SomethingType(DataType): 2. If I want to manage the values included in the "OneOf(" list as 'definitions' (not instances) to maintain comments/definition for them, how do I approach this? I'm not a fan of creating individuals for the values, I consider them, again, a DataProperty to be managed.
Reply | Threaded
Open this post in threaded view
|

Re: Properly create Enumerations whose values need to be managed as well??

Jiba
Administrator
Hi,

I usually create individuals for enumaration, but I can understand that it may not suit to everyone.

You can create custom datatype with Owlready, but it requires a little coding. There is an example here:

    http://owlready.8326.n8.nabble.com/Assign-missing-datatypes-td1845.html#a1850

You may even use constant integer or string value (not very clean semantically speaking, but fully working for reasoning purpose).


Owlready OneOf([a, b, c,...]) construct can be used for one-of. It works with individuals, but also with datatype values.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Properly create Enumerations whose values need to be managed as well??

MartyStache
Thank you Jiba,

The rest of my post got cut off because I accidentally put HTML comment code in my post at the end lol. Please review and let me know (DataType or not) if this is the correct approach for handling enumerations with OWLReady? And if.I were not to do individuals, how else would I approach?

Here is what I am currently doing and know that it is likely the incorrect approach:

class Currency(Thing): <— I'd really like to say DataType here???
  pass
Currency.comment = ["Monetary currencies"]

class AUD(Thing or DataProperty?): <—-Thing or DataProperty?? (which would would have domain/range)
  pass
AUD.comment = ["Australian dollar."]

class CHF(Thing or DataProperty?):
  pass
CHF.comment = ["Swiss franc."]

Currency.is_a.append(OneOf([AUD,CHF]))

# the class who's property 'unit' is of type 'Currency' (an enum)
class CostPerVolume(Thing):
  pass
CostPerVolume.comment = ["Cost per unit volume."]

class has_unit(ObjectProperty): <— This just feels to me it should be DataType
  domain = [CostPerVolume]
  range = [Currency]
has_unit.comment = ["The currency used to calculate unit of cost per volume"]
Reply | Threaded
Open this post in threaded view
|

Re: Properly create Enumerations whose values need to be managed as well??

Jiba
Administrator
Hi,

It seems correct to me. I would just change:

class AUD(Thing or DataProperty?):
class CHF(Thing or DataProperty?):

with:

class AUD(Currency):
class CHF(Currency):

Jiba