Package com.clarkparsia.pellet.rules.rete

Examples of com.clarkparsia.pellet.rules.rete.TermTuple


  }

  @Test
  public void betaNodeMarking() {
    TermTuple t = new TermTuple( DependencySet.INDEPENDENT );
    AlphaNode a = new AlphaNode( t );

    BetaNode b1 = new BetaNode( a, a, false );
    BetaNode b2 = new BetaNode( a, a, false );
    BetaNode b3 = new BetaNode( b1, b2, false );
View Full Code Here


  public List<TermTuple> translateAtoms(Collection<? extends RuleAtom> atoms,
      DependencySet ds) {
    List<TermTuple> result = new ArrayList<TermTuple>(atoms.size());

    for (RuleAtom atom : atoms) {
      TermTuple triple = translateAtom(atom, ds);
      if (triple == null) {
        // Can't translate entire set
        return null;
      }
      result.add(triple);
View Full Code Here

          .getArgument());
      DependencySet mergedDS = ds;
      if (arg.second != DependencySet.INDEPENDENT)
        mergedDS = ds.union(arg.second, abox.doExplanation());

      result = new TermTuple(mergedDS, Compiler.TYPE, arg.first, atom
          .getPredicate());
    }
View Full Code Here

      if (arg1.second != DependencySet.INDEPENDENT)
        mergedDS = ds.union(arg1.second, abox.doExplanation());
      if (arg2.second != DependencySet.INDEPENDENT)
        mergedDS = ds.union(arg2.second, abox.doExplanation());

      result = new TermTuple(mergedDS, atom.getPredicate(), arg1.first,
          arg2.first);
    }
View Full Code Here

      if (arg1.second != DependencySet.INDEPENDENT)
        mergedDS = ds.union(arg1.second, abox.doExplanation());
      if (arg2.second != DependencySet.INDEPENDENT)
        mergedDS = ds.union(arg2.second, abox.doExplanation());

      result = new TermTuple(mergedDS, Compiler.DIFF_FROM, arg1.first,
          arg2.first);
    }
View Full Code Here

      if (arg1.second != DependencySet.INDEPENDENT)
        mergedDS = ds.union(arg1.second, abox.doExplanation());
      if (arg2.second != DependencySet.INDEPENDENT)
        mergedDS = ds.union(arg2.second, abox.doExplanation());

      result = new TermTuple(mergedDS, atom.getPredicate(), arg1.first,
          arg2.first);
    }
View Full Code Here

      if (arg1.second != DependencySet.INDEPENDENT)
        mergedDS = ds.union(arg1.second, abox.doExplanation());
      if (arg2.second != DependencySet.INDEPENDENT)
        mergedDS = ds.union(arg2.second, abox.doExplanation());

      result = new TermTuple(mergedDS, Compiler.SAME_AS, arg1.first,
          arg2.first);
    }
View Full Code Here

    List<TermTuple> body = new ArrayList<TermTuple>();
    Map<ATermAppl, AtomVariable> varToVar = new HashMap<ATermAppl, AtomVariable>();
    for ( RuleAtom atom : rule.getBody() ) {
      atom.accept( filter );
      if ( filter.isSafe() ) {
        TermTuple bodyTerm = translator.translateAtom( atom, ds );
        if ( bodyTerm != null ) {
          body.add( bodyTerm );
          for ( AtomVariable atomVar : VariableUtils.getVars( atom ) ) {
            Pair<ATermAppl, DependencySet> translatedVar = translator.translateAtomObject( atomVar );
            ATermAppl var = translatedVar.first;
            varToVar.put( var, atomVar );
            vars.add( var );
          }
        }
      }
    }
   
    List<ATermAppl> headTerms = new ArrayList<ATermAppl>();
    headTerms.add( VARBINDING );
    headTerms.add( ruleID );
    headTerms.add( DUMMY );
    headTerms.add( DUMMY ); // Space fillers so generated atoms don't collide with the triple-based rules
    headTerms.addAll( vars );
    List<TermTuple> head = Collections.singletonList( new TermTuple( DependencySet.INDEPENDENT,  headTerms ) );
   
    List<AtomVariable> ruleVars = new ArrayList<AtomVariable>( vars.size() );
    for ( ATermAppl var : vars )
      ruleVars.add( varToVar.get( var ) );
   
View Full Code Here

  }

  @Test
  public void testClassAtom() {
    ClassAtom atom = new ClassAtom(a, vx);
    TermTuple triple = new TermTuple(DependencySet.INDEPENDENT, Compiler.TYPE, vrx, cra);
    assertEquals(triple, ruleTranslator.translateAtom(atom, DependencySet.INDEPENDENT));
  }
View Full Code Here

  @Test
  public void testDatavaluedPropertyAtom() {
    kb.addDatatypeProperty(pd);
    DatavaluedPropertyAtom atom = new DatavaluedPropertyAtom(pd, vx, cc);
    TermTuple triple = new TermTuple(DependencySet.INDEPENDENT, pd, vrx, crc);
    assertEquals(triple, ruleTranslator.translateAtom(atom, DependencySet.INDEPENDENT));
  }
View Full Code Here

TOP

Related Classes of com.clarkparsia.pellet.rules.rete.TermTuple

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.