You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Dương Hồ <ko...@gmail.com> on 2022/07/25 14:46:17 UTC

How to fix wrong semantic rule?

hi all.
I'm using the reasoner RDFSExptRuleReasoner to enforce the rule:
With two classes X, Y if X is a subclass of Y, then X also has type Y.
Let's say I have 3 classes X,Y,Z:
X is a subclass of Y
Z is a subclass of Y

And I execute the query :
If A has type Y
And B has type Y
then A and B are the same.

=> Then I get X same as Y
But semantically, X is completely different from Y.
How can I handle this case?

Re: Re: How to fix wrong semantic rule?

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
Apparently I'm a bit lost as I still do not understand how the current 
inferences are generated.

You did not mention how you run Jena at all and how you setup 
inferencing. I also mentioned that there is no such reasoner class in 
the official Jena source code and we're not aware of your custom code.

All I got so far is that

?x rdfs:subClassOf ?y => ?x rdf:type ?y


It's not uncommon to have this kind of inference e.g. in biological domain

If you don't want to get that, the question would be more why you get 
that. This is **not** a standard inference in RDFS.


Nevertheless I cannot help as I do not understand neither

i) the current setup in Jena

ii) what inferences are currently returned

iii) what inferences are intended to be returned


Please answer all those points as precise as possible.

On 26.07.22 10:30, Dương Hồ wrote:
> Oh Sorry !
> That isn't what i'm wondering.
> that is true inferences. But i don't want get that.
>
> Vào Th 3, 26 thg 7, 2022 vào lúc 14:45 Andy Seaborne <an...@apache.org> đã
> viết:
>
>>
>> On 26/07/2022 08:36, Dương Hồ wrote:
>>> If X is a subclass of Y,
>>> then an instance of X is of type Y.
>>>
>>> yes.
>>> In Class X I have instance :X
>> If you say something is a class and also it is an instance (it is in the
>> class), you are going to get some weird inferences. You have a set that
>> is a member of itself.
>>
>> As already asked: Show us the data and rules (a small, complete example).
>>
>>       Andy
>>
>>> so this look like
>>>
>>> Vào Th 3, 26 thg 7, 2022 vào lúc 14:33 Andy Seaborne <an...@apache.org>
>> đã
>>> viết:
>>>
>>>>
>>>> On 25/07/2022 16:17, Lorenz Buehmann wrote:
>>>>> Good Afternoon.
>>>>>
>>>>>
>>>>> There is no such RDFSExptRuleReasoner reasoner in standard Jena, or I
>>>>> just cannot find the code in https://github.com/apache/jena
>>>>>
>>>>> So I don't know what you're referring to. Can you explain this please?
>>>>>
>>>>>
>>>>>> hi all.
>>>>>> I'm using the reasoner RDFSExptRuleReasoner to enforce the rule:
>>>>>> With two classes X, Y if X is a subclass of Y, then X also has type Y.
>>>>> Ok, so where is the rule Jena rule syntax?
>>>> If X is a subclass of Y,
>>>> then an instance of X is of type Y.
>>>>
>>>> not, X is of type Y.
>>>>
>>>> :a rdf:type :X .
>>>> =>
>>>> :a rdf:type :Y .
>>>>
>>>>>> Let's say I have 3 classes X,Y,Z:
>>>>>> X is a subclass of Y
>>>>>> Z is a subclass of Y
>>>>>>
>>>>>> And I execute the query :
>>>>>> If A has type Y
>>>>>> And B has type Y
>>>>>> then A and B are the same.
>>>>> Now you are talking about queries. How do you execute the "query"?
>>>>>
>>>>> Also, in which domain does this hold? If John is a person and Mary is a
>>>>> person, both are the same individual wouldn't maker sense so I'm
>>>>> interested in your data.
>>>>>
>>>>>> => Then I get X same as Y
>>>>> I don't get that conclusion via A and B, also what do you mean by
>> "get"?
>>>>>> But semantically, X is completely different from Y.
>>>>>> How can I handle this case?
>>>>>>
>>>>> We should start with sample data and the sample rules I guess

Re: How to fix wrong semantic rule?

Posted by Dương Hồ <ko...@gmail.com>.
Oh Sorry !
That isn't what i'm wondering.
that is true inferences. But i don't want get that.

Vào Th 3, 26 thg 7, 2022 vào lúc 14:45 Andy Seaborne <an...@apache.org> đã
viết:

