You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Victor Guo <gu...@gmail.com> on 2016/05/31 12:09:59 UTC

Re: Need Help on Reasoner

Hi, Guys
    I have the following rule:

[rule1: (?x relation1 ?x2), (?x relation1 ?x3) -> (A, B, C)]

Normally, this rule should apply to the following model:

(X relation1 X2)
(X relation1 X3)

which it does apply and generate the (A, B, C) triple. However, it also
applies to the following model and generates (A, B, C):

(X relation1 X2)

which seems to me it shouldn't.

Am I understanding the reasoner syntax wrong?

Thanks

On Fri, May 27, 2016 at 1:58 PM, Victor Guo <gu...@gmail.com> wrote:

> Hi, Guys
>     I have the following rule:
>
> [rule1: (?x relation1 ?x2), (?x relation1 ?x3) -> (A, B, C)]
>
> Normally, this rule should apply to the following model:
>
> (X relation1 X2)
> (X relation1 X3)
>
> which it does apply and generate the (A, B, C) triple. However, it also
> applies to the following model and generates (A, B, C):
>
> (X relation1 X2)
>
> which seems to me it shouldn't.
>
> Am I understanding the reasoner syntax wrong?
>
> Thanks
>
>


-- 
Confidential
Copyright 2015 BeulahWorks, LLC. All Rights Reserved.
All contents included in this email, including email title, body, and
attachments,etc. are proprietary to BeulahWorks, LLC.
Contact: David A. Nevill  email: dnevill@beulahinc.com

Re: Need Help on Reasoner

Posted by Victor Guo <gu...@gmail.com>.
You are right. The problem is solved by adding notEqual(?x2, ?x3) to the
reasoner terms. Thanks for the help!
I thought ?x2 and ?x3 would by default be treated as different values, but
I was wrong.

On Tue, May 31, 2016 at 10:23 AM, A. Soroka <aj...@virginia.edu> wrote:

> There may very well be a better way to do this, but to start with you
> might be able to use the built-in primitive notEqual(?x,?y). [1]  That
> should compare URI-nodes as you would expect, by their URIs. Of course,
> it's up to you to enforce a temporary and scoped UNA inside your graph. If
> (as is the general case) different URIs can point to the same thing than
> this kind of syntax-based check doesn't work.
>
> Maybe you can say a little more about your use case? Are you trying to
> trace through chains of properties?
>
> ---
> A. Soroka
> The University of Virginia Library
>
> [1]
> https://jena.apache.org/documentation/inference/index.html#builtin-primitives
>
> > On May 31, 2016, at 10:41 AM, Victor Guo <gu...@gmail.com> wrote:
> >
> > Thanks, Soroka. That's also what I suspect. Anyone know how to make two
> > variables like ?x2 and ?x3 different in a rule?
> >
> > On Tue, May 31, 2016 at 9:14 AM, A. Soroka <aj...@virginia.edu> wrote:
> >
> >> If I understand what's happening here correctly (and someone who
> >> understands the reasoners better should correct or confirm this,
> please!),
> >> your one triple "X relation1 X2" is matching _both_ terms in your rule.
> >> Nothing in that rule says that ?x2 must be a different thing than ?x3.
> >>
> >> ---
> >> A. Soroka
> >> The University of Virginia Library
> >>
> >>
> >>> On May 31, 2016, at 8:09 AM, Victor Guo <gu...@gmail.com> wrote:
> >>>
> >>> Hi, Guys
> >>>   I have the following rule:
> >>>
> >>> [rule1: (?x relation1 ?x2), (?x relation1 ?x3) -> (A, B, C)]
> >>>
> >>> Normally, this rule should apply to the following model:
> >>>
> >>> (X relation1 X2)
> >>> (X relation1 X3)
> >>>
> >>> which it does apply and generate the (A, B, C) triple. However, it also
> >>> applies to the following model and generates (A, B, C):
> >>>
> >>> (X relation1 X2)
> >>>
> >>> which seems to me it shouldn't.
> >>>
> >>> Am I understanding the reasoner syntax wrong?
> >>>
> >>> Thanks
> >>>
> >>> On Fri, May 27, 2016 at 1:58 PM, Victor Guo <gu...@gmail.com> wrote:
> >>>
> >>>> Hi, Guys
> >>>>   I have the following rule:
> >>>>
> >>>> [rule1: (?x relation1 ?x2), (?x relation1 ?x3) -> (A, B, C)]
> >>>>
> >>>> Normally, this rule should apply to the following model:
> >>>>
> >>>> (X relation1 X2)
> >>>> (X relation1 X3)
> >>>>
> >>>> which it does apply and generate the (A, B, C) triple. However, it
> also
> >>>> applies to the following model and generates (A, B, C):
> >>>>
> >>>> (X relation1 X2)
> >>>>
> >>>> which seems to me it shouldn't.
> >>>>
> >>>> Am I understanding the reasoner syntax wrong?
> >>>>
> >>>> Thanks
> >>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> Confidential
> >>> Copyright 2015 BeulahWorks, LLC. All Rights Reserved.
> >>> All contents included in this email, including email title, body, and
> >>> attachments,etc. are proprietary to BeulahWorks, LLC.
> >>> Contact: David A. Nevill  email: dnevill@beulahinc.com
> >>
> >>
> >
> >
> > --
> > Confidential
> > Copyright 2015 BeulahWorks, LLC. All Rights Reserved.
> > All contents included in this email, including email title, body, and
> > attachments,etc. are proprietary to BeulahWorks, LLC.
> > Contact: David A. Nevill  email: dnevill@beulahinc.com
>
>


