Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-discussion] Programmatically override the maximum cardinality for a slot, varying it by Cls

Ron Schultz rcaschultz at gmail.com
Tue Oct 26 05:17:43 PDT 2010


Thanks Jonathan,

I researched the code within the *setTemplateSlotMaximumCardinality and
found what I needed. I was looking for a generic means of updating any
system facet - including the cardinality.*
**
Ron


On Tue, Oct 26, 2010 at 6:45 AM, Jonathan Carter <
jonathan.carter at e-asolutions.com> wrote:

> Hi Ron,
>
> I've been doing something similar recently with the Java API to
> programmatically apply updates to the Class and Slot hierarchy.
>
> I believe that all you need to do is use the method:
>
>  *setTemplateSlotMaximumCardinality*(Slot<http://protege.stanford.edu/protege/3.4/docs/api/core/edu/stanford/smi/protege/model/Slot.html> slot,
> int max)
>
> On the Cls class.
>
> e.g.
>
> articleCls = kb.getCls("Article");
> keywordSlot = kb.getSlot("keyword");
> articleCls.setTemplateSlotMaximumCardinality(keywordSlot, 5);
>
> This is equivalent to editing the slot at the class rather than the
> top-level in the Protege GUI - which I believe is what you're looking for.
> Hope this helps
> Regards
>
> Jonathan
>  _______________________________________
>
> Jonathan Carter
> Enterprise Architecture Solutions Ltd
> _______________________________________
>
> Proud sponsors of The Essential Project
> The free open-source Enterprise Architecture Management Platform
> www.enterprise-architecture.org
> _______________________________________
>
> Enterprise Architecture Solutions Ltd, Registered in England and Wales:
> 04097721.
> Registered Office: 76 High Street, Newport Pagnell, Milton Keynes, MK16
> 8AQ.
>
>   On 25 Oct 2010, at 03:28, Ron Schultz wrote:
>
>   I have a circumstance where different Clses contain the slot 'keyword.'
> The keyword slot is of valueType 'String,' with a default maximum
> cardinality set to 1.
>
> I have a requirement to vary this cardinality class by class. I am just not
> sure how to do this programmatically.
>
> Let's say I have a class 'Article' where I want to set the maximum number
> of keywords to 5.
>
> Do I:
>
>    - Get the slot 'keywords' from the cls 'Article', and then set the
>    values of keyword's slot named :SLOT-MAXIMUM-CARDINALITY to a Collection
>    containing 5?
>    - Or do I perform some operations using the facets of the slot
>    'keyword.'
>    - Or ...?
>
> I've spent all weekend trying to figure this out and I know I must be
> missing something obvious.
>
> Thanks.
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing:
> http://protege.stanford.edu/doc/faq.html#01a.03
>
>
>
> _______________________________________________
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>
> Instructions for unsubscribing:
> http://protege.stanford.edu/doc/faq.html#01a.03
>
>


-- 
Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20101026/bdc84aad/attachment.html>


More information about the protege-discussion mailing list