You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by javed khan <ja...@gmail.com> on 2016/09/17 19:15:22 UTC

Jena rules Error

String rule="[rule1:(?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#Student) " +

         "( http://www.semanticweb.org#Student
http://www.semanticweb.org#GPA  ?gpa    )   +  greaterThan(?gpa, 3)

         " ->  (?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org#GoodUser )]";

GPA is a data property here, but it gives me error. I think the error is
in greaterThan(?score, 10)

What is the error ?

Re: Jena rules Error

Posted by Dave Reynolds <da...@gmail.com>.
On 18/09/16 14:37, javed khan wrote:
> Hello Dave, thank you for your comment but is the semantic (logic) in the
> rule above correct? Because it does not give me the required result and
> when I query ?student rdf:type std:GoodStudent, it does not give me any
> result.

It should work if the details are correct. If you can't get it to work 
then reduce it to a complete minimal example, with actual data and a 
correct version of the rule, and maybe someone can spot the problem.

Dave

> On Sun, Sep 18, 2016 at 1:11 AM, Dave Reynolds <da...@gmail.com>
> wrote:
>
>> On 17/09/16 22:31, javed khan wrote:
>>
>>> The error goes away but the rules does not work i-e I can not find the rdf
>>> type of GoodUser/GoodStudent.
>>> Also after result display, it gives me some exception .
>>>
>>> Exception in thread "AWT-EventQueue-0"
>>> com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: Triple with 4
>>> nodes!
>>> At '[ rule1: ( ?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>>> http://www.semanticweb.org/t/ontologies/2016/7/myOWL#User ) (
>>> http://www.semanticweb.org/t/ontologies/2016/7/myOWL#User
>>> http://www.semanticweb.org/t/ontologies/2016/7/myOWL#score ?score + ) '
>>>
>>
>> Look closely at the line above. You can see that there's a spurious "+"
>> character in your string.
>>
>> Dave
>>
>>
>>
>>> On Sat, Sep 17, 2016 at 12:15 PM, javed khan <ja...@gmail.com>
>>> wrote:
>>>
>>> String rule="[rule1:(?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>>>>  http://www.semanticweb.org#Student) " +
>>>>
>>>>          "( http://www.semanticweb.org#Student
>>>> http://www.semanticweb.org#GPA  ?gpa    )   +  greaterThan(?gpa, 3)
>>>>
>>>>          " ->  (?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>>>> http://www.semanticweb.org#GoodUser )]";
>>>>
>>>> GPA is a data property here, but it gives me error. I think the error is
>>>> in greaterThan(?score, 10)
>>>>
>>>> What is the error ?
>>>>
>>>>
>>>
>>
>


Re: Jena rules Error

Posted by javed khan <ja...@gmail.com>.
Hello Dave, thank you for your comment but is the semantic (logic) in the
rule above correct? Because it does not give me the required result and
when I query ?student rdf:type std:GoodStudent, it does not give me any
result.

Regards

On Sun, Sep 18, 2016 at 1:11 AM, Dave Reynolds <da...@gmail.com>
wrote:

> On 17/09/16 22:31, javed khan wrote:
>
>> The error goes away but the rules does not work i-e I can not find the rdf
>> type of GoodUser/GoodStudent.
>> Also after result display, it gives me some exception .
>>
>> Exception in thread "AWT-EventQueue-0"
>> com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: Triple with 4
>> nodes!
>> At '[ rule1: ( ?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>> http://www.semanticweb.org/t/ontologies/2016/7/myOWL#User ) (
>> http://www.semanticweb.org/t/ontologies/2016/7/myOWL#User
>> http://www.semanticweb.org/t/ontologies/2016/7/myOWL#score ?score + ) '
>>
>
> Look closely at the line above. You can see that there's a spurious "+"
> character in your string.
>
> Dave
>
>
>
>> On Sat, Sep 17, 2016 at 12:15 PM, javed khan <ja...@gmail.com>
>> wrote:
>>
>> String rule="[rule1:(?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>>>  http://www.semanticweb.org#Student) " +
>>>
>>>          "( http://www.semanticweb.org#Student
>>> http://www.semanticweb.org#GPA  ?gpa    )   +  greaterThan(?gpa, 3)
>>>
>>>          " ->  (?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>>> http://www.semanticweb.org#GoodUser )]";
>>>
>>> GPA is a data property here, but it gives me error. I think the error is
>>> in greaterThan(?score, 10)
>>>
>>> What is the error ?
>>>
>>>
>>
>

Re: Jena rules Error

Posted by Dave Reynolds <da...@gmail.com>.
On 17/09/16 22:31, javed khan wrote:
> The error goes away but the rules does not work i-e I can not find the rdf
> type of GoodUser/GoodStudent.
> Also after result display, it gives me some exception .
>
> Exception in thread "AWT-EventQueue-0"
> com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: Triple with 4 nodes!
> At '[ rule1: ( ?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> http://www.semanticweb.org/t/ontologies/2016/7/myOWL#User ) (
> http://www.semanticweb.org/t/ontologies/2016/7/myOWL#User
> http://www.semanticweb.org/t/ontologies/2016/7/myOWL#score ?score + ) '

Look closely at the line above. You can see that there's a spurious "+" 
character in your string.

Dave

>
> On Sat, Sep 17, 2016 at 12:15 PM, javed khan <ja...@gmail.com> wrote:
>
>> String rule="[rule1:(?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>>  http://www.semanticweb.org#Student) " +
>>
>>          "( http://www.semanticweb.org#Student
>> http://www.semanticweb.org#GPA  ?gpa    )   +  greaterThan(?gpa, 3)
>>
>>          " ->  (?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>> http://www.semanticweb.org#GoodUser )]";
>>
>> GPA is a data property here, but it gives me error. I think the error is
>> in greaterThan(?score, 10)
>>
>> What is the error ?
>>
>


Re: Jena rules Error

Posted by javed khan <ja...@gmail.com>.
The error goes away but the rules does not work i-e I can not find the rdf
type of GoodUser/GoodStudent.
Also after result display, it gives me some exception .

Exception in thread "AWT-EventQueue-0"
com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: Triple with 4 nodes!
At '[ rule1: ( ?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.semanticweb.org/t/ontologies/2016/7/myOWL#User ) (
http://www.semanticweb.org/t/ontologies/2016/7/myOWL#User
http://www.semanticweb.org/t/ontologies/2016/7/myOWL#score ?score + ) '

On Sat, Sep 17, 2016 at 12:15 PM, javed khan <ja...@gmail.com> wrote:

> String rule="[rule1:(?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
>  http://www.semanticweb.org#Student) " +
>
>          "( http://www.semanticweb.org#Student
> http://www.semanticweb.org#GPA  ?gpa    )   +  greaterThan(?gpa, 3)
>
>          " ->  (?x   http://www.w3.org/1999/02/22-rdf-syntax-ns#type
> http://www.semanticweb.org#GoodUser )]";
>
> GPA is a data property here, but it gives me error. I think the error is
> in greaterThan(?score, 10)
>
> What is the error ?
>