You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Parastoo Delgoshaei <ap...@yahoo.com> on 2013/11/04 18:17:21 UTC

Jena property change listener

Hi everyone,
I was wondering if Jena supports model property change listener. i.e. there is a mechanism to be notified if a value of and object or datatype property has changed in an individual of your model.

Thanks,
-P.

Re: Jena property change listener

Posted by Parastoo Delgoshaei <ap...@yahoo.com>.
I got it to work! So here are the changes I made to the code:
I should have attached the listener to deductionsModel:

InfModel infModel = ModelFactory.createInfModel(r,model);
infmodel.getDeductionsModel().register(L);
infmodel.rebind();
infmodel.prepare();





On Thursday, November 7, 2013 3:44 PM, Andy Seaborne <an...@apache.org> wrote:
 
On 07/11/13 19:22, Parastoo Delgoshaei wrote:
>   Here is my main file:

Chris asked for a "minimal, complete example".  Your code isn't minimal, 
does not compile (it is badly broken by email) and is not complete (no 

MyModelChangedListener).

If you want someone to help you, don't make them do a lot of work 
recreating a runnable example.

Minimal - just what is needed to illustrate the problem.  In doing this 
you may even find the problem your self.

Complete - someone can get it to run with as little work as possible, 
typical cut-and-paste into Eclipse.

    Andy

Re: Jena property change listener

Posted by Andy Seaborne <an...@apache.org>.
On 07/11/13 19:22, Parastoo Delgoshaei wrote:
>   Here is my main file:

Chris asked for a "minimal, complete example".  Your code isn't minimal, 
does not compile (it is badly broken by email) and is not complete (no 
MyModelChangedListener).

If you want someone to help you, don't make them do a lot of work 
recreating a runnable example.

Minimal - just what is needed to illustrate the problem.  In doing this 
you may even find the problem your self.

Complete - someone can get it to run with as little work as possible, 
typical cut-and-paste into Eclipse.

	Andy


Re: Jena property change listener

Posted by Parastoo Delgoshaei <ap...@yahoo.com>.
 Here is my main file:

import java.util.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
 
import java.util.List;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
 
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.ontology.*;
import com.hp.hpl.jena.vocabulary.*;
import com.hp.hpl.jena.datatypes.xsd.*;
import com.hp.hpl.jena.rdf.listeners.ObjectListener;
import com.hp.hpl.jena.rdf.listeners.ChangedListener;
import com.hp.hpl.jena.reasoner.Reasoner;
import com.hp.hpl.jena.reasoner.ReasonerRegistry;
import com.hp.hpl.jena.reasoner.rulesys.GenericRuleReasoner;
import com.hp.hpl.jena.reasoner.rulesys.Rule;
import com.hp.hpl.jena.shared.DoesNotExistException;
import com.hp.hpl.jena.graph.query.Query;
import com.hp.hpl.jena.reasoner.rulesys.BuiltinRegistry;
 
 
public class TestFamilyOWL {
  
   // Base URI and
namespace declarations
 
   static final String
baseURI = "http://family.org/family";
   static final
String      ns =
"http://family.org/family#";
 
   // Ontology model
declaration ... 
 
   private OntModel
model;
   private
Ontology  onto;
   private OntClass
person;
   private
ObjectProperty hasFather, hasSon;
   private
ModelChangedListener L;
   private Individual
mark, chris;
 
  
   //
============================================================
   // Constructor
method to create an empty model and ontology ...
   //
============================================================
 
   public
TestFamilyOWL() {
 
      // Create
ontology model ....
 
      model =
ModelFactory.createOntologyModel();
      onto  =
model.createOntology( baseURI );
                  L = new MyModelChangedListener();
      model.register(
L );
                 
   }
 
   //
============================================================
   // Manually
assemble the people ontology ..
   //
============================================================
 
