You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by tina sani <ti...@gmail.com> on 2017/04/30 09:30:49 UTC

How to put one model in another

I have a model Model1 with all data, having Jena rules. How can I put it in
another model Model2 which may or may not have any data?

Second, after putting the model in another model, would we able to replace
previous values/data with new one, generated using Jena rules?

Re: How to put one model in another

Posted by "Lorenz B." <bu...@informatik.uni-leipzig.de>.
I don't think so. Putting a model into another doesn't remove any
triples. It's still not clear what you're doing, but again, the rules in
Jena add new triples to the model. And as long as the rules do exists
and you apply them via reasoning the inferred triples cannot be removed
since they do exist inherently.
> Hi Lorenz "I think I already told you that the rule engine is monotonic,
> i.e. no data will be removed or changed but only new data will be added
> if the data matches a premise of a rule."
>
> I think you told me that the problem can be solved if we put the model into
> another model or something like this?
>
> On Mon, May 1, 2017 at 10:47 AM, Lorenz B. <
> buehmann@informatik.uni-leipzig.de> wrote:
>
>>> Hi Dave, if we have a rule like
>>>
>>> if Person publications less than 10, Person is JuniorResearcher
>>> if Person publications greater than 10, Person is SeniorResearcher
>>>
>>> If person publication is first less than 10, rules will assign him to
>>> JuniorResearcher class but when it exceeds 10, becomes SeniorResearcher
>> but
>>> the JuniorResearcher also be there as rules does not replace the existed
>>> value with new one.
>>>
>>> This was my query if we put the inferred model to a new model, will the
>>> rules then be able to replace the previous data?
>> No no no, I think I already told you that the rule engine is monotonic,
>> i.e. no data will be removed or changed but only new data will be added
>> if the data matches a premise of a rule.
>> Anything else has to be done by yourself in the application code.
>>>
>>> On Sun, Apr 30, 2017 at 4:38 PM, Dave Reynolds <
>> dave.e.reynolds@gmail.com>
>>> wrote:
>>>
>>>> On 30/04/17 10:30, tina sani wrote:
>>>>
>>>>> I have a model Model1 with all data, having Jena rules. How can I put
>> it
>>>>> in
>>>>> another model Model2 which may or may not have any data?
>>>>>
>>>> The way to add triples from one model to another is to use the
>>>> unsurprisingly named "add" as any glance at the javadoc would tell you.
>>>>
>>>>      model2.add( model1 )
>>>>
>>>> If model1 is actually an InfModel with forward rules then what will get
>>>> added to model2 is the base triples plus all inferred triples.
>>>>
>>>> Second, after putting the model in another model, would we able to
>> replace
>>>>> previous values/data with new one, generated using Jena rules?
>>>>>
>>>> Question is unclear.
>>>>
>>>> Once you have a model you and add or remove triples from it.
>>>>
>>>> You can use rules to generate triples.
>>>>
>>>> How you connect whatever bit of your code is using rules to whatever bit
>>>> of your code is holding the data is up to you. There are no
>> out-of-the-box
>>>> rule builtins to allow you to fire a rule in one model and assert
>> results
>>>> into another model if that's what you mean.
>>>>
>>>> Dave
>>>>
>>>>
>> --
>> Lorenz Bühmann
>> AKSW group, University of Leipzig
>> Group: http://aksw.org - semantic web research center
>>
>>
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center


Re: How to put one model in another

Posted by tina sani <ti...@gmail.com>.
Hi Lorenz "I think I already told you that the rule engine is monotonic,
i.e. no data will be removed or changed but only new data will be added
if the data matches a premise of a rule."

I think you told me that the problem can be solved if we put the model into
another model or something like this?

On Mon, May 1, 2017 at 10:47 AM, Lorenz B. <
buehmann@informatik.uni-leipzig.de> wrote:

