Looks like OWL 2 which Jena does not support.

On Sat, Oct 15, 2016 at 11:32 PM, Darko Androcec
<darkoa...@yahoo.com.invalid> wrote:
> My aim is to get the following enumerated restriction using Apache Jena:
>
>  <SubClassOf>
>         <Class IRI="http://www.equixonline.com/Grainger#TestClass"/>
>
>         <ObjectMaxCardinality cardinality="1">
>
>             <ObjectProperty
> IRI="http://www.equixonline.com/Grainger#TestObjectProperty"/>
>
>             <ObjectOneOf>
>                 <NamedIndividual
> IRI="http://www.equixonline.com/Grainger#male"/>
>                 <NamedIndividual
> IRI="http://www.equixonline.com/Grainger#female"/>
>             </ObjectOneOf>
>
>         </ObjectMaxCardinality>
>
> </SubClassOf>
>
> I tried different codes, but can't get the above restriction. If I use the
> following code:
>
> OntClass newItemClass = model.createClass(baseURI + "TestClass");
> ObjectProperty objectProperty = model.createObjectProperty(baseURI +
> "TestObjectProperty");
> MaxCardinalityRestriction restriction =
> model.createMaxCardinalityRestriction(null, objectProperty, 1);
>
> newItemClass.addSuperClass(restriction);
>
> I get max cardinality restriction without enumeration:
>
>  <SubClassOf>
>         <Class IRI="http://www.equixonline.com/Grainger#TestClass"/>
>         <ObjectMaxCardinality cardinality="1">
>             <ObjectProperty
> IRI="http://www.equixonline.com/Grainger#TestObjectProperty"/>
>         </ObjectMaxCardinality>
>     </SubClassOf>
>
> When I add the following code:
>
> Individual male = model.createIndividual(baseURI + "male", OWL.Thing);
> Individual female = model.createIndividual(baseURI + "female", OWL.Thing);
> RDFList enums = model.createList();
> enums = enums.cons(male);
> enums = enums.cons(female);
>
> OntClass newItemClass = model.createClass(baseURI + "TestClass");
> ObjectProperty objectProperty = model.createObjectProperty(baseURI +
> "TestObjectProperty");
> MaxCardinalityRestriction restriction =
> model.createMaxCardinalityRestriction(null, objectProperty, 1);
>
> restriction.addProperty(OWL.oneOf, enums);
>
> newItemClass.addSuperClass(restriction);
>
> I only get enumeration, but max cardinality restriction is nowhere to find:
>
> <SubClassOf>
>         <Class IRI="http://www.equixonline.com/Grainger#TestClass"/>
>         <ObjectOneOf>
>             <NamedIndividual
> IRI="http://www.equixonline.com/Grainger#male"/>
>             <NamedIndividual
> IRI="http://www.equixonline.com/Grainger#female"/>
>         </ObjectOneOf>
> </SubClassOf>
>
> Do you maybe know what I am doing wrong and how to get format (enumerated
> restriction) described at the beginning of this message?
>
> Thanks,
>
> Darko
>

Reply via email to