I am looking at the https://www.w3.org/TR/owl2-mapping-to-rdf/#Mapping_from_the_Structural_Specification_to_RDF_Graphs, but I still didn't find a solution how to create the needed format, so I will be grateful if someone has some idea how to do it?

Darko


On 16.10.2016. 0:10, Darko Androcec wrote:
Yes, I am aware that it is the OWL2 and that is not supported in Jena, but is there any workaround to get the format I need? How can I manually insert enumeration into restriction?

Thanks,
Darko

On 15.10.2016. 23:36, Martynas Jusevičius wrote:
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