Search Mailing List Archives
[protege-discussion] Create java beans from Protege
Csongor Nyulas
csongor.nyulas at stanford.edu
Mon Sep 15 17:44:29 PDT 2008
Hi John,
The code generated by the Protege OWL Java Code Generator is "Java
bean-like", i.e. although it does not treat boolean datatype properties
specially, creating isProperty() methods, it will create getProperty and
setProperty() methods for all properties, including for boolean datatype
properties.
For example, if your class X has 3 properties associated through
restrictions, let's say isRound (of type boolean), floatValue (of type
float), hasSrtingValue (of type String), then the code generator will
indeed create the methods:
setIsRound()
getIsRound()
setFloatValue()
getFloatValue()
setHasStringValue()
getHasStringValue()
Please be aware that the above functions take/return values of the
specified types of the datatype properties if and only if the above
properties are declared _functional_. Otherwise they take as argument
resp. return a collection of boolean/float/String values.
In order the generated API to offer a more complete set of accessing
functions to the underlying ontological model there are also some other
convenience methods generated for each property, like the method
hasProperty(), and for non-functional properties also addProperty(),
removeProperty() and listProperty(). In the current implemention there
is no option for disabling the generation of these additional methods,
and I would recommend to simply ignore them. If this is not possible in
your case you can change the Protege OWL Java Code Generator (available
in the SVN repository of the Protege
http://smi-protege.stanford.edu/svn/owl/trunk/src/edu/stanford/smi/protegex/owl/javacode/)
to generate only the methods that you need.
I hope this helps,
Csongor
John Chrysakis wrote:
> Yes, but this feature does not create java bean classes. I need just
> an automatic way,
> to get all boolean datatype propertes and create the corresponding
> isProperty() methods and
> the getProperty() setProperty() methods for the rest of the ontology
> properties...
>
> any help?
>
> Many thanks,
> ,,John,,
>
> On Fri, Sep 12, 2008 at 7:32 PM, Csongor Nyulas
> <csongor.nyulas at stanford.edu <mailto:csongor.nyulas at stanford.edu>> wrote:
>
> Have you tried the Protege OWL Java code generator accessible through
> the menu:
> Code -> Generate Protege-OWL Java Code ?
>
> Csongor
>
> John Chrysakis wrote:
> > Hello to everybody,
> >
> > I am looking for a way to create java beans from Protege.
> >
> > OntologyBeanGenerator is suitable for Jase Use. But I need something
> > more generic and simple.
> >
> > I found Jsave (http://protegewiki.stanford.edu/index.php/JSave)
> but it
> > didn't work
> > for my project files.
> >
> > Any ideas?
> >
> > Thanks in advance!
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > 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
> <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