You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Yang-Min KIM <ya...@microbiome.studio> on 2023/02/03 10:16:14 UTC

How to implicitly integrate OWL ontology?

Dear Jena community,

I hope your day is going great.
I have a question about the ontology: we want to request an ontoogy 
data A that also import another ontology OWL-B.

e.g.

A includes:
	John is Male.
	John has a daughter called Monica.

OWL-B includes:
	Daughter is subclass of Children. (rdfs:subClassOf)
	If X is Male and has Children Y, X is father of Y. (owl:inverseOf)

What I want to query:
	Who is Monica's father?

Expected response:
	John


To get expected response, Jena needs to include OWL-B then manage 
implicit statement. However, I got results by explicit querying only: 
Who is John's daughter? -> Monica

I'm sure there is a solution since I see "The OWL reasoner" in 
<https://jena.apache.org/documentation/inference/index.html#owl>

Are there additional steps to include Ontology structure? (We are using 
Fuseki's API REST)
Is it better to import OWL-B as a default graph or a named graph? and 
what if we have several OWL files to import?

P.S. here is an example of our OWL file, BIolink Model, downloadable 
via 
<https://github.com/biolink/biolink-model/blob/master/biolink-model.ttl>

Thank you for your time.


Re: How to implicitly integrate OWL ontology?

Posted by Dave Reynolds <da...@gmail.com>.
On 06/02/2023 09:42, Yang-Min KIM wrote:
> Le lun., févr. 6 2023 at 10:30:17 +0100, Lorenz Buehmann 
> <bu...@informatik.uni-leipzig.de> a écrit :
>> SWRL
> 
> Dear Dave and Lorenz,
> 
> Thank you for your reply!
> As I am a beginner in ontology, I do not yet know all the different 
> terms, e.g. SWRL, I'm checking!
> 
> My exemple (father-child...etc) is not related to the link (Biolink 
> Model), and actually Biolink Model provides also in OWL (ttl) format: 
> <https://github.com/biolink/biolink-model/blob/master/biolink-model.owl.ttl>
> 
> I don't code in Java, but as advised by Dave, I'll see the Fuseki 's 
> "Inference" section.

Ah, if you don't code in java then ignore that bit of advice. Stick to 
using fuseki and just configuring it. But do start with a smaller example.

Dave



Re: Re: Re: How to implicitly integrate OWL ontology?

Posted by Yang-Min KIM <ya...@microbiome.studio>.
You're right, I should have shown you a real concrete example from the 
beginning.

In Biolink Model ontology "has_catalyst" property is defined as below 
(<https://github.com/biolink/biolink-model/blob/master/biolink-model.owl.ttl>, 
line 4010):

	*biolink:has_catalyst* a owl:ObjectProperty ;
		rdfs:label "has catalyst" ;
		rdfs:domain biolink:MolecularActivity ;
		rdfs:range biolink:NucleicAcidEntity ;
		rdfs:subPropertyOf biolink:has_participant ;
		*owl:inverseOf biolink:catalyzes .*


And reciprocally "catalyzes" property (line 3532):

	*biolink:catalyzes* a owl:ObjectProperty ;
		rdfs:label "catalyzes" ;
		rdfs:domain biolink:NucleicAcidEntity ;
		rdfs:range biolink:MolecularActivity ;
		rdfs:subPropertyOf biolink:participates_in ;
		*owl:inverseOf biolink:has_catalyst* ;
		biolink:canonical_predicate "True" .


So `*biolink:has_catalyst*` and `*biolink:catalyzes*` are two 
properties  with inverse relation.


My data:
	ex:A biolink:has_catalyst ex:B

We can request:
	SELECT ?enzyme
	WHERE {
		ex:A biolink:has_catalyst ?enzyme .
	}

to get ex:B as reulst.
Thanks to `owl:inverseOf`, we could request in the reverse way ("What 
does catalyse ex:A?"):

	SELECT ?enzyme
	WHERE {
		?enzyme biolink:catalyzes ex:A .
	}

which does not work for me because the Biolink Model ontology is not 
yet correctly integrated.

Le lun., févr. 6 2023 at 11:08:38 +0100, Lorenz Buehmann 
<bu...@informatik.uni-leipzig.de> a écrit :
> Ok, but if your example isn't related to the link, how is the link 
> related to your current issue?
> 
> Can you share the ontology with the father relation where the 
> inference doesn't work for you?
> 
> On 06.02.23 10:42, Yang-Min KIM wrote:
>> Le lun., févr. 6 2023 at 10:30:17 +0100, Lorenz Buehmann 
>> <buehmann@informatik.uni-leipzig.de 
>> <ma...@informatik.uni-leipzig.de>> a écrit :
>>> SWRL
>> 
>> Dear Dave and Lorenz,
>> 
>> Thank you for your reply!
>> As I am a beginner in ontology, I do not yet know all the different 
>> terms, e.g. SWRL, I'm checking!
>> 
>> My exemple (father-child...etc) is not related to the link (Biolink 
>> Model), and actually Biolink Model provides also in OWL (ttl) 
>> format: 
>> <<https://github.com/biolink/biolink-model/blob/master/biolink-model.owl.ttl>>
>> 
>> I don't code in Java, but as advised by Dave, I'll see the Fuseki 's 
>> "Inference" section.
>> I will be back to you if I have any further problems.
>> 
>> Have a nice day,
>> Min
>> 
>> 
>> 
>> 


Re: Re: Re: How to implicitly integrate OWL ontology?

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
Ok, but if your example isn't related to the link, how is the link 
related to your current issue?

Can you share the ontology with the father relation where the inference 
doesn't work for you?

On 06.02.23 10:42, Yang-Min KIM wrote:
> Le lun., févr. 6 2023 at 10:30:17 +0100, Lorenz Buehmann 
> <bu...@informatik.uni-leipzig.de> a écrit :
>> SWRL
>
> Dear Dave and Lorenz,
>
> Thank you for your reply!
> As I am a beginner in ontology, I do not yet know all the different 
> terms, e.g. SWRL, I'm checking!
>
> My exemple (father-child...etc) is not related to the link (Biolink 
> Model), and actually Biolink Model provides also in OWL (ttl) format: 
> <https://github.com/biolink/biolink-model/blob/master/biolink-model.owl.ttl>
>
> I don't code in Java, but as advised by Dave, I'll see the Fuseki 's 
> "Inference" section.
> I will be back to you if I have any further problems.
>
> Have a nice day,
> Min
>
>
>
>

Re: Re: How to implicitly integrate OWL ontology?

Posted by Yang-Min KIM <ya...@microbiome.studio>.
Le lun., févr. 6 2023 at 10:30:17 +0100, Lorenz Buehmann 
<bu...@informatik.uni-leipzig.de> a écrit :
> SWRL

Dear Dave and Lorenz,

Thank you for your reply!
As I am a beginner in ontology, I do not yet know all the different 
terms, e.g. SWRL, I'm checking!

My exemple (father-child...etc) is not related to the link (Biolink 
Model), and actually Biolink Model provides also in OWL (ttl) format: 
<https://github.com/biolink/biolink-model/blob/master/biolink-model.owl.ttl>

I don't code in Java, but as advised by Dave, I'll see the Fuseki 's 
"Inference" section.
I will be back to you if I have any further problems.

Have a nice day,
Min




Re: Re: How to implicitly integrate OWL ontology?

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
Hi,

in addition to the comments of Dave:

On 03.02.23 11:16, Yang-Min KIM wrote:
>
> OWL-B includes:
>     Daughter is subclass of Children. (rdfs:subClassOf)
Minor: use singular form for class named, i.e. Child
>     If X is Male and has Children Y, X is father of Y. (owl:inverseOf)

That doesn't sound like an owl:inverse statement, but more like an SWRL 
rule. An owl:inverse does only state property p is inverse of property 
q, thus, we can infer for any p(x, y) it also holds q(y, x)

Is it a rule or are those really OWL axioms? I doubt you can express 
that in OWL though without using SWRL. If it is SWRL, then you will a) 
use Pellet as reasoner or b) write that rule as a custom Jena rule