-- 
Confidential
Copyright 2015 BeulahWorks, LLC. All Rights Reserved.
All contents included in this email, including email title, body, and
attachments,etc. are proprietary to BeulahWorks, LLC.
Contact: David A. Nevill  email: dnevill@beulahinc.com

Re: Need Help on Reasoner

Posted by "A. Soroka" <aj...@virginia.edu>.
There may very well be a better way to do this, but to start with you might be able to use the built-in primitive notEqual(?x,?y). [1]  That should compare URI-nodes as you would expect, by their URIs. Of course, it's up to you to enforce a temporary and scoped UNA inside your graph. If (as is the general case) different URIs can point to the same thing than this kind of syntax-based check doesn't work.

Maybe you can say a little more about your use case? Are you trying to trace through chains of properties?

---
A. Soroka
The University of Virginia Library

[1] https://jena.apache.org/documentation/inference/index.html#builtin-primitives

> On May 31, 2016, at 10:41 AM, Victor Guo <gu...@gmail.com> wrote:
> 
> Thanks, Soroka. That's also what I suspect. Anyone know how to make two
> variables like ?x2 and ?x3 different in a rule?
> 
> On Tue, May 31, 2016 at 9:14 AM, A. Soroka <aj...@virginia.edu> wrote:
> 
>> If I understand what's happening here correctly (and someone who
>> understands the reasoners better should correct or confirm this, please!),
>> your one triple "X relation1 X2" is matching _both_ terms in your rule.
>> Nothing in that rule says that ?x2 must be a different thing than ?x3.
>> 
>> ---
>> A. Soroka
>> The University of Virginia Library
>> 
>> 
>>> On May 31, 2016, at 8:09 AM, Victor Guo <gu...@gmail.com> wrote:
>>> 
>>> Hi, Guys
>>>   I have the following rule:
>>> 
>>> [rule1: (?x relation1 ?x2), (?x relation1 ?x3) -> (A, B, C)]
>>> 
>>> Normally, this rule should apply to the following model:
>>> 
>>> (X relation1 X2)
>>> (X relation1 X3)
>>> 
>>> which it does apply and generate the (A, B, C) triple. However, it also
>>> applies to the following model and generates (A, B, C):
>>> 
>>> (X relation1 X2)
>>> 
>>> which seems to me it shouldn't.
>>> 
>>> Am I understanding the reasoner syntax wrong?
>>> 
>>> Thanks
>>> 
>>> On Fri, May 27, 2016 at 1:58 PM, Victor Guo <gu...@gmail.com> wrote:
>>> 
>>>> Hi, Guys
>>>>   I have the following rule:
>>>> 
>>>> [rule1: (?x relation1 ?x2), (?x relation1 ?x3) -> (A, B, C)]
>>>> 
>>>> Normally, this rule should apply to the following model:
>>>> 
>>>> (X relation1 X2)
>>>> (X relation1 X3)
>>>> 
>>>> which it does apply and generate the (A, B, C) triple. However, it also
>>>> applies to the following model and generates (A, B, C):
>>>> 
>>>> (X relation1 X2)
>>>> 
>>>> which seems to me it shouldn't.
>>>> 
>>>> Am I understanding the reasoner syntax wrong?
>>>> 
>>>> Thanks
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> Confidential
>>> Copyright 2015 BeulahWorks, LLC. All Rights Reserved.
>>> All contents included in this email, including email title, body, and
>>> attachments,etc. are proprietary to BeulahWorks, LLC.
>>> Contact: David A. Nevill  email: dnevill@beulahinc.com
>> 
>> 
> 
> 
> -- 
> Confidential
> Copyright 2015 BeulahWorks, LLC. All Rights Reserved.
> All contents included in this email, including email title, body, and
> attachments,etc. are proprietary to BeulahWorks, LLC.
> Contact: David A. Nevill  email: dnevill@beulahinc.com


Re: Need Help on Reasoner

