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] (JythonScript)

Samson Tu swt at stanford.edu
Thu Feb 12 09:23:27 PST 2009


Do
accountNamePropertyVar = kb.getOWLObjectProperty("accountNameProperty")

to get an instance of OWLObjectProperty, which is a subinterface of 
RDFProperty.

Samson


Jonathan Carter wrote:
> Hi Jad,
> 
> Looks like your 'accountNameProperty' is not an object of type 
> RDFProperty, so the Java API call is failing.
> I've found that in the Jython scripting 'new'-ing classes of more 
> complex types doesn't always work. However, you can get references to 
> what you need by making a call to the knowledgebase ('kb') to give you a 
> proper instance of a class.
> 
> So, for example, RDFProperty is an interface, so you need to make sure 
> that 'accountNameProperty' has been instantiated correctly, so that it's 
> an instance of a class that implements this interface.
> 
> Could you tell us how 'accountNameProperty' is instantiated? From what I 
> can see of the Javadoc, the only way to get an instance (in Java/Python 
> terms) of an RDFProperty is to called RDFResource.getRDFProperties(), 
> which gives you a collection of properties. 
> 
> So your code would be something like:
> 
> aRDFPropertyList = darwinIndividual.getRDFProperties()
> accountNameProperty = None
> for aProperty in aRDFPropertyList:
> // Identify the required property and set accountNameProperty to hold 
> it. e.g.
>         if aProperty.getName() == "accountname":
> accountNameProperty = aProperty
> 
> darwinIndividual.setPropertyValue(accountNameProperty, "ABC")
> 
> 
> I'm not sure of the details of the if statement to identify the right 
> property from the list (I've spent all my time in Protege Frames) but 
> you get the idea.
> 
> Hope this helps
> 
> Regards
> 
> Jonathan
> 
> __________________________________________
> Jonathan Carter - Head of Technical Architecture
> Enterprise Architecture Solutions Ltd
> __________________________________________
> 
> Assess your EA maturity at:
> www.enterprise-architecture.com/EAvaluator 
> <http://www.enterprise-architecture.com/EAvaluator>
> __________________________________________
> 
> On 12 Feb 2009, at 04:45, jad al wrote:
> 
>> Hi Csongor,
>>  
>> Do you have what this error mean:
>>  
>> >>> darwinIndividual.setPropertyValue(accountNameProperty,"ABC");
>> TypeError: setPropertyValue(): 1st arg can't be coerced to 
>> edu.stanford.smi.protegex.owl.model.RDFProperty
>>  
>>  
>> I am just trying to set a property value of individual darwin.
>>  
>> Thank you.
>> jad
>>  
>>  
>>
>>
>>
>>  
>> ------------------------------------------------------------------------
>>
>> Date: Tue, 10 Feb 2009 09:21:31 -0800
>> From: csongor.nyulas at stanford.edu <mailto:csongor.nyulas at stanford.edu>
>> To: protege-discussion at lists.stanford.edu 
>> <mailto:protege-discussion at lists.stanford.edu>
>> Subject: Re: [protege-discussion] (JythonScript)
>>
>> Hi Jad,
>>
>> You can use all the methods that are defined at the 
>> edu.stanford.smi.protegex.owl.model.OWLModel class. For a quick 
>> (non-comprehensive) overview check out the Protege-OWL API: 
>> at http://protege.stanford.edu/plugins/owl/api/
>>
>> For the complete list of methods that can be called on OWLModel (and 
>> on the variables returned by those methods) navigate through the 
>> javadoc of the Protege API:
>> for the 3.4 beta version:
>> http://protege.stanford.edu/download/prerelease_javadoc_owl/index.html?edu/stanford/smi/protegex/owl/model/OWLModel.html
>> for the 3.3.1 version: 
>> http://protege.stanford.edu/download/release-javadoc-owl/index.html?edu/stanford/smi/protegex/owl/model/OWLModel.html
>>
>> Csongor
>>
>> jad al wrote: 
>>
>>     Csongor,
>>      
>>     Many many thanks, do you of a link to learn all the kb.commands. 
>>     I am new to this.
>>      
>>     jad  
>>
>>
>>     ------------------------------------------------------------------------
>>
>>     Date: Mon, 9 Feb 2009 20:49:40 -0800
>>     From: csongor.nyulas at stanford.edu <mailto:csongor.nyulas at stanford.edu>
>>     To: protege-discussion at lists.stanford.edu
>>     <mailto:protege-discussion at lists.stanford.edu>
>>     Subject: Re: [protege-discussion] (JythonScript)
>>
>>     Hi Jehad,
>>
>>     Always use kb to refer both to the Protege-Frames Knowledgebase
>>     and the Protege-OWL owlModel. So in your case write:
>>     HostClass =kb.getOWLNamedClass("Host")
>>     print HostClass
>>
>>     Good luck,
>>     Csongor
>>
>>     jad al wrote: 
>>
>>
>>
>>
>>         Hello,
>>          
>>         I am having a very hard time manipulating my ontology from
>>         ProtegeScriptTab. From python script I do:
>>         >>> HostClass =owlModel.getOWLNamedClass("Host")
>>         I keep getting the same error:
>>         Traceback (innermost last):
>>           File "<string>", line 1, in ?
>>         NameError: owlModel
>>         exception from Jython: Traceback (innermost last):
>>           File "<string>", line 1, in ?
>>         NameError: owlModel
>>         : Traceback (innermost last):
>>           File "<string>", line 1, in ?
>>         NameError: owlModel
>>
>>         I tried the to follow
>>         the http://protege.cim3.net/cgi-bin/wiki.pl?ProtegeScriptTab#nid8FT 
>>         procedure, but no luck.  Please any help
>>          
>>          
>>         Many thanks
>>          
>>
>>         > From: tar at ISI.EDU <mailto:tar at ISI.EDU>
>>         > To: protege-discussion at lists.stanford.edu
>>         <mailto:protege-discussion at lists.stanford.edu>
>>         > Date: Mon, 9 Feb 2009 12:44:01 -0800
>>         > Subject: Re: [protege-discussion] (no subject)
>>         > 
>>         > 
>>         > On Feb 8, 2009, at 10:15 AM, Adrian Suter wrote:
>>         > 
>>         > > Hello,
>>         > >
>>         > > I like to have an ImageMapWidget under OWL. With the Project Type 
>>         > > Frame it works as soon i define a slot of type "Symbol" . 
>>         > > Unfortunately i cant't find a property type "symbol" under the 
>>         > > projecttyp "OWL".
>>         > > What do i have to do?
>>         > 
>>         > Symbol is not an RDF or OWL datatype, so that's why there is no such
>>         > slot type.
>>         > 
>>         > I don't know if there is an ImageMapWidget. I couldn't find mention 
>>         > of it anywhere. But I did locate this:
>>         > 
>>         > http://protegewiki.stanford.edu/index.php/DisplayImages
>>         > 
>>         > 
>>         > 
>>         > 
>>         > _______________________________________________
>>         > protege-discussion mailing list
>>         > protege-discussion at lists.stanford.edu
>>         <mailto: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 
>>
>>
>>         ------------------------------------------------------------------------
>>         Windows Live™: E-mail. Chat. Share. Get more ways to
>>         connect. Check it out.
>>         <http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_allup_explore_022009>
>>         ------------------------------------------------------------------------
>>         Windows Live™: E-mail. Chat. Share. Get more ways to
>>         connect. Check it out.
>>         <http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_allup_explore_022009>
>>
>>         ------------------------------------------------------------------------
>>         _______________________________________________
>>         protege-discussion mailing list
>>         protege-discussion at lists.stanford.edu <mailto: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 
>>           
>>
>>
>>
>>     ------------------------------------------------------------------------
>>     Windows Live™: E-mail. Chat. Share. Get more ways to
>>     connect. Check it out.
>>     <http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_AE_Faster_022009>
>>
>>     ------------------------------------------------------------------------
>>     _______________________________________________
>>     protege-discussion mailing list
>>     protege-discussion at lists.stanford.edu <mailto: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 
>>       
>>
>>
>>
>> ------------------------------------------------------------------------
>> Windows Live™: Keep your life in sync. Check it out. 
>> <http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_022009>_______________________________________________
>> protege-discussion mailing list
>> protege-discussion at lists.stanford.edu 
>> <mailto: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 




More information about the protege-discussion mailing list