>
> > Hi Dave, if we have a rule like
> >
> > if Person publications less than 10, Person is JuniorResearcher
> > if Person publications greater than 10, Person is SeniorResearcher
> >
> > If person publication is first less than 10, rules will assign him to
> > JuniorResearcher class but when it exceeds 10, becomes SeniorResearcher
> but
> > the JuniorResearcher also be there as rules does not replace the existed
> > value with new one.
> >
> > This was my query if we put the inferred model to a new model, will the
> > rules then be able to replace the previous data?
>
> No no no, I think I already told you that the rule engine is monotonic,
> i.e. no data will be removed or changed but only new data will be added
> if the data matches a premise of a rule.
> Anything else has to be done by yourself in the application code.
> >
> >
> > On Sun, Apr 30, 2017 at 4:38 PM, Dave Reynolds <
> dave.e.reynolds@gmail.com>
> > wrote:
> >
> >> On 30/04/17 10:30, tina sani wrote:
> >>
> >>> I have a model Model1 with all data, having Jena rules. How can I put
> it
> >>> in
> >>> another model Model2 which may or may not have any data?
> >>>
> >> The way to add triples from one model to another is to use the
> >> unsurprisingly named "add" as any glance at the javadoc would tell you.
> >>
> >>      model2.add( model1 )
> >>
> >> If model1 is actually an InfModel with forward rules then what will get
> >> added to model2 is the base triples plus all inferred triples.
> >>
> >> Second, after putting the model in another model, would we able to
> replace
> >>> previous values/data with new one, generated using Jena rules?
> >>>
> >> Question is unclear.
> >>
> >> Once you have a model you and add or remove triples from it.
> >>
> >> You can use rules to generate triples.
> >>
> >> How you connect whatever bit of your code is using rules to whatever bit
> >> of your code is holding the data is up to you. There are no
> out-of-the-box
> >> rule builtins to allow you to fire a rule in one model and assert
> results
> >> into another model if that's what you mean.
> >>
> >> Dave
> >>
> >>
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>

Re: How to put one model in another

Posted by "Lorenz B." <bu...@informatik.uni-leipzig.de>.
> Hi Dave, if we have a rule like
>
> if Person publications less than 10, Person is JuniorResearcher
> if Person publications greater than 10, Person is SeniorResearcher
>
> If person publication is first less than 10, rules will assign him to
> JuniorResearcher class but when it exceeds 10, becomes SeniorResearcher but
> the JuniorResearcher also be there as rules does not replace the existed
> value with new one.
>
> This was my query if we put the inferred model to a new model, will the
> rules then be able to replace the previous data?

No no no, I think I already told you that the rule engine is monotonic,
i.e. no data will be removed or changed but only new data will be added
if the data matches a premise of a rule.
Anything else has to be done by yourself in the application code.
>
>
> On Sun, Apr 30, 2017 at 4:38 PM, Dave Reynolds <da...@gmail.com>
> wrote:
>
>> On 30/04/17 10:30, tina sani wrote:
>>
>>> I have a model Model1 with all data, having Jena rules. How can I put it
>>> in
>>> another model Model2 which may or may not have any data?
>>>
>> The way to add triples from one model to another is to use the
>> unsurprisingly named "add" as any glance at the javadoc would tell you.
>>
>>      model2.add( model1 )
>>
>> If model1 is actually an InfModel with forward rules then what will get
>> added to model2 is the base triples plus all inferred triples.
>>
>> Second, after putting the model in another model, would we able to replace
>>> previous values/data with new one, generated using Jena rules?
>>>
>> Question is unclear.
>>
>> Once you have a model you and add or remove triples from it.
>>
>> You can use rules to generate triples.
>>
>> How you connect whatever bit of your code is using rules to whatever bit
>> of your code is holding the data is up to you. There are no out-of-the-box
>> rule builtins to allow you to fire a rule in one model and assert results
>> into another model if that's what you mean.
>>
>> Dave
>>
>>
-- 
Lorenz B�hmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center


Re: How to put one model in another

Posted by Dave Reynolds <da...@gmail.com>.
On 30/04/17 18:40, tina sani wrote:
> Hi Dave, if we have a rule like
>
> if Person publications less than 10, Person is JuniorResearcher
> if Person publications greater than 10, Person is SeniorResearcher
>
> If person publication is first less than 10, rules will assign him to
> JuniorResearcher class but when it exceeds 10, becomes SeniorResearcher but
> the JuniorResearcher also be there as rules does not replace the existed
> value with new one.