   public void
buildOntology() {
 
      // Define
classes ...
 
      person =
model.createClass( ns + "Person");
       
      // Create object
properties for the class Person ...
                  
                  hasSon = model.createObjectProperty(ns +
"hasSon");
                  hasSon.setDomain(person);
                  hasSon.setRange(person);
 
   }
   //
============================================================
   // Create
individuals ...
   //
============================================================
 
   public void
addIndividuals() {
 
      // Add mark,
chris and nina to the model ...
 
      mark   = person.createIndividual(ns +
"Mark");
      chris  = person.createIndividual(ns +
"Christopher");
      
                  
                  // Create statements "Mark has son
Christopher" 
      Statement
markSon = model.createStatement( mark, hasSon, chris );
      model.add (  markSon );
                  
   }
 
   
  //
============================================================
  // Now let's
transform the model with input rules ....
  // ============================================================
 
  public void
addRules() {
     String inputRules
= "src/rules/family.rules";
     File f = new File
( inputRules );
 
     if (f.exists() ==
true ) {
        
System.out.printf("Reading file: %s\n", inputRules );
        
List<Rule> rules = Rule.rulesFromURL("file:" +
inputRules );
        
GenericRuleReasoner r = new GenericRuleReasoner(rules);
        
r.setOWLTranslation(true);           
         r.setTransitiveClosureCaching(true);
 
         InfModel
infmodel = ModelFactory.createInfModel(r, model);
        
model.add(infmodel.getDeductionsModel());
        
System.out.println("Model size = " + model.size());
     } else
        
System.out.println("ERROR: That rules file does not exist.");
  }
  public void
printStatements( String sTitle ) {
      Selector s = new
SimpleSelector ( (Resource) null, (Property) null, (RDFNode) null );
      printStatements(
sTitle, s );
   }
 
