Package org.mindswap.pellet

Examples of org.mindswap.pellet.KnowledgeBase.addRule()


    List<RuleAtom> body = new ArrayList<RuleAtom>();
    List<RuleAtom> head = new ArrayList<RuleAtom>();

    body.add( new ClassAtom( D, x ) );

    kb.addRule( new Rule( head, body ) );

    assertFalse( kb.isConsistent() );
  }

  @Test
View Full Code Here


    List<RuleAtom> body = new ArrayList<RuleAtom>();
    List<RuleAtom> head = new ArrayList<RuleAtom>();

    body.add( new DatavaluedPropertyAtom( R, v, c ) );

    kb.addRule( new Rule( head, body ) );

    assertFalse( kb.isConsistent() );
  }

  @Test
View Full Code Here

    List<RuleAtom> body = new ArrayList<RuleAtom>();
    List<RuleAtom> head = new ArrayList<RuleAtom>();

    body.add( new ClassAtom( CuD, x ) );

    kb.addRule( new Rule( head, body ) );

    assertFalse( kb.isConsistent() );
  }

  @Test
View Full Code Here

    List<RuleAtom> head = new ArrayList<RuleAtom>();

    body.add( new IndividualPropertyAtom( p, x, y ) );
    head.add( new IndividualPropertyAtom( q, x, y ) );

    kb.addRule( new Rule( head, body ) );

    assertTrue( kb.hasPropertyValue( a, p, b ) );
    assertTrue( kb.hasPropertyValue( a, p, c ) );
    assertTrue( kb.hasPropertyValue( b, p, c ) );
View Full Code Here

    List<RuleAtom> body = new ArrayList<RuleAtom>();
    body.add( new ClassAtom( C, x ) );
    List<RuleAtom> head = new ArrayList<RuleAtom>();
    head.add( new IndividualPropertyAtom( p, x, y ) );
    Rule rule = new Rule( head, body );
    kb.addRule( rule );
   
    assertEquals( singleton( rule ), kb.getRules() )
    assertNull( kb.getNormalizedRules().get( rule ) );

    assertTrue( kb.isConsistent() );   
View Full Code Here

   
    AtomIVariable x = new AtomIVariable( "x" )
    List<RuleAtom> body = Arrays.<RuleAtom>asList( new IndividualPropertyAtom( p, x, x ) );
    List<RuleAtom> head = Arrays.<RuleAtom>asList( new ClassAtom( A, x ) );
 
    kb.addRule( new Rule( head, body ) );
 
    assertTrue( kb.isConsistent() );
   
    assertTrue( kb.isType( a, A ) );
    assertFalse( kb.isType( b, A ) );
View Full Code Here

   
    AtomIVariable x = new AtomIVariable( "x" )
    List<RuleAtom> body = Arrays.<RuleAtom>asList( new IndividualPropertyAtom( p, x, new AtomIConstant( c ) ) );
    List<RuleAtom> head = Arrays.<RuleAtom>asList( new ClassAtom( A, x ) );
 
    kb.addRule( new Rule( head, body ) );
 
    assertTrue( kb.isConsistent() );
   
    assertFalse( kb.isType( a, A ) );
    assertTrue( kb.isType( b, A ) );
View Full Code Here

    AtomIVariable x = new AtomIVariable( "x" )
    AtomIVariable y = new AtomIVariable( "y" )
    List<RuleAtom> body = Arrays.<RuleAtom>asList( new IndividualPropertyAtom( p, x, y ) );
    List<RuleAtom> head = Arrays.<RuleAtom>asList( new ClassAtom( B, x ) );
 
    kb.addRule( new Rule( head, body ) );
 
    assertTrue( kb.isConsistent() );
   
    kb.addPropertyValue( p, a, a );
   
View Full Code Here

    body.add( new BuiltInAtom( SWRLB + "add", z3, z1, z2 ) );

    List<RuleAtom> head = new ArrayList<RuleAtom>();
    head.add( new DatavaluedPropertyAtom( r, x, z3 ) );

    kb.addRule( new Rule( head, body ) );

    kb.realize();
    assertTrue( kb.hasPropertyValue( i, r, d12 ) );

  }
View Full Code Here

    RuleAtom bTZAtom = new DatavaluedPropertyAtom( bTZ, x, xTZ );

    Rule fromDate = new Rule( Arrays
        .asList( new RuleAtom[] { bYearAtom, bMonthAtom, bDayAtom } ), Arrays
        .asList( new RuleAtom[] { dateBuiltIn, bDateAtom } ) );
    kb.addRule( fromDate );

    Rule fromDateTZ = new Rule( Arrays.asList( new RuleAtom[] {
        bYearAtom, bMonthAtom, bDayAtom, bTZAtom } ), Arrays.asList( new RuleAtom[] {
        dateBuiltInTZ, bDateAtom } ) );
    kb.addRule( fromDateTZ );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.