Package com.clarkparsia.pellet.rules.model

Examples of com.clarkparsia.pellet.rules.model.Rule


          atom = new ClassAtom( normC, ca.getArgument() );
      }
      body.add( atom );
    }

    return new Rule( rule.getName(), head, body );
  }
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 bYearAtom = new DatavaluedPropertyAtom( bYear, x, xYear );
    RuleAtom bMonthAtom = new DatavaluedPropertyAtom( bMonth, x, xMonth );
    RuleAtom bDayAtom = new DatavaluedPropertyAtom( bDay, x, xDay );
    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 );

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

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

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

    head.add( new DatavaluedPropertyAtom( sum, x, z3 ) );
    head.add( new DatavaluedPropertyAtom( difference, x, z4 ) );
    head.add( new DatavaluedPropertyAtom( product, x, z5 ) );
    head.add( new DatavaluedPropertyAtom( quotient, x, z6 ) );

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

    kb.realize();
    assertTrue( kb.hasPropertyValue( i, sum, sum11 ) );
    assertTrue( kb.hasPropertyValue( i, sum, sum12 ) );
View Full Code Here

    RuleAtom body1 = new IndividualPropertyAtom( r, x, y );
    RuleAtom body2 = new DatavaluedPropertyAtom( p, x, z ), head = new DatavaluedPropertyAtom(
        p, y, z );

    Rule rule = new Rule( Collections.singleton( head ), Arrays.asList( new RuleAtom[] {
        body1, body2 } ) );
    kb.addRule( rule );

    kb.realize();
    assertTrue( kb.hasPropertyValue( j, p, d ) );
View Full Code Here

    RuleAtom body1 = new IndividualPropertyAtom( r, x, y );
    RuleAtom body2 = new DatavaluedPropertyAtom( p, x, z );
    RuleAtom head = new DatavaluedPropertyAtom( p, y, z );

    Rule rule = new Rule( Collections.singleton( head ), Arrays.asList( body1, body2 ) );
    kb.addRule( rule );

    kb.realize();
    assertTrue( kb.hasPropertyValue( j, p, d ) );
    assertTrue( kb.hasPropertyValue( k, p, d ) );
View Full Code Here

    RuleAtom head = new DatavaluedPropertyAtom( p, x, z );
    RuleAtom body1 = new DatavaluedPropertyAtom( p, y, z );
    RuleAtom body2 = new IndividualPropertyAtom( r, x, y );

    Rule rule = new Rule( Collections.singleton( head ), Arrays.asList( body1, body2 ) );
    kb.addRule( rule );
   
    kb.ensureConsistency();

    assertTrue( kb.hasPropertyValue( j, r, i ) );
View Full Code Here

    kb.addClass( c );
    kb.addClass( d );
    kb.addIndividual( i );
    kb.addType( i, c );

    kb.addRule( new Rule( Arrays.asList( new RuleAtom[] { new ClassAtom( d, new AtomIConstant(
        i ) ) } ), Arrays
        .asList( new RuleAtom[] { new ClassAtom( c, new AtomIConstant( i ) ) } ) ) );

    kb.realize();
    assertTrue( kb.getTypes( i ).contains( Collections.singleton( d ) ) );
View Full Code Here

    kb.addIndividual( j );
    kb.addObjectProperty( r );
    kb.addSubClass( TOP, min( r, 1, TOP ) );
    kb.addSubClass( TOP, oneOf( i, j ) );

    kb.addRule( new Rule( Collections.singletonList( new DifferentIndividualsAtom( x, y ) ),
        Collections.singletonList( new IndividualPropertyAtom( r, x, y ) ) ) );

    kb.realize();
    assertTrue( kb.isConsistent() );
    assertTrue( kb.isDifferentFrom( i, j ) );
View Full Code Here

TOP

Related Classes of com.clarkparsia.pellet.rules.model.Rule

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.