[Pellet-users] Nominals in KB

Evren Sirin evren at clarkparsia.com
Mon Oct 22 13:19:25 UTC 2007


On 10/20/07 8:19 AM, Christina Tziviskou wrote:
> Hi,
>
> I create an ontology in Pellet using its own Java API.

Pellet API is not very user-friendly and there is not much 
documentation. We generally encourage our users to use Pellet through 
higher APIs, e.g. OWLAPI or Jena.

> I cannot create nominals. 

Creating nominals and all other class expressions can be done via 
ATermUtils class. Specifically, ATermUtils.makeValue(ATermAppl ind) 
function will create a singleton class that would have one instance

> In particular I would like to:
>     -- add the value for a class attribute (e.g. in OWL for the class 
> Male I wanna indicate that the property gender hasValue 'm')
>   

HasValue restriction is syntactic sugar for a someValuesFrom restriction 
to a nominal. So you need to do:

        kb.addEquivalentClass( Male, ATermUtils.makeSomeValues( gender, 
ATermUtils.makeValue( m ) ) );

There is a shortcut like:

        kb.addEquivalentClass( Male, ATermUtils.makeHasValue( gender, m ) );

>     -- create an enumeration class (e.g. class Color oneOf ('Red', 
> 'Blue', 'Green')
>   

Enumerations are disjunctions of nominals but there is no shortcut in 
the API. So you have to do the following:

        ATermList enumeration = ATermUtils.makeList( new ATermAppl[] {
                ATermUtils.makeValue( red ),
                ATermUtils.makeValue( green ),
                ATermUtils.makeValue( blue ) } );
        kb.addEquivalentClass( Color, ATermUtils.makeOr( enumeration ) );

Hope this helps,
Evren
> I use the KnowledgeBase Java class but I find methods for adding a 
> property value only for an instance, and there is no method for creating 
> an enumeration.
>
>
> thank you,
> 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