Examples of AtomDConstant


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

        ATermAppl facetRestriction = (ATermAppl) list.getFirst();       
        ATermAppl facet = (ATermAppl) facetRestriction.getArgument( 0 );       
        String builtin = FACETS.get( facet );
        if( builtin != null ) {         
          ATermAppl value = (ATermAppl) facetRestriction.getArgument( 1 );
          atoms.add( new BuiltInAtom( builtin, var, new AtomDConstant( value ) ) );
        }
        else {
          atoms.add( new DataRangeAtom( c, var ) );
          return;
        }
View Full Code Here

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

    assertIteratorValues(gen.iterator(), expected.iterator());
  }

  @Test
  public void testDatavalueBindingGeneratorChainedSubject() {
    DatavaluedPropertyAtom pattern1 = new DatavaluedPropertyAtom(dp2, x, new AtomDConstant(data2));
    DatavaluedPropertyAtom pattern2 = new DatavaluedPropertyAtom(dp2, y, new AtomDConstant(data2));

    BindingHelper genHelper1 = new DatavaluePropertyBindingHelper(kb.getABox(), pattern1);
    BindingHelper genHelper2 = new DatavaluePropertyBindingHelper(kb.getABox(), pattern2);
    BindingGenerator gen = new BindingGeneratorImpl(kb.getABox(), new VariableBinding(kb.getABox()), Arrays
                    .asList(new BindingHelper[] { genHelper1, genHelper2 }));
View Full Code Here

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

  }

  @Test
  public void testDatavalueBindingGeneratorSubjects() {
    DatavaluedPropertyAtom pattern = new DatavaluedPropertyAtom(dp2, x, new AtomDConstant(data2));

    BindingHelper genHelper = new DatavaluePropertyBindingHelper(kb.getABox(), pattern);
    BindingGenerator gen = new BindingGeneratorImpl(kb.getABox(), new VariableBinding(kb.getABox()), Collections
                    .singletonList(genHelper));
View Full Code Here

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

    ATermAppl i = term( "i" );
    ATermAppl R = term( "R" );
    ATermAppl l = literal( "l" );
    AtomIVariable v = new AtomIVariable( "v" );
    AtomDConstant c = new AtomDConstant( l );

    kb.addIndividual( i );
    kb.addDatatypeProperty( R );
    kb.addPropertyValue( R, i, l );
View Full Code Here

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

    ATermAppl f = TermFactory.literal("f");

    AtomIVariable x = new AtomIVariable("x");

    List<RuleAtom> body = Arrays.<RuleAtom> asList(new ClassAtom(A, x), new DatavaluedPropertyAtom(p,
                    new AtomIConstant(b), new AtomDConstant(TermFactory.literal(true))));
    List<RuleAtom> head = Arrays.<RuleAtom> asList(new DatavaluedPropertyAtom(q, x, new AtomDConstant(t)));
    kb.addRule(new Rule(head, body));

    body = Arrays.<RuleAtom> asList(new ClassAtom(A, x), new DatavaluedPropertyAtom(p, new AtomIConstant(b),
                    new AtomDConstant(TermFactory.literal(false))));
    head = Arrays.<RuleAtom> asList(new DatavaluedPropertyAtom(q, x, new AtomDConstant(f)));
    kb.addRule(new Rule(head, body));

    assertIteratorValues(kb.getDataPropertyValues(q, a).iterator(), t);
    assertIteratorValues(kb.getDataPropertyValues(q, b).iterator());
  }
View Full Code Here

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

    ATermAppl f = TermFactory.literal("f");

    AtomIVariable x = new AtomIVariable("x");

    List<RuleAtom> body = Arrays.<RuleAtom> asList(new ClassAtom(A, x), new ClassAtom(B, new AtomIConstant(b)));
    List<RuleAtom> head = Arrays.<RuleAtom> asList(new DatavaluedPropertyAtom(q, x, new AtomDConstant(t)));
    kb.addRule(new Rule(head, body));

    body = Arrays.<RuleAtom> asList(new ClassAtom(A, x), new ClassAtom(A, new AtomIConstant(b)));
    head = Arrays.<RuleAtom> asList(new DatavaluedPropertyAtom(q, x, new AtomDConstant(f)));
    kb.addRule(new Rule(head, body));

    body = Arrays.<RuleAtom> asList(new ClassAtom(B, x));
    head = Arrays.<RuleAtom> asList(new ClassAtom(C, x));
    kb.addRule(new Rule(head, body));
