Package com.clarkparsia.pellet.rules.model

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


    AtomIVariable x = new AtomIVariable( "x" ), y = new AtomIVariable( "y" );
    AtomDVariable z = new AtomDVariable( "z" );

    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 );
View Full Code Here


    AtomIVariable x = new AtomIVariable( "x" ), y = new AtomIVariable( "y" );
    AtomDVariable z = new AtomDVariable( "z" );

    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 );
View Full Code Here

    kb.addPropertyValue( p, i, d );

    AtomIVariable x = new AtomIVariable( "x" ), y = new AtomIVariable( "y" );
    AtomDVariable z = new AtomDVariable( "z" );

    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 );
View Full Code Here

    kb.addPropertyValue( R, i, l );

    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() );
  }
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

     
      if( filler.getAFun().equals( ATermUtils.VALUEFUN ) ) {
        ATermAppl nominal = (ATermAppl) filler.getArgument( 0 );
        if( kb.isDatatypeProperty( p ) ) {
          AtomDConstant arg = new AtomDConstant( nominal );
          RuleAtom atom = new DatavaluedPropertyAtom( p, var, arg );
          atoms.add(atom);
        }
        else {
          AtomIConstant arg = new AtomIConstant( nominal );
          RuleAtom atom = new IndividualPropertyAtom( p, var, arg );
          atoms.add(atom);
        }
      }
      else {
        varCount++;
        if( kb.isDatatypeProperty( p ) ) {
          AtomDObject newVar = new AtomDVariable( "var" + varCount );
          RuleAtom atom = new DatavaluedPropertyAtom( p, var, newVar );
          atoms.add(atom);
          processDatatype( newVar, filler, atoms );
        }
        else{
          AtomIObject newVar = new AtomIVariable( "var" + varCount );
View Full Code Here

        body.add( new IndividualPropertyAtom( property, x, z ) );
        body.add( new IndividualPropertyAtom( property, y, z ) );
      }
      else if( isDatatypeProperty( property ) ) {
        AtomDVariable z = new AtomDVariable( "z" + varId );
        body.add( new DatavaluedPropertyAtom( property, x, z ) );
        body.add( new DatavaluedPropertyAtom( property, y, z ) );
      }

      varId++;
    }
View Full Code Here

    AtomDVariable z1 = new AtomDVariable( "z1" );
    AtomDVariable z2 = new AtomDVariable( "z2" );
    AtomDVariable z3 = new AtomDVariable( "z3" );

    List<RuleAtom> body = new ArrayList<RuleAtom>();
    body.add( new DatavaluedPropertyAtom( p, x, z1 ) );
    body.add( new DatavaluedPropertyAtom( q, x, z2 ) );
    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

    AtomDVariable xDate = new AtomDVariable( "xDate" ), xYear = new AtomDVariable( "xYear" ), xMonth = new AtomDVariable(
        "xMonth" ), xDay = new AtomDVariable( "xDay" ), xTZ = new AtomDVariable( "xTZ" );

    RuleAtom dateBuiltIn = new BuiltInAtom( SWRLB + "date", xDate, xYear, xMonth, xDay );
    RuleAtom dateBuiltInTZ = new BuiltInAtom( SWRLB + "date", xDate, xYear, xMonth, xDay, xTZ );
    RuleAtom bDateAtom = new DatavaluedPropertyAtom( bDate, x, xDate );
    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 );
View Full Code Here

    AtomDVariable z4 = new AtomDVariable( "z4" );
    AtomDVariable z5 = new AtomDVariable( "z5" );
    AtomDVariable z6 = new AtomDVariable( "z6" );

    List<RuleAtom> body = new ArrayList<RuleAtom>();
    body.add( new DatavaluedPropertyAtom( p, x, z1 ) );
    body.add( new DatavaluedPropertyAtom( p, x, z2 ) );
    body.add( new BuiltInAtom( SWRLB + "add", z3, z1, z2 ) );
    body.add( new BuiltInAtom( SWRLB + "subtract", z4, z1, z2 ) );
    body.add( new BuiltInAtom( SWRLB + "multiply", z5, z1, z2 ) );
    body.add( new BuiltInAtom( SWRLB + "divide", z6, z1, z2 ) );

    List<RuleAtom> head = new ArrayList<RuleAtom>();
    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();
View Full Code Here

TOP

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

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.