As Dave mentioned, you example ontology doesn't cover the domain you 
describe. At least I could find any entity denoted "father" or similar.


Lorenz

On 06.02.23 10:19, Dave Reynolds wrote:
> To configure use of a reasoner with fuseki see 
> https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html 
> under the section "Inference".
>
> The reasoners are not graph-aware so the union of your ontology and 
> your instance data all need to appear in the default graph. Either by 
> loading them there directly OR by loading them as separate graphs and 
> setting default union flag.
>
> However, the link you provide to your ontology doesn't match your 
> prose example in any way at all. In particular it seems to be a mix of 
> skos and linkml (whatever that is) and I see virtual no OWL in in 
> there.[*] Though it is a 1.3Mb turtle file so who knows what's 
> lurking. So on the face of it there's no OWL to reason over and you 
> won't get any useful results.
>
> My advice would be to isolate a smaller test example of the kind of 
> reasoning you are trying to do and check that programmatically see 
> https://jena.apache.org/documentation/inference/index.html#OWLexamples
>
> Then, if it seems like inference does work, you can tackle the 
> separate problem of setting that up within fuseki.
>
> Dave
>
> [*] In particular there's no use of rdfs:subClassOf. There are 188 
> owl:inverseOf states but they are applied to things of type 
> linkml:SlotDefinition which makes no sense at all.
>
> On 03/02/2023 10:16, Yang-Min KIM wrote:
>> Dear Jena community,
>>
>> I hope your day is going great.
>> I have a question about the ontology: we want to request an ontoogy 
>> data A that also import another ontology OWL-B.
>>
>> e.g.
>>
>> A includes:
>>      John is Male.
>>      John has a daughter called Monica.
>>
>> OWL-B includes:
>>      Daughter is subclass of Children. (rdfs:subClassOf)
>>      If X is Male and has Children Y, X is father of Y. (owl:inverseOf)
>>
>> What I want to query:
>>      Who is Monica's father?
>>
>> Expected response:
>>      John
>>
>>
>> To get expected response, Jena needs to include OWL-B then manage 
>> implicit statement. However, I got results by explicit querying only: 
>> Who is John's daughter? -> Monica
>>
>> I'm sure there is a solution since I see "The OWL reasoner" in 
>> <https://jena.apache.org/documentation/inference/index.html#owl>
>>
>> Are there additional steps to include Ontology structure? (We are 
>> using Fuseki's API REST)
>> Is it better to import OWL-B as a default graph or a named graph? and 
>> what if we have several OWL files to import?
>>
>> P.S. here is an example of our OWL file, BIolink Model, downloadable 
>> via 
>> <https://github.com/biolink/biolink-model/blob/master/biolink-model.ttl>
>>
>> Thank you for your time.
>>
>>

Re: How to implicitly integrate OWL ontology?

Posted by Dave Reynolds <da...@gmail.com>.
To configure use of a reasoner with fuseki see 
https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html 
under the section "Inference".

The reasoners are not graph-aware so the union of your ontology and your 
instance data all need to appear in the default graph. Either by loading 
them there directly OR by loading them as separate graphs and setting 
default union flag.

However, the link you provide to your ontology doesn't match your prose 
example in any way at all. In particular it seems to be a mix of skos 
and linkml (whatever that is) and I see virtual no OWL in in there.[*] 
Though it is a 1.3Mb turtle file so who knows what's lurking. So on the 
face of it there's no OWL to reason over and you won't get any useful 
results.

My advice would be to isolate a smaller test example of the kind of 
reasoning you are trying to do and check that programmatically see 
https://jena.apache.org/documentation/inference/index.html#OWLexamples

Then, if it seems like inference does work, you can tackle the separate 
problem of setting that up within fuseki.

Dave

[*] In particular there's no use of rdfs:subClassOf. There are 188 
owl:inverseOf states but they are applied to things of type 
linkml:SlotDefinition which makes no sense at all.

On 03/02/2023 10:16, Yang-Min KIM wrote:
> Dear Jena community,
> 
> I hope your day is going great.
> I have a question about the ontology: we want to request an ontoogy data 
> A that also import another ontology OWL-B.
> 
> e.g.
> 
> A includes:
>      John is Male.
>      John has a daughter called Monica.
> 
> OWL-B includes:
>      Daughter is subclass of Children. (rdfs:subClassOf)
>      If X is Male and has Children Y, X is father of Y. (owl:inverseOf)
> 
> What I want to query:
>      Who is Monica's father?
> 
> Expected response:
>      John
> 
> 
> To get expected response, Jena needs to include OWL-B then manage 
> implicit statement. However, I got results by explicit querying only: 
> Who is John's daughter? -> Monica
> 
> I'm sure there is a solution since I see "The OWL reasoner" in 
> <https://jena.apache.org/documentation/inference/index.html#owl>
> 
> Are there additional steps to include Ontology structure? (We are using 
> Fuseki's API REST)
> Is it better to import OWL-B as a default graph or a named graph? and 
> what if we have several OWL files to import?
> 
> P.S. here is an example of our OWL file, BIolink Model, downloadable via 
> <https://github.com/biolink/biolink-model/blob/master/biolink-model.ttl>
> 
> Thank you for your time.
> 
>