>
>
> On 26/07/2022 08:36, Dương Hồ wrote:
> > If X is a subclass of Y,
> > then an instance of X is of type Y.
> >
> > yes.
> > In Class X I have instance :X
>
> If you say something is a class and also it is an instance (it is in the
> class), you are going to get some weird inferences. You have a set that
> is a member of itself.
>
> As already asked: Show us the data and rules (a small, complete example).
>
>      Andy
>
> > so this look like
> >
> > Vào Th 3, 26 thg 7, 2022 vào lúc 14:33 Andy Seaborne <an...@apache.org>
> đã
> > viết:
> >
> >>
> >>
> >> On 25/07/2022 16:17, Lorenz Buehmann wrote:
> >>> Good Afternoon.
> >>>
> >>>
> >>> There is no such RDFSExptRuleReasoner reasoner in standard Jena, or I
> >>> just cannot find the code in https://github.com/apache/jena
> >>>
> >>> So I don't know what you're referring to. Can you explain this please?
> >>>
> >>>
> >>>> hi all.
> >>>> I'm using the reasoner RDFSExptRuleReasoner to enforce the rule:
> >>>> With two classes X, Y if X is a subclass of Y, then X also has type Y.
> >>> Ok, so where is the rule Jena rule syntax?
> >>
> >> If X is a subclass of Y,
> >> then an instance of X is of type Y.
> >>
> >> not, X is of type Y.
> >>
> >> :a rdf:type :X .
> >> =>
> >> :a rdf:type :Y .
> >>
> >>>> Let's say I have 3 classes X,Y,Z:
> >>>> X is a subclass of Y
> >>>> Z is a subclass of Y
> >>>>
> >>>> And I execute the query :
> >>>> If A has type Y
> >>>> And B has type Y
> >>>> then A and B are the same.
> >>>
> >>> Now you are talking about queries. How do you execute the "query"?
> >>>
> >>> Also, in which domain does this hold? If John is a person and Mary is a
> >>> person, both are the same individual wouldn't maker sense so I'm
> >>> interested in your data.
> >>>
> >>>>
> >>>> => Then I get X same as Y
> >>> I don't get that conclusion via A and B, also what do you mean by
> "get"?
> >>>> But semantically, X is completely different from Y.
> >>>> How can I handle this case?
> >>>>
> >>> We should start with sample data and the sample rules I guess
> >>
> >
>

Re: How to fix wrong semantic rule?

Posted by Andy Seaborne <an...@apache.org>.

On 26/07/2022 08:36, Dương Hồ wrote:
> If X is a subclass of Y,
> then an instance of X is of type Y.
> 
> yes.
> In Class X I have instance :X

If you say something is a class and also it is an instance (it is in the 
class), you are going to get some weird inferences. You have a set that 
is a member of itself.

As already asked: Show us the data and rules (a small, complete example).

     Andy

> so this look like
> 
> Vào Th 3, 26 thg 7, 2022 vào lúc 14:33 Andy Seaborne <an...@apache.org> đã
> viết:
> 
>>
>>
>> On 25/07/2022 16:17, Lorenz Buehmann wrote:
>>> Good Afternoon.
>>>
>>>
>>> There is no such RDFSExptRuleReasoner reasoner in standard Jena, or I
>>> just cannot find the code in https://github.com/apache/jena
>>>
>>> So I don't know what you're referring to. Can you explain this please?
>>>
>>>
>>>> hi all.
>>>> I'm using the reasoner RDFSExptRuleReasoner to enforce the rule:
>>>> With two classes X, Y if X is a subclass of Y, then X also has type Y.
>>> Ok, so where is the rule Jena rule syntax?
>>
>> If X is a subclass of Y,
>> then an instance of X is of type Y.
>>
>> not, X is of type Y.
>>
>> :a rdf:type :X .
>> =>
>> :a rdf:type :Y .
>>
>>>> Let's say I have 3 classes X,Y,Z:
>>>> X is a subclass of Y
>>>> Z is a subclass of Y
>>>>
>>>> And I execute the query :
>>>> If A has type Y
>>>> And B has type Y
>>>> then A and B are the same.
>>>
>>> Now you are talking about queries. How do you execute the "query"?
>>>
>>> Also, in which domain does this hold? If John is a person and Mary is a
>>> person, both are the same individual wouldn't maker sense so I'm
>>> interested in your data.
>>>
>>>>
>>>> => Then I get X same as Y
>>> I don't get that conclusion via A and B, also what do you mean by "get"?
>>>> But semantically, X is completely different from Y.
>>>> How can I handle this case?
>>>>
>>> We should start with sample data and the sample rules I guess
>>
> 

Re: How to fix wrong semantic rule?

Posted by Dương Hồ <ko...@gmail.com>.
If X is a subclass of Y,
then an instance of X is of type Y.

yes.
In Class X I have instance :X
so this look like

Vào Th 3, 26 thg 7, 2022 vào lúc 14:33 Andy Seaborne <an...@apache.org> đã
viết:

