Hi Lorenz,

On 09/11/16 09:17, Lorenz B. wrote:
Hello Dave,

my question would be whether he ask how to set this singleton enumeration as

a) the range of the property or

b) used in a class expression with

b1) owl:hasValue or

b2) like you suggested to use owl:allValuesFrom

The example "desired output" RDF/XML seemed fairly clear that the goal is to create an allValuesFrom restriction.

Cheers,
Dave




Cheers,
Lorenz

On 08/11/16 14:02, Jos Lehmann wrote:
Hi there



I am new to jena and I'm trying the write the two following
restrictions into an owl (rdf/xml) ontology:



- in_category property should range over a singleton (Collection)
containing only #Bo,

You need to create an enumerated class (oneOf) containing #Bo (see
OntModel#createEnumeratedClass) and pass that class to the
allValuesFrom restriction.

- is_XXX_type should  range over a singleton containing only the
Boolean value "true"

That's OWL2 which is not supported by Jena's convenience OntAPI. So
you'll need top do this at the RDF level - create an anonymous
instance of rdfs:Datatype, create a RDFList containing boolean true
then link them with an owl:oneOf property, then again pass that to the
allValuesFrom.

Dave

My code (below) cannot write the parts of the desired output (below)
marked with ==>.



So far, I have been working to achieve the second part of the desired
output (i.e. the #is_XXX_type part), and that's my priority, but
suggestions on the first part would be welcome.





DESIRED OUTPUT



<owl:Class
rdf:about="http://www._.net/ontologies/2016/XXXs_Ontology.owl#B7";>

        <rdfs:subClassOf
rdf:resource="http://www._.net/ontologies/2016/XXXs_Ontology.owl#B"/>

        <rdfs:subClassOf
rdf:resource="http://www._.net/ontologies/2016/XXXs_Ontology.owl#T"/>

        <rdfs:subClassOf>

            <owl:Restriction>

                <owl:onProperty
rdf:resource="http://www._.net/ontologies/2016/XXXs_Ontology.owl#in_category"/>

                <owl:allValuesFrom>

==>                    <owl:Class>

==>                        <owl:oneOf rdf:parseType="Collection">

==>                            <rdf:Description
rdf:about="http://www._.net/ontologies/2016/XXXs_Ontology.owl#Bo"/>

==>                        </owl:oneOf>

==>                    </owl:Class>

                </owl:allValuesFrom>

            </owl:Restriction>

        </rdfs:subClassOf>

        <rdfs:subClassOf>

            <owl:Restriction>

                <owl:onProperty
rdf:resource="http://www._.net/ontologies/2016/XXXs_Ontology.owl#is_XXX_type"/>

                <owl:allValuesFrom>

==>                    <rdfs:Datatype>

==>                        <owl:oneOf>

==>                            <rdf:Description>

==>                                <rdf:type
rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#List"/>

==>                                <rdf:first
rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean";>true</rdf:first>

==>                                <rdf:rest
rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>

==>                            </rdf:Description>

==>                        </owl:oneOf>

                    </rdfs:Datatype>

                </owl:allValuesFrom>

            </owl:Restriction>

        </rdfs:subClassOf>

    </owl:Class>





MY CODE (note: the new class is derived from an existing individual)



                        OntClass newClass =
model2.createClass(thisInstance.toString());



                        DatatypeProperty is_XXX_type =
model2.createDatatypeProperty("http://www._.net/ontologies/2016/XXXs_Ontology.owl#is_XXX_type";);



                        is_XXX_type.setRange(XSD.xboolean);



                        Restriction restriction =
model2.createAllValuesFromRestriction(null, is_ XXX_type, XSD.xboolean);



                        newClass.addSuperClass(restriction);







MY PRESENT OUTPUT FOR THE  is_XXX_type CASE:



<owl:Class
rdf:about="http://www._.net/ontologies/2016/XXXs_Ontology.owl#B7";>

    <rdfs:subClassOf>

      <owl:Restriction>

        <owl:allValuesFrom
rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>

        <owl:onProperty>

          <owl:DatatypeProperty
rdf:about="http://www._.net/ontologies/2016/XXXs_Ontology.owl#is_XXX_type"/>

        </owl:onProperty>

      </owl:Restriction>

    </rdfs:subClassOf>

  </owl:Class>









Thank you in advance for the advice.



Jos Lehmann



Knowledge Management

Bauhaus Luftfahrt e.V.

GERMANY







Reply via email to