   public void
printStatements( String sTitle, Selector s ) {
      int statementNo
= 1;
 
     
System.out.printf("Statements: %s\n", sTitle );
     
System.out.printf("=============================================================\n");
     
      StmtIterator
iter = model.listStatements(s);
 
      while
(iter.hasNext()) {
         Statement
stmt      = iter.next();         // get next statement
         Resource  subject  
= stmt.getSubject();   // get the
subject
         Property  predicate = stmt.getPredicate(); // get the
predicate
         RDFNode   object   
= stmt.getObject();    // get the
object
 
         // Objects
can be either Resources or Literals ....
 
        
System.out.printf("Statement[ %3d]\n", statementNo );
        
System.out.printf(" 
Subject  : %s \n",
subject.toString());
        
System.out.printf(" 
Predicate: %s \n", predicate.toString());
 
         if (object
instanceof Resource) {
           
System.out.printf(" 
Object   : %s \n", object.toString());
         }
 
         if (object
instanceof Literal) {
           
System.out.printf(" 
Object   : \"%s\"
\n", object.toString());
         }
 
         statementNo =
statementNo + 1; 
      }
 
     
System.out.println("=============================================================");
     
System.out.println("");
  }
  
  //
============================================================
  // Retrieve and
print asserted/inferred RDF types ....
  //
============================================================
 
   public void
printResources( String sTitle, String sProperty, Property p ) {
      int statementNo
= 1;
 
     
System.out.printf("Resources: %s\n", sTitle );
     
System.out.printf("=============================================================\n");
 
      // Select all
the resources with specified property
 
      ResIterator iter
= model.listSubjectsWithProperty( p );
     
System.out.printf("The database contains %s for: \n",
sProperty );
      if
(iter.hasNext()) {
          while
(iter.hasNext()) {
             Resource
r = iter.nextResource();
            
System.out.printf( "Individual: %s has %s %s\n", r.toString(),
sProperty,
                           
     r.getProperty( p
).getString() );
          }
      } else {
         
System.out.printf("No %s were found in the database ...\n",
sProperty );
      }
 
     
System.out.println("=============================================================");
      System.out.println("");
  }

  public static void
main(String args[]) {
 
    TestFamilyOWL
family = new TestFamilyOWL();
   
family.buildOntology();
   
family.addIndividuals();
    family.addRules();
   
family.model.write(System.out, "RDF/XML" );
   Selector s= new SimpleSelector ((
Resource)family.chris,(Property) null,(RDFNode)null);
Family.printStatements(“Chris …”,s);
  }
}

This is family.rules:
@prefix af:  <http://family.org/family#>.
@prefix rdf:
<http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
 
// Rule 01:
Father-Son Relationship
 
[ hasSon:    (?f rdf:type af:Person) (?f af:hasSon
?s)-> (?s af:hasFather ?f)]



if you look in the results, chris hasFather mark (thus rule is checked). However,i do not see the print statement as a result of this change. MyModelChangedListerner.jave is an implementation of ModelChangedListener.java that has a print statement for the function addedStatement(Statement s).
 
 Thanks for your help,
-P.



On Thursday, November 7, 2013 12:42 PM, Chris_Dollin <eh...@gmail.com> wrote:
 
On Thursday, November 07, 2013 09:03:56 AM Parastoo Delgoshaei wrote:
> This listener does not work if the result of change to the model is due to
> rule checking. i.e. assume I have this rule:
> @ prefix af: <http://personont.org/person#>.
> ....
> [GetAge  (?a rdf:type af:Person) (?a af:hasBirthDate ?b) getAge(?b,?d)->(?a
> af:hasAge ?d)]
> 
> getAge() is a built-in that is attached to the model. When I query the
> individuals they have "hasAge" property with the correct value associated
> with their birthdates. However, the listener is not triggered when this
> change happens at the rule level. 

You still haven't show your code. By "code" I mean a minimal complete example.
I suspect you're listening to the wrong model, but since I can't see how
you make the models and attach the listeners and run the inference I
can't see where any problem might be.

If you do rule-based inference on a model M, then no changes are
made /to M/, so if that's what you're listening to you'll hear nothing.

Give us a minimal, complete example and we can run it, tinker with it,
and use it as a test case if there's actually a problem to fix.


> On Wednesday, November 6, 2013 6:55 AM, Chris Dollin
> <ch...@epimorphics.com> wrote:
> On Wednesday, November 06, 2013 05:21:23 PM Dibyanshu Jaiswal wrote:
> > I feel if you register the model with a change listener as disscussed
> > earlier, like: model.register(changeListener); which has proper
> > implementation of the abstrat methods defined in ModelChangedListener
> > (atleast for Statementadded()), you will be able to detect every changes
> > made to your model.
> 
> "rule checking" suggests inference, which suggests a base model and
> a deductions model, which suggests there are two models, only one
> of which is updated -- if that's the listened-to model, everything will
> be quiet. Too quiet.
> 
> Hence my request to show code ...
> 
> Chris
> 
> > On Tue, Nov 5, 2013 at 8:28 PM, Chris Dollin
> > 
> > <ch...@epimorphics.com>wrote:
> > > On Tuesday, November 05, 2013 06:53:17 AM Parastoo Delgoshaei wrote:
> > > > Claude,
> > > > Thanks for your response. This solution works only if you have hard
> > > 
> > > coded add/removal statements (i.e. model.add( S, P, O2 ); or
> > > model.remove(s);) However, I do not see any add and removal
> > > notifications
> > > as a result of rule checking. The model certainly has changed I see it
> > > in
> > > the print out after the rule checking. However, the listener does not
> > > recognize this add/remove.
> > > 
> > > > Your help is appreciated,
> > > 
> > > Show code.
> > > 
> > > (Are you listening to the model that's being changed?)
> > > 
> > > Chris
> > > 
> > > --
> > > "The wizard seemed quite willing when I talked to him."  /Howl's Moving
> > > Castle/
> > > 
> > > Epimorphics Ltd, http://www.epimorphics.com
> > > Registered address: Court Lodge, 105 High Street, Portishead, Bristol
> > > BS20
> > > 6PT
> > > Epimorphics Ltd. is a limited company registered in England (number
> > > 7016688)

Re: Jena property change listener

Posted by Chris_Dollin <eh...@gmail.com>.
On Thursday, November 07, 2013 09:03:56 AM Parastoo Delgoshaei wrote:
> This listener does not work if the result of change to the model is due to
> rule checking. i.e. assume I have this rule:
> @ prefix af: <http://personont.org/person#>.
> ....
> [GetAge  (?a rdf:type af:Person) (?a af:hasBirthDate ?b) getAge(?b,?d)->(?a
> af:hasAge ?d)]
> 
> getAge() is a built-in that is attached to the model. When I query the
> individuals they have "hasAge" property with the correct value associated
> with their birthdates. However, the listener is not triggered when this
> change happens at the rule level. 

You still haven't show your code. By "code" I mean a minimal complete example.
I suspect you're listening to the wrong model, but since I can't see how
you make the models and attach the listeners and run the inference I
can't see where any problem might be.

If you do rule-based inference on a model M, then no changes are
made /to M/, so if that's what you're listening to you'll hear nothing.

Give us a minimal, complete example and we can run it, tinker with it,
and use it as a test case if there's actually a problem to fix.
 
> On Wednesday, November 6, 2013 6:55 AM, Chris Dollin
> <ch...@epimorphics.com> wrote:
> On Wednesday, November 06, 2013 05:21:23 PM Dibyanshu Jaiswal wrote:
> > I feel if you register the model with a change listener as disscussed
> > earlier, like: model.register(changeListener); which has proper
> > implementation of the abstrat methods defined in ModelChangedListener
> > (atleast for Statementadded()), you will be able to detect every changes
> > made to your model.
> 
> "rule checking" suggests inference, which suggests a base model and
> a deductions model, which suggests there are two models, only one
> of which is updated -- if that's the listened-to model, everything will
> be quiet. Too quiet.
> 
> Hence my request to show code ...
> 
> Chris
> 
> > On Tue, Nov 5, 2013 at 8:28 PM, Chris Dollin
> > 
> > <ch...@epimorphics.com>wrote:
> > > On Tuesday, November 05, 2013 06:53:17 AM Parastoo Delgoshaei wrote:
> > > > Claude,
> > > > Thanks for your response. This solution works only if you have hard
> > > 
> > > coded add/removal statements (i.e. model.add( S, P, O2 ); or
> > > model.remove(s);) However, I do not see any add and removal
> > > notifications
> > > as a result of rule checking. The model certainly has changed I see it
> > > in
> > > the print out after the rule checking. However, the listener does not
> > > recognize this add/remove.
> > > 
> > > > Your help is appreciated,
> > > 
> > > Show code.
> > > 
> > > (Are you listening to the model that's being changed?)
> > > 
> > > Chris
> > > 
> > > --
> > > "The wizard seemed quite willing when I talked to him."  /Howl's Moving
> > > Castle/
> > > 
> > > Epimorphics Ltd, http://www.epimorphics.com
> > > Registered address: Court Lodge, 105 High Street, Portishead, Bristol
> > > BS20
> > > 6PT
> > > Epimorphics Ltd. is a limited company registered in England (number
> > > 7016688)

Re: Re: Re: Jena property change listener

Posted by Parastoo Delgoshaei <ap...@yahoo.com>.
This listener does not work if the result of change to the model is due to rule checking.
i.e. assume I have this rule:
@ prefix af: <http://personont.org/person#>.
....
[GetAge  (?a rdf:type af:Person) (?a af:hasBirthDate ?b) getAge(?b,?d)->(?a af:hasAge ?d)]

getAge() is a built-in that is attached to the model. When I query the individuals they have "hasAge" property with the correct value associated with their birthdates. However, the listener is not triggered when this change happens at the rule level. 

Thanks for your help,
-P.




On Wednesday, November 6, 2013 6:55 AM, Chris Dollin <ch...@epimorphics.com> wrote:
 
On Wednesday, November 06, 2013 05:21:23 PM Dibyanshu Jaiswal wrote:
> I feel if you register the model with a change listener as disscussed
> earlier, like: model.register(changeListener); which has proper
> implementation of the abstrat methods defined in ModelChangedListener
> (atleast for Statementadded()), you will be able to detect every changes
> made to your model.

"rule checking" suggests inference, which suggests a base model and
a deductions model, which suggests there are two models, only one
of which is updated -- if that's the listened-to model, everything will
be quiet. Too quiet.

Hence my request to show code ...

Chris

> On Tue, Nov 5, 2013 at 8:28 PM, Chris Dollin
> <ch...@epimorphics.com>wrote:
> 
> > On Tuesday, November 05, 2013 06:53:17 AM Parastoo Delgoshaei wrote:
> > > Claude,
> > > Thanks for your response. This solution works only if you have hard
> > coded add/removal statements (i.e. model.add( S, P, O2 ); or
> > model.remove(s);) However, I do not see any add and removal notifications
> > as a result of rule checking. The model certainly has changed I see it in
> > the print out after the rule checking. However, the listener does not
> > recognize this add/remove.
> > >
> > > Your help is appreciated,
> >
> > Show code.
> >
> > (Are you listening to the model that's being changed?)
> >
> > Chris
> >
> > --
> > "The wizard seemed quite willing when I talked to him."  /Howl's Moving
> > Castle/
> >
> > Epimorphics Ltd, http://www.epimorphics.com
> > Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20
> > 6PT
> > Epimorphics Ltd. is a limited company registered in England (number
> > 7016688)
> >
> >
> 
> 
> 
-- 
"I don't want to know what the Structuralists think! I want     /Archer's Goon/
to know what YOU think!"


Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)

Re: Re: Re: Jena property change listener

Posted by Chris Dollin <ch...@epimorphics.com>.
On Wednesday, November 06, 2013 05:21:23 PM Dibyanshu Jaiswal wrote:
> I feel if you register the model with a change listener as disscussed
> earlier, like: model.register(changeListener); which has proper
> implementation of the abstrat methods defined in ModelChangedListener
> (atleast for Statementadded()), you will be able to detect every changes
> made to your model.

"rule checking" suggests inference, which suggests a base model and
a deductions model, which suggests there are two models, only one
of which is updated -- if that's the listened-to model, everything will
be quiet. Too quiet.

Hence my request to show code ...

Chris

> On Tue, Nov 5, 2013 at 8:28 PM, Chris Dollin
> <ch...@epimorphics.com>wrote:
> 
> > On Tuesday, November 05, 2013 06:53:17 AM Parastoo Delgoshaei wrote:
> > > Claude,
> > > Thanks for your response. This solution works only if you have hard
> > coded add/removal statements (i.e. model.add( S, P, O2 ); or
> > model.remove(s);) However, I do not see any add and removal notifications
> > as a result of rule checking. The model certainly has changed I see it in
> > the print out after the rule checking. However, the listener does not
> > recognize this add/remove.
> > >
> > > Your help is appreciated,
> >
> > Show code.
> >
> > (Are you listening to the model that's being changed?)
> >
> > Chris
> >
> > --
> > "The wizard seemed quite willing when I talked to him."  /Howl's Moving
> > Castle/
> >
> > Epimorphics Ltd, http://www.epimorphics.com
> > Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20
> > 6PT
> > Epimorphics Ltd. is a limited company registered in England (number
> > 7016688)
> >
> >
> 
> 
> 
-- 
"I don't want to know what the Structuralists think! I want     /Archer's Goon/
 to know what YOU think!"

Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)


Re: Re: Jena property change listener

Posted by Dibyanshu Jaiswal <dj...@gmail.com>.
I feel if you register the model with a change listener as disscussed
earlier, like: model.register(changeListener); which has proper
implementation of the abstrat methods defined in ModelChangedListener
(atleast for Statementadded()), you will be able to detect every changes
made to your model.


On Tue, Nov 5, 2013 at 8:28 PM, Chris Dollin
<ch...@epimorphics.com>wrote:

> On Tuesday, November 05, 2013 06:53:17 AM Parastoo Delgoshaei wrote:
> > Claude,
> > Thanks for your response. This solution works only if you have hard
> coded add/removal statements (i.e. model.add( S, P, O2 ); or
> model.remove(s);) However, I do not see any add and removal notifications
> as a result of rule checking. The model certainly has changed I see it in
> the print out after the rule checking. However, the listener does not
> recognize this add/remove.
> >
> > Your help is appreciated,
>
> Show code.
>
> (Are you listening to the model that's being changed?)
>
> Chris
>
> --
> "The wizard seemed quite willing when I talked to him."  /Howl's Moving
> Castle/
>
> Epimorphics Ltd, http://www.epimorphics.com
> Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20
> 6PT
> Epimorphics Ltd. is a limited company registered in England (number
> 7016688)
>
>


-- 
*Dibyanshu Jaiswal*
Mb: +91 9038304989
Mb: +91 9674272265

Re: Re: Jena property change listener

Posted by Chris Dollin <ch...@epimorphics.com>.
On Tuesday, November 05, 2013 06:53:17 AM Parastoo Delgoshaei wrote:
> Claude,
> Thanks for your response. This solution works only if you have hard coded add/removal statements (i.e. model.add( S, P, O2 ); or model.remove(s);) However, I do not see any add and removal notifications as a result of rule checking. The model certainly has changed I see it in the print out after the rule checking. However, the listener does not recognize this add/remove.
> 
> Your help is appreciated,

Show code.

(Are you listening to the model that's being changed?)

Chris

-- 
"The wizard seemed quite willing when I talked to him."  /Howl's Moving Castle/

Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT
Epimorphics Ltd. is a limited company registered in England (number 7016688)


Re: Jena property change listener

Posted by Parastoo Delgoshaei <ap...@yahoo.com>.
Claude,
Thanks for your response. This solution works only if you have hard coded add/removal statements (i.e. model.add( S, P, O2 ); or model.remove(s);) However, I do not see any add and removal notifications as a result of rule checking. The model certainly has changed I see it in the print out after the rule checking. However, the listener does not recognize this add/remove.

Your help is appreciated,
-P.



On Tuesday, November 5, 2013 7:11 AM, Claude Warren <cl...@xenei.com> wrote:
 
Parastoo,

1) The model does not have a concept of change resource instead it does a
delete and add.  So to detect a change of resource you will have to
determine exactly what you mean and be able to detect it by looking at both
the statement that was deleted and the statement that was added.  Armed
with this information you can proceed to do the following:

  2) Create a ModelChangedListener implementation that detects the pairs
you identified in the step above.

class MyModelChangeListener implements ModelChangedListener {

// code to detect the conditions enumerated in step 1.

// code to send notification of change as required by your application.

}


3) Register your listener with the model.

ModelChangeListener mcl = new MyModelChangeListener()

model.register(  mcl );

// Note if you register multiple times you will receive multiple
notifications.


4) test it.

Statement s = model.find( S, P, O );

model.remove(s);

model.add( S, P, O2 );

// did your listener detect the change?


Hope this helps,

Claude




On Tue, Nov 5, 2013 at 1:07 AM, Parastoo Delgoshaei <ap...@yahoo.com>wrote:

> Can you be more specific on how to catch that change. The change is as a
> result of rule checking.
>
> Thanks,
> -P.
>
>
>
> On Monday, November 4, 2013 3:50 PM, Claude Warren <cl...@xenei.com>
> wrote:
>
> When a property is changed the graph sees both a delete and add
> notification.
>
>
>
> On Mon, Nov 4, 2013 at 5:17 PM, Parastoo Delgoshaei <apa_1381@yahoo.com
> >wrote:
>
> > Hi everyone,
> > I was wondering if Jena supports model property change listener. i.e.
> > there is a mechanism to be notified if a value of and object or datatype
> > property has changed in an individual of your model.
> >
> > Thanks,
> > -P.
>
>
>
>
> --
> I like: Like Like - The likeliest place on the web<
> http://like-like.xenei.com>
> LinkedIn: http://www.linkedin.com/in/claudewarren





-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: Jena property change listener

Posted by Claude Warren <cl...@xenei.com>.
Parastoo,

1) The model does not have a concept of change resource instead it does a
delete and add.  So to detect a change of resource you will have to
determine exactly what you mean and be able to detect it by looking at both
the statement that was deleted and the statement that was added.  Armed
with this information you can proceed to do the following:

  2) Create a ModelChangedListener implementation that detects the pairs
you identified in the step above.

class MyModelChangeListener implements ModelChangedListener {

// code to detect the conditions enumerated in step 1.

// code to send notification of change as required by your application.

}


3) Register your listener with the model.