View Full Code Here

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

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

    List<RuleAtom> body = Arrays.<RuleAtom> asList(new ClassAtom(A, x),
            new DatavaluedPropertyAtom(p, new AtomIConstant(b), y),
            new BuiltInAtom(SWRLB + "equal", y, new AtomDConstant(TermFactory.literal(true))));
    List<RuleAtom> head = Arrays.<RuleAtom> asList(new DatavaluedPropertyAtom(q, x, new AtomDConstant(t)));
    kb.addRule(new Rule(head, body));

    body = Arrays.<RuleAtom> asList(new ClassAtom(A, x),
            new DatavaluedPropertyAtom(p, new AtomIConstant(b), y),
            new BuiltInAtom(SWRLB + "equal", y, new AtomDConstant(TermFactory.literal(false))));
    head = Arrays.<RuleAtom> asList(new DatavaluedPropertyAtom(q, x, new AtomDConstant(f)));
    kb.addRule(new Rule(head, body));

    assertIteratorValues(kb.getDataPropertyValues(q, a).iterator(), t);
    assertIteratorValues(kb.getDataPropertyValues(q, b).iterator());
  }
View Full Code Here

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

    AtomIVariable x = new AtomIVariable("x");
    AtomIVariable y = new AtomIVariable("y");

    List<RuleAtom> body = Arrays.<RuleAtom> asList(new ClassAtom(A, x),
            new IndividualPropertyAtom(r, y, new AtomIConstant(b)),
            new DatavaluedPropertyAtom(p, y, new AtomDConstant(TermFactory.literal(true))));
    List<RuleAtom> head = Arrays.<RuleAtom> asList(new DatavaluedPropertyAtom(q, x, new AtomDConstant(t)));
    kb.addRule(new Rule(head, body));

    body = Arrays.<RuleAtom> asList(new ClassAtom(A, x),
            new IndividualPropertyAtom(r, y, new AtomIConstant(b)),
            new DatavaluedPropertyAtom(p, y, new AtomDConstant(TermFactory.literal(false))));
    head = Arrays.<RuleAtom> asList(new DatavaluedPropertyAtom(q, x, new AtomDConstant(f)));
    kb.addRule(new Rule(head, body));

    assertIteratorValues(kb.getDataPropertyValues(q, a).iterator(), t);
    assertIteratorValues(kb.getDataPropertyValues(q, b).iterator());
  }
View Full Code Here

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

    AtomDVariable y = new AtomDVariable("y");
    AtomDVariable z = new AtomDVariable("z");
   
    List<RuleAtom> body = Arrays.<RuleAtom> asList(
            new DatavaluedPropertyAtom(p, x, y),
            new BuiltInAtom( SWRLB + "pow", z, y, new AtomDConstant(TermFactory.literal(2))),
            new BuiltInAtom( SWRLB + "lessThan", z, new AtomDConstant(TermFactory.literal(100)))
            );
    List<RuleAtom> head = Arrays.<RuleAtom> asList(new ClassAtom(A, x));
    kb.addRule(new Rule(head, body));

    assertIteratorValues(kb.getInstances(A).iterator(), a, b);
View Full Code Here

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

  }
 
  @Test
  public void testTokenizeBinding() {
    KnowledgeBase kb = new KnowledgeBase();
    AtomDConstant data = new AtomDConstant( literal( "hi;bye;foo;bar" ) );
   
    AtomDVariable x = new AtomDVariable("x");
    AtomDConstant semicolan = new AtomDConstant( literal( ";" ) );
    Collection<AtomVariable> emptyCollection = Collections.emptySet();
    Collection<AtomVariable> xSingleton = Collections.singleton( (AtomVariable) x );
   
    BuiltInAtom oneVarAtom = new BuiltInAtom( Namespaces.SWRLB + "tokenize", x, data, semicolan );
    BindingHelper sharedVarHelper = StringOperators.tokenize.createHelper( oneVarAtom );
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.