[Pellet-users] Hierarchy of datatypes and enumeration datatypes
Evren Sirin
evren at clarkparsia.com
Wed Feb 13 19:03:04 UTC 2008
On 2/11/08 5:38 AM, Christina Tziviskou wrote:
> Hi,
>
> thank you a lot for the valuable answers.
>
>
>
> Evren Sirin wrote:
>
>> On 2/8/08 6:15 AM, Christina Tziviskou wrote:
>>
>>> Hi,
>>>
>>>
>
>
>>> I have two questions about the Pellet API and specifically the
>>> methods of the KnowledgeBase and AtermUtils classes.
>>>
>>> 1. Is it possible to create hierarchy of datatypes in Pellet using
>>> the above interfaces?
>>>
>>>
>> It is possible to define new user-defined datatypes by extending
>> existing datatypes. It is not possible (in a straight-forward way) to
>> assert subtype relation between two user-defined datatypes. This
>> relation may be inferred based on the definition of datatypes but
>> cannot be asserted explicitly. What kind of datatype hierarchy do you
>> want to define?
>>
>
> I would like to define three datatypes: WineDescription, WineTaste e
> WineColor
> and define WineTaste as subClassOf WineDescription
> and also WineColor as subClassOf WineDescription.
>
> I also want to express the two hierarchies disjoint and complete.
>
I think it would be better to define these as classes rather than
datatypes as currently done in the wine example. If you define them as
datatypes then define them as enumeration of data values so disjointness
and subtyping can be inferred automatically rather than being asserted.
For the subtyping to be inferred, the WineDescription enumeration should
be the union of WineTaste and WintColor enumeration.
Cheers,
Evren
> thank you,
> christina
>
>
>>> 2. I create enumerations with the following code:
>>>
>>> ATermList enumeration = ATermUtils.makeList( new ATermAppl[] {
>>> ATermUtils.makeValue( red ),
>>> ATermUtils.makeValue( green ),
>>> ATermUtils.makeValue( blue ) } );
>>> kb.addEquivalentClass( Color, ATermUtils.makeOr( enumeration ) );
>>>
>>>
>>> Is it possible to create an enumeration datatype instead of an
>>> enumeration class?
>>>
>>>
>> Yes, you can do it like this:
>>
>> // create set of literal values
>> Set setOfLiterals = new HashSet();
>> setOfLiterals.add( ATermUtils.makePlainLiteral( "a" ) );
>> setOfLiterals.add( ATermUtils.makePlainLiteral( "b" ) );
>> setOfLiterals.add( ATermUtils.makePlainLiteral( "c" ) );
>> // create an enumerated datatype out of the list (this does not
>> add the datatype)
>> Datatype dataRange = kb.getDatatypeReasoner().enumeration(
>> setOfLiterals );
>> // add the datatype to the KB with a name
>> kb.addDatatype( "abc", dataRange );
>>
>> Cheers,
>> Evren
>>
>>
>>> Thank you in advance,
>>> christina
>>>
>>>
>>>
>>> _______________________________________________
>>> Pellet-users mailing list
>>> Pellet-users at lists.owldl.com
>>> http://lists.owldl.com/mailman/listinfo/pellet-users
>>> _______________________________________________
>>>
>>> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/
>>>
>>>
>>
>
> _______________________________________________
> Pellet-users mailing list
> Pellet-users at lists.owldl.com
> http://lists.owldl.com/mailman/listinfo/pellet-users
> _______________________________________________
>
> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/
>
More information about the Pellet-users
mailing list