ModelChangeListener mcl = new MyModelChangeListener()

model.register(  mcl );

// Note if you register multiple times you will receive multiple
notifications.


4) test it.

Statement s = model.find( S, P, O );

model.remove(s);

model.add( S, P, O2 );

// did your listener detect the change?


Hope this helps,

Claude




On Tue, Nov 5, 2013 at 1:07 AM, Parastoo Delgoshaei <ap...@yahoo.com>wrote:

> Can you be more specific on how to catch that change. The change is as a
> result of rule checking.
>
> Thanks,
> -P.
>
>
>
> On Monday, November 4, 2013 3:50 PM, Claude Warren <cl...@xenei.com>
> wrote:
>
> When a property is changed the graph sees both a delete and add
> notification.
>
>
>
> On Mon, Nov 4, 2013 at 5:17 PM, Parastoo Delgoshaei <apa_1381@yahoo.com
> >wrote:
>
> > Hi everyone,
> > I was wondering if Jena supports model property change listener. i.e.
> > there is a mechanism to be notified if a value of and object or datatype
> > property has changed in an individual of your model.
> >
> > Thanks,
> > -P.
>
>
>
>
> --
> I like: Like Like - The likeliest place on the web<
> http://like-like.xenei.com>
> LinkedIn: http://www.linkedin.com/in/claudewarren




-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: Jena property change listener

Posted by Parastoo Delgoshaei <ap...@yahoo.com>.
Can you be more specific on how to catch that change. The change is as a result of rule checking.

Thanks,
-P.



On Monday, November 4, 2013 3:50 PM, Claude Warren <cl...@xenei.com> wrote:
 
When a property is changed the graph sees both a delete and add
notification.



On Mon, Nov 4, 2013 at 5:17 PM, Parastoo Delgoshaei <ap...@yahoo.com>wrote:

> Hi everyone,
> I was wondering if Jena supports model property change listener. i.e.
> there is a mechanism to be notified if a value of and object or datatype
> property has changed in an individual of your model.
>
> Thanks,
> -P.




-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: Jena property change listener

Posted by Claude Warren <cl...@xenei.com>.
When a property is changed the graph sees both a delete and add
notification.


On Mon, Nov 4, 2013 at 5:17 PM, Parastoo Delgoshaei <ap...@yahoo.com>wrote:

> Hi everyone,
> I was wondering if Jena supports model property change listener. i.e.
> there is a mechanism to be notified if a value of and object or datatype
> property has changed in an individual of your model.
>
> Thanks,
> -P.




-- 
I like: Like Like - The likeliest place on the web<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren