You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by 朱曼 <zh...@gmail.com> on 2011/04/27 06:50:44 UTC
problem on creating classes with Jena
Hi all,
I have a problem on creating classes with Jena. I created an anonymous
OntClass with OntClass con = model.createClass(), and I want this class to
be existancial restricted like "exists property.owlthing", how should I
further modify this OntClass con?
Many thanks!
All my best!
June
Re: problem on creating classes with Jena
Posted by Ian Dickinson <ia...@epimorphics.com>.
Hi June,
On 27/04/11 05:50, 朱曼 wrote:
> I have a problem on creating classes with Jena. I created an anonymous
> OntClass with OntClass con = model.createClass(), and I want this class to
> be existancial restricted like "exists property.owlthing", how should I
> further modify this OntClass con?
If you want to create a new class description, use the various
createXXRestriction methods in OntModel, e.g: http://goo.gl/R6CLI
If instead you have an existing resource denoting an owl:Class, and you
want to change it to be an owl:Restriction, you can use the
convertToRestriction() method on OntClass, and subsequently the various
convertToXXRestriction methods on Restriction.
Failing that, you can just add the triple you need directly to the
model, since all state in an OntModel is contained in the model itself,
not in the various OntClass, etc, wrapper classes.
Please note that Jena doesn't yet support OWL 2.0 specific restriction
types with convenience classes, though you can of course add the
necessary triples to the model.
Ian
--
____________________________________________________________
Ian Dickinson Epimorphics Ltd, Bristol, UK
mailto:ian@epimorphics.com http://www.epimorphics.com
cell: +44-7786-850536 landline: +44-1275-399069
------------------------------------------------------------
Epimorphics Ltd. is a limited company registered in England
(no. 7016688). Registered address: Court Lodge, 105 High St,
Portishead, Bristol BS20 6PT, UK