Hello,
thanks for all the suggestions.

It seems that the issue here was indeed lack of support of owl:oneOf and
not owl:allValuesFrom as I initially thought. Here is the relevant part of
the OWL file where both constructs are present (for future reference):

<myOnt/person_1> rdf:type owl:NamedIndividual ,
>                           <myOnt/Person> ,
>                           [ rdf:type owl:Restriction ;
>                             owl:onProperty <myOnt/hasPet> ;
>                             *owl:allValuesFrom* [ rdf:type owl:Class ;
>                                     *owl:oneOf* ( <myOnt/cat_1>)
>                                   ]
>                           ] ;
>                  <myOnt/hasPet> <myOnt/cat_1> .


Thanks for pointing that out.

On the other hand I could replace

owl:oneOf ( <myOnt/cat_1>)


with

owl:cardinality "1"^^xsd:nonNegativeInteger"


owl:cardinality with cardinality <= 1 is supported by Jena according to the
docs at https://jena.apache.org/documentation/inference/#owl.
Unfortunately, "select ?p where {?p rdf:type myOnt:CatPerson}" still does
not yield person_1 in Jena in that case. Why? Is it because owl:cardinality
restriction is used here on an individual and not on a class and that is
something which is not supported by Jena? I couldn't find anything on that
in the docs. Though I am also not sure if OWL 1.1 supports owl:cardinality
on individuals.

Fundamentally, my question would be: how do I "close the world" in Jena for
individuals so person_1 gets inferred to be of CatPerson class?

Best regards,
Jakub

PS. In the first post I was using an ad-hoc notation but it led to
unnecessary confusion. Next time I'll just post raw Protege output (e.g. in
Turtle). Regarding Openlet, it would be great to work with OWL2.
Unfortunately I do not have time to look into its integration with Jena. As
I understand it, OWL 1.1 is sufficient enough to express equivalency
between a class and an anonymous class that uses complex expressions
containing owl:oneOf, owl:allValuesFrom and owl:cardinality.

pon., 6 gru 2021 o 07:18 Lorenz Buehmann <[email protected]>
napisał(a):
>
>   @Steve
>
> > Which reasoner are you using?  Have you tried openllet (Pellet for
> > Jena) to see if you get the desired result?
> works only with Jena 3.X
>
> > Which reasoner are you using?  Have you tried openllet (Pellet for
> > Jena) to see if you get the desired result?
> that look like a mix of Manchester OWL syntax and DL syntax. At least
> it's no standard notation
>
>
> @Luis
>
> On 06.12.21 06:25, Luis Enrique Ramos García wrote:
> >
> > The point here, and hope to be corrected by anybody else if I am wrong,
is
> > that you are using sparql, which is rdf based. Then, you can only query
> >
> > asserted, not inferred knowledge.
> In Jena you can run SPARQL queries on a model that is backed by some
> inference mechanism.
> >
> > Some engines like blazegraph, let you add owl reasoning, and then you
can
> > use the transitive feature of owl  (comment only as example).
> >
> > I do not know whether or not fuseki can be configured in such a way.
>
> The TE is already using a reasoner. But expressivity depends on the
> reasoner. For full OWL DL reasoning the only Jena compatible reasoner is
> Pellet, but the original code is only on Jena 2.X and the Openllet fork
> is Jena 3.X -
>
> But, and now we come to the example. The Jena docs say that
>
> > The critical constructs which go beyond OWL/lite and are not supported
> > in the Jena OWL reasoner are complementOf and oneOf.
>
> the lack of support for  "oneOf" class expression (the {cat_1} is such a
> thing) which in fact means the inference is not supported by Jena
> built-in reasoners.
>
> You can try with Jena 3.X + Openllet. Or you fork Openllet and bump to
> Jena 4.X, but I guess this needs some migration of code then.
>
> >
> >
> > Luis Ramos
> >
> >
> > El dom, 5 dic 2021 a las 15:38, Jakub Jałowiec (<
> > [email protected]>) escribió:
> >
> >> Hi,
> >> I have an OWL ontology
> >> https://github.com/kubajal/covidepid/blob/main/minimal_test.ttl.
> >> The ontology has the following definitions:
> >>
> >>>     - Person
> >>>        - CatPerson (subClassOf Person + CatPerson equivalentTo hasPet
only
> >>>        Cat)
> >>>     - Animal
> >>>        - Cat (subClassOf Animal)
> >>>     - hasPet: Person -> Animal
> >>>
> >>> and the following instances:
> >>>     - person_1: Person and (hasPet only {cat_1})
> >>>     - cat_1: Cat
> >>>     - hasPet(person_1, cat_1)
> >>>
> >>> I am using Apache Jena Fuseki 4.2.0 with the OWLFBRuleReasoner
reasoner
> >> (link to the configuration:
> >> https://github.com/kubajal/covidepid/blob/main/minimal_test_config.ttl
).
> >>
> >> I am executing the following query in Fuseki:
> >>
> >>> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> >>> PREFIX myOnt: <
> >>>
> >>
http://www.semanticweb.org/kubajal/ontologies/2021/11/untitled-ontology-157/
> >> SELECT ?s {
> >>> ?s rdf:type myOnt:CatPerson .
> >>> }
> >>
> >> No results are returned whereas I would expect person_1 to be returned
(as
> >> it is the case in e.g. Protege using Pellet).
> >> I am using
> >>
> >>
https://jena.apache.org/documentation/ontology/#more-complex-class-expressions
> >> as documentation which says that the "all values from" construct is
> >> supported  (so e.g. "CatPerson equivalentTo hasPet only Cat" should
work).
> >> Am I missing something?
> >>
> >> Best regards,
> >> Jakub
> >>

Reply via email to