Depends how you set the publications. If you remove the old (<10) value 
and replace it with a new (>10) value then the rules will retract the 
JuniorResearcher assertion and assert the SeniorResearch assertion.

> This was my query if we put the inferred model to a new model, will the
> rules then be able to replace the previous data?

Sorry, I still have no idea what architecture you have in mind. I 
suggest trying a minimal example. If it doesn't do what you expect then 
that will give you something concrete to ask questions about.

Dave

> On Sun, Apr 30, 2017 at 4:38 PM, Dave Reynolds <da...@gmail.com>
> wrote:
>
>> On 30/04/17 10:30, tina sani wrote:
>>
>>> I have a model Model1 with all data, having Jena rules. How can I put it
>>> in
>>> another model Model2 which may or may not have any data?
>>>
>>
>> The way to add triples from one model to another is to use the
>> unsurprisingly named "add" as any glance at the javadoc would tell you.
>>
>>      model2.add( model1 )
>>
>> If model1 is actually an InfModel with forward rules then what will get
>> added to model2 is the base triples plus all inferred triples.
>>
>> Second, after putting the model in another model, would we able to replace
>>> previous values/data with new one, generated using Jena rules?
>>>
>>
>> Question is unclear.
>>
>> Once you have a model you and add or remove triples from it.
>>
>> You can use rules to generate triples.
>>
>> How you connect whatever bit of your code is using rules to whatever bit
>> of your code is holding the data is up to you. There are no out-of-the-box
>> rule builtins to allow you to fire a rule in one model and assert results
>> into another model if that's what you mean.
>>
>> Dave
>>
>>
>


Re: How to put one model in another

Posted by tina sani <ti...@gmail.com>.
Hi Dave, if we have a rule like

if Person publications less than 10, Person is JuniorResearcher
if Person publications greater than 10, Person is SeniorResearcher

If person publication is first less than 10, rules will assign him to
JuniorResearcher class but when it exceeds 10, becomes SeniorResearcher but
the JuniorResearcher also be there as rules does not replace the existed
value with new one.

This was my query if we put the inferred model to a new model, will the
rules then be able to replace the previous data?


On Sun, Apr 30, 2017 at 4:38 PM, Dave Reynolds <da...@gmail.com>
wrote:

> On 30/04/17 10:30, tina sani wrote:
>
>> I have a model Model1 with all data, having Jena rules. How can I put it
>> in
>> another model Model2 which may or may not have any data?
>>
>
> The way to add triples from one model to another is to use the
> unsurprisingly named "add" as any glance at the javadoc would tell you.
>
>      model2.add( model1 )
>
> If model1 is actually an InfModel with forward rules then what will get
> added to model2 is the base triples plus all inferred triples.
>
> Second, after putting the model in another model, would we able to replace
>> previous values/data with new one, generated using Jena rules?
>>
>
> Question is unclear.
>
> Once you have a model you and add or remove triples from it.
>
> You can use rules to generate triples.
>
> How you connect whatever bit of your code is using rules to whatever bit
> of your code is holding the data is up to you. There are no out-of-the-box
> rule builtins to allow you to fire a rule in one model and assert results
> into another model if that's what you mean.
>
> Dave
>
>

Re: How to put one model in another

Posted by Dave Reynolds <da...@gmail.com>.
On 30/04/17 10:30, tina sani wrote:
> I have a model Model1 with all data, having Jena rules. How can I put it in
> another model Model2 which may or may not have any data?

The way to add triples from one model to another is to use the 
unsurprisingly named "add" as any glance at the javadoc would tell you.

      model2.add( model1 )

If model1 is actually an InfModel with forward rules then what will get 
added to model2 is the base triples plus all inferred triples.

> Second, after putting the model in another model, would we able to replace
> previous values/data with new one, generated using Jena rules?

Question is unclear.

Once you have a model you and add or remove triples from it.

You can use rules to generate triples.

How you connect whatever bit of your code is using rules to whatever bit 
of your code is holding the data is up to you. There are no 
out-of-the-box rule builtins to allow you to fire a rule in one model 
and assert results into another model if that's what you mean.

Dave