>
>
> On 25/07/2022 16:17, Lorenz Buehmann wrote:
> > Good Afternoon.
> >
> >
> > There is no such RDFSExptRuleReasoner reasoner in standard Jena, or I
> > just cannot find the code in https://github.com/apache/jena
> >
> > So I don't know what you're referring to. Can you explain this please?
> >
> >
> >> hi all.
> >> I'm using the reasoner RDFSExptRuleReasoner to enforce the rule:
> >> With two classes X, Y if X is a subclass of Y, then X also has type Y.
> > Ok, so where is the rule Jena rule syntax?
>
> If X is a subclass of Y,
> then an instance of X is of type Y.
>
> not, X is of type Y.
>
> :a rdf:type :X .
> =>
> :a rdf:type :Y .
>
> >> Let's say I have 3 classes X,Y,Z:
> >> X is a subclass of Y
> >> Z is a subclass of Y
> >>
> >> And I execute the query :
> >> If A has type Y
> >> And B has type Y
> >> then A and B are the same.
> >
> > Now you are talking about queries. How do you execute the "query"?
> >
> > Also, in which domain does this hold? If John is a person and Mary is a
> > person, both are the same individual wouldn't maker sense so I'm
> > interested in your data.
> >
> >>
> >> => Then I get X same as Y
> > I don't get that conclusion via A and B, also what do you mean by "get"?
> >> But semantically, X is completely different from Y.
> >> How can I handle this case?
> >>
> > We should start with sample data and the sample rules I guess
>

Re: How to fix wrong semantic rule?

Posted by Andy Seaborne <an...@apache.org>.

On 25/07/2022 16:17, Lorenz Buehmann wrote:
> Good Afternoon.
> 
> 
> There is no such RDFSExptRuleReasoner reasoner in standard Jena, or I 
> just cannot find the code in https://github.com/apache/jena
> 
> So I don't know what you're referring to. Can you explain this please?
> 
> 
>> hi all.
>> I'm using the reasoner RDFSExptRuleReasoner to enforce the rule:
>> With two classes X, Y if X is a subclass of Y, then X also has type Y.
> Ok, so where is the rule Jena rule syntax?

If X is a subclass of Y,
then an instance of X is of type Y.

not, X is of type Y.

:a rdf:type :X .
=>
:a rdf:type :Y .

>> Let's say I have 3 classes X,Y,Z:
>> X is a subclass of Y
>> Z is a subclass of Y
>>
>> And I execute the query :
>> If A has type Y
>> And B has type Y
>> then A and B are the same.
> 
> Now you are talking about queries. How do you execute the "query"?
> 
> Also, in which domain does this hold? If John is a person and Mary is a 
> person, both are the same individual wouldn't maker sense so I'm 
> interested in your data.
> 
>>
>> => Then I get X same as Y
> I don't get that conclusion via A and B, also what do you mean by "get"?
>> But semantically, X is completely different from Y.
>> How can I handle this case?
>>
> We should start with sample data and the sample rules I guess

Re: How to fix wrong semantic rule?

Posted by Dương Hồ <ko...@gmail.com>.
Sorry.
Now I have 3 Classes :
PHP is a subClass of Backend.
Java is a subClass of Backend.

if I use reasoner so I have
PHP type Backend.
Java type Backend.

so if i use query i get :
PHP same Java

But i want PHP different Java.
So how to fix this?

Vào Th 2, 25 thg 7, 2022 vào lúc 22:17 Lorenz Buehmann <
buehmann@informatik.uni-leipzig.de> đã viết:

> Good Afternoon.
>
>
> There is no such RDFSExptRuleReasoner reasoner in standard Jena, or I
> just cannot find the code in https://github.com/apache/jena
>
> So I don't know what you're referring to. Can you explain this please?
>
>
> > hi all.
> > I'm using the reasoner RDFSExptRuleReasoner to enforce the rule:
> > With two classes X, Y if X is a subclass of Y, then X also has type Y.
> Ok, so where is the rule Jena rule syntax?
> > Let's say I have 3 classes X,Y,Z:
> > X is a subclass of Y
> > Z is a subclass of Y
> >
> > And I execute the query :
> > If A has type Y
> > And B has type Y
> > then A and B are the same.
>
> Now you are talking about queries. How do you execute the "query"?
>
> Also, in which domain does this hold? If John is a person and Mary is a
> person, both are the same individual wouldn't maker sense so I'm
> interested in your data.
>
> >
> > => Then I get X same as Y
> I don't get that conclusion via A and B, also what do you mean by "get"?
> > But semantically, X is completely different from Y.
> > How can I handle this case?
> >
> We should start with sample data and the sample rules I guess
>

Re: How to fix wrong semantic rule?

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
Good Afternoon.


There is no such RDFSExptRuleReasoner reasoner in standard Jena, or I 
just cannot find the code in https://github.com/apache/jena

So I don't know what you're referring to. Can you explain this please?


> hi all.
> I'm using the reasoner RDFSExptRuleReasoner to enforce the rule:
> With two classes X, Y if X is a subclass of Y, then X also has type Y.
Ok, so where is the rule Jena rule syntax?
> Let's say I have 3 classes X,Y,Z:
> X is a subclass of Y
> Z is a subclass of Y
>
> And I execute the query :
> If A has type Y
> And B has type Y
> then A and B are the same.

Now you are talking about queries. How do you execute the "query"?

Also, in which domain does this hold? If John is a person and Mary is a 
person, both are the same individual wouldn't maker sense so I'm 
interested in your data.

>
> => Then I get X same as Y
I don't get that conclusion via A and B, also what do you mean by "get"?
> But semantically, X is completely different from Y.
> How can I handle this case?
>
We should start with sample data and the sample rules I guess