[Pellet-users] Hierarchy of datatypes and enumeration datatypes
Evren Sirin
evren at clarkparsia.com
Mon Feb 11 00:47:24 UTC 2008
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?
> 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/
>
More information about the Pellet-users
mailing list