Posted by Victor Guo <gu...@gmail.com>.
Thanks, Soroka. That's also what I suspect. Anyone know how to make two
variables like ?x2 and ?x3 different in a rule?

On Tue, May 31, 2016 at 9:14 AM, A. Soroka <aj...@virginia.edu> wrote:

> If I understand what's happening here correctly (and someone who
> understands the reasoners better should correct or confirm this, please!),
> your one triple "X relation1 X2" is matching _both_ terms in your rule.
> Nothing in that rule says that ?x2 must be a different thing than ?x3.
>
> ---
> A. Soroka
> The University of Virginia Library
>
>
> > On May 31, 2016, at 8:09 AM, Victor Guo <gu...@gmail.com> wrote:
> >
> > Hi, Guys
> >    I have the following rule:
> >
> > [rule1: (?x relation1 ?x2), (?x relation1 ?x3) -> (A, B, C)]
> >
> > Normally, this rule should apply to the following model:
> >
> > (X relation1 X2)
> > (X relation1 X3)
> >
> > which it does apply and generate the (A, B, C) triple. However, it also
> > applies to the following model and generates (A, B, C):
> >
> > (X relation1 X2)
> >
> > which seems to me it shouldn't.
> >
> > Am I understanding the reasoner syntax wrong?
> >
> > Thanks
> >
> > On Fri, May 27, 2016 at 1:58 PM, Victor Guo <gu...@gmail.com> wrote:
> >
> >> Hi, Guys
> >>    I have the following rule:
> >>
> >> [rule1: (?x relation1 ?x2), (?x relation1 ?x3) -> (A, B, C)]
> >>
> >> Normally, this rule should apply to the following model:
> >>
> >> (X relation1 X2)
> >> (X relation1 X3)
> >>
> >> which it does apply and generate the (A, B, C) triple. However, it also
> >> applies to the following model and generates (A, B, C):
> >>
> >> (X relation1 X2)
> >>
> >> which seems to me it shouldn't.
> >>
> >> Am I understanding the reasoner syntax wrong?
> >>
> >> Thanks
> >>
> >>
> >
> >
> > --
> > Confidential
> > Copyright 2015 BeulahWorks, LLC. All Rights Reserved.
> > All contents included in this email, including email title, body, and
> > attachments,etc. are proprietary to BeulahWorks, LLC.
> > Contact: David A. Nevill  email: dnevill@beulahinc.com
>
>


-- 
Confidential
Copyright 2015 BeulahWorks, LLC. All Rights Reserved.
All contents included in this email, including email title, body, and
attachments,etc. are proprietary to BeulahWorks, LLC.
Contact: David A. Nevill  email: dnevill@beulahinc.com

Re: Need Help on Reasoner

Posted by "A. Soroka" <aj...@virginia.edu>.
If I understand what's happening here correctly (and someone who understands the reasoners better should correct or confirm this, please!), your one triple "X relation1 X2" is matching _both_ terms in your rule. Nothing in that rule says that ?x2 must be a different thing than ?x3.

---
A. Soroka
The University of Virginia Library


> On May 31, 2016, at 8:09 AM, Victor Guo <gu...@gmail.com> wrote:
> 
> Hi, Guys
>    I have the following rule:
> 
> [rule1: (?x relation1 ?x2), (?x relation1 ?x3) -> (A, B, C)]
> 
> Normally, this rule should apply to the following model:
> 
> (X relation1 X2)
> (X relation1 X3)
> 
> which it does apply and generate the (A, B, C) triple. However, it also
> applies to the following model and generates (A, B, C):
> 
> (X relation1 X2)
> 
> which seems to me it shouldn't.
> 
> Am I understanding the reasoner syntax wrong?
> 
> Thanks
> 
> On Fri, May 27, 2016 at 1:58 PM, Victor Guo <gu...@gmail.com> wrote:
> 
>> Hi, Guys
>>    I have the following rule:
>> 
>> [rule1: (?x relation1 ?x2), (?x relation1 ?x3) -> (A, B, C)]
>> 
>> Normally, this rule should apply to the following model:
>> 
>> (X relation1 X2)
>> (X relation1 X3)
>> 
>> which it does apply and generate the (A, B, C) triple. However, it also
>> applies to the following model and generates (A, B, C):
>> 
>> (X relation1 X2)
>> 
>> which seems to me it shouldn't.
>> 
>> Am I understanding the reasoner syntax wrong?
>> 
>> Thanks
>> 
>> 
> 
> 
> -- 
> Confidential
> Copyright 2015 BeulahWorks, LLC. All Rights Reserved.
> All contents included in this email, including email title, body, and
> attachments,etc. are proprietary to BeulahWorks, LLC.
> Contact: David A. Nevill  email: dnevill@beulahinc.com