Advertisement
Guest User

Untitled

a guest
Apr 9th, 2013
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.15 KB | None | 0 0
  1. Interested in an NPE ?
  2. 5.5.0.Final
  3. in class NamedEntryPoint :
  4.  
  5.     protected FactHandle insert(final Object object,
  6.                                 final Object tmsValue,
  7.                                 final boolean dynamic,
  8.                                 boolean logical,
  9.                                 final Rule rule,
  10.                                 final Activation activation) throws FactException {
  11.         if ( object == null ) {
  12.             // you cannot assert a null object
  13.             return null;
  14.         }
  15.  
  16.         try {
  17.             this.wm.startOperation();
  18.  
  19.             ObjectTypeConf typeConf = this.typeConfReg.getObjectTypeConf( this.entryPoint,
  20.                                                                           object );
  21.             if ( logical && !typeConf.isTMSEnabled()) {
  22.                 enableTMS(object, typeConf);
  23.             }
  24.  
  25.             InternalFactHandle handle = null;
  26.  
  27.             if ( this.wm.isSequential() ) {
  28.                 handle = createHandle( object,
  29.                                        typeConf );
  30.                 insert( handle,
  31.                         object,
  32.                         rule,
  33.                         activation,
  34.                         typeConf );
  35.                 return handle;
  36.             }
  37.             try {
  38.                 this.lock.lock();
  39.                 this.ruleBase.readLock();
  40.                 // check if the object already exists in the WM
  41.                 handle = this.objectStore.getHandleForObject( object );
  42.  
  43.                 if ( typeConf.isTMSEnabled() ) {
  44.                  
  45.                     EqualityKey key;
  46.  
  47.                     TruthMaintenanceSystem tms = wm.getTruthMaintenanceSystem();
  48.                     if ( handle == null ) {
  49.                         // lets see if the object is already logical asserted
  50.                         key = tms.get( object );
  51.                     } else {
  52.                         // Object is already asserted, so check and possibly correct its
  53.                         // status and then return the handle
  54.                         key = handle.getEqualityKey();
  55.  
  56.                         if ( key.getStatus() == EqualityKey.STATED ) {
  57.  
  58. // key == null here !!!!!!!!!!!!!!!!!!!
  59. //  conf.setAssertBehaviour( AssertBehaviour.EQUALITY );
  60.  
  61. // inserting Triple :
  62. <file:/home/jmv/src/eulergui-code/eulergui/test/import.n3p.n3> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Ontology> .
  63.  
  64. that is already present.
  65.  
  66. And the rule is :
  67. // ---------- N3 rule 9 ----------
  68. /* {
  69. ?ONTO <http://www.w3.org/2002/07/owl#imports> ?X.
  70. }
  71.  => {
  72. ?ONTO <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Ontology>.
  73. }. */
  74.  
  75. rule "project-java-rules.n3 9"
  76. when
  77.   $Triple_1 : Triple( $ONTO : subject, predicate == "<http://www.w3.org/2002/07/owl#imports>", $X : object )
  78. then
  79.   Triple newTriple;
  80.   TripleResult newTripleResult;
  81.   newTriple = new Triple(  );
  82.   newTriple.setSubject( $ONTO );
  83.   newTriple.setPredicate( "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>".toString() );
  84.   newTriple.setObject( "<http://www.w3.org/2002/07/owl#Ontology>" );  insertLogical( newTriple );
  85. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement