Package org.apache.stanbol.rules.base.api

Examples of org.apache.stanbol.rules.base.api.RuleAtom


            return false;
        }
    }

    public RuleAtom next() {
        RuleAtom atom = kReSRuleAtoms[currentIndex];
        currentIndex++;
        return atom;
    }
View Full Code Here


    }

    public boolean remove(Object o) {
        boolean removed = false;
        for (int i = 0; i < kReSRuleAtoms.length && !removed; i++) {
            RuleAtom semionRule = kReSRuleAtoms[i];
            if (semionRule.equals(o)) {
                RuleAtom[] semionRulesCopy = new RuleAtom[kReSRuleAtoms.length - 1];
                System.arraycopy(kReSRuleAtoms, 0, semionRulesCopy, 0, i);
                System.arraycopy(kReSRuleAtoms, i + 1, semionRulesCopy, 0, semionRulesCopy.length - i);
                kReSRuleAtoms = semionRulesCopy;
                removed = true;
View Full Code Here

    public boolean removeAll(Collection<?> c) {
        if (contains(c)) {
            for (Object o : c) {
                boolean removed = false;
                for (int i = 0; i < kReSRuleAtoms.length && !removed; i++) {
                    RuleAtom semionRule = kReSRuleAtoms[i];
                    if (semionRule.equals(o)) {
                        RuleAtom[] semionRulesCopy = new RuleAtom[kReSRuleAtoms.length - 1];
                        System.arraycopy(kReSRuleAtoms, 0, semionRulesCopy, 0, i);
                        System.arraycopy(kReSRuleAtoms, i + 1, semionRulesCopy, 0, semionRulesCopy.length - i);
                        kReSRuleAtoms = semionRulesCopy;
                        removed = true;
View Full Code Here

        List<Expression> expressions = new ArrayList<Expression>();

        Iterator<RuleAtom> it = rule.getBody().iterator();
        while (it.hasNext()) {
            RuleAtom ruleAtom = it.next();
            ClerezzaSparqlObject clerezzaSparqlObject = null;

            log.debug("Type to adapt {}", type);
            clerezzaSparqlObject = (ClerezzaSparqlObject) adaptRuleAtomTo(ruleAtom, type);

            Object clerezzaObj = clerezzaSparqlObject.getClerezzaObject();
            if (clerezzaObj instanceof TriplePattern) {
                triplePatterns.add((TriplePattern) clerezzaObj);
            } else if (clerezzaObj instanceof Expression) {
                expressions.add((Expression) clerezzaObj);
            }
        }

        SimpleGroupGraphPattern groupGraphPattern = new SimpleGroupGraphPattern();

        groupGraphPattern.addTriplePatterns(triplePatterns);

        for (Expression expression : expressions) {
            groupGraphPattern.addConstraint(expression);
        }

        triplePatterns = new HashSet<TriplePattern>();
        it = rule.getHead().iterator();
        while (it.hasNext()) {

            RuleAtom ruleAtom = it.next();

            ClerezzaSparqlObject clerezzaSparqlObject = (ClerezzaSparqlObject) adaptRuleAtomTo(ruleAtom, type);
            triplePatterns.add((TriplePattern) clerezzaSparqlObject.getClerezzaObject());

        }
View Full Code Here

        IObjectAtom argument1 = tmp.getArgument1();

        IObjectAtom datatypeProperty = tmp.getDatatypeProperty();

        RuleAtom argument2 = tmp.getArgument2();

        SWRLAtom arg1Atom = (SWRLAtom) adapter.adaptTo(argument1, SWRLRule.class);
        SWRLAtom predicateAtom = (SWRLAtom) adapter.adaptTo(datatypeProperty, SWRLRule.class);
        SWRLAtom arg2Atom = (SWRLAtom) adapter.adaptTo(argument2, SWRLRule.class);
View Full Code Here

        IObjectAtom argument1 = tmp.getArgument1();

        IObjectAtom datatypeProperty = tmp.getDatatypeProperty();

        RuleAtom argument2 = tmp.getArgument2();

        ClauseEntry argument2ClauseEntry = (ClauseEntry) adapter.adaptTo(argument2, Rule.class);
        ClauseEntry argument1ClauseEntry = (ClauseEntry) adapter.adaptTo(argument1, Rule.class);
        ClauseEntry datatypePropertyClauseEntry = (ClauseEntry) adapter.adaptTo(datatypeProperty, Rule.class);
View Full Code Here

      return false;
    }
  }

  public RuleAtom next() {
    RuleAtom atom = kReSRuleAtoms[currentIndex];
    currentIndex++;
    return atom;
  }
View Full Code Here

  }

  public boolean remove(Object o) {
    boolean removed = false;
    for(int i=0; i<kReSRuleAtoms.length && !removed; i++){
      RuleAtom semionRule = kReSRuleAtoms[i];
      if(semionRule.equals(o)){
        RuleAtom[] semionRulesCopy = new RuleAtom[kReSRuleAtoms.length-1];
        System.arraycopy(kReSRuleAtoms, 0, semionRulesCopy, 0, i);
        System.arraycopy(kReSRuleAtoms, i+1, semionRulesCopy, 0, semionRulesCopy.length-i);
        kReSRuleAtoms = semionRulesCopy;
        removed = true;
View Full Code Here

  public boolean removeAll(Collection<?> c) {
    if(contains(c)){
      for(Object o : c){
        boolean removed = false;
        for(int i=0; i<kReSRuleAtoms.length && !removed; i++){
          RuleAtom semionRule = kReSRuleAtoms[i];
          if(semionRule.equals(o)){
            RuleAtom[] semionRulesCopy = new RuleAtom[kReSRuleAtoms.length-1];
            System.arraycopy(kReSRuleAtoms, 0, semionRulesCopy, 0, i);
            System.arraycopy(kReSRuleAtoms, i+1, semionRulesCopy, 0, semionRulesCopy.length-i);
            kReSRuleAtoms = semionRulesCopy;
            removed = true;
View Full Code Here

    }

    @Test
    public void testValidAtomWithVariableArguments() {

        RuleAtom ruleAtom = new DatavaluedPropertyAtom(datatypeProperty, argument1, variable);

        execTest(ruleAtom);

    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.rules.base.api.RuleAtom

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.