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

Examples of org.apache.stanbol.rules.base.api.util.AtomList


    protected <T> T adaptRuleTo(Rule rule, Class<T> type) throws RuleAtomCallExeption,
                                                         UnsupportedTypeForExportException,
                                                         UnavailableRuleObjectException {

        if (type == com.hp.hpl.jena.reasoner.rulesys.Rule.class) {
            AtomList bodyAtomList = rule.getBody();
            AtomList headAtomList = rule.getHead();

            List<ClauseEntry> headClauseEntries = new ArrayList<ClauseEntry>();
            List<ClauseEntry> bodyClauseEntries = new ArrayList<ClauseEntry>();

           
            variableMap = new HashMap<String,Integer>();
           
            Iterator<RuleAtom> it = headAtomList.iterator();
            while (it.hasNext()) {
                RuleAtom atom = it.next();
                ClauseEntry clauseEntry = adaptRuleAtomTo(atom, com.hp.hpl.jena.reasoner.rulesys.Rule.class);

                if (clauseEntry instanceof HigherOrderClauseEntry) {
View Full Code Here


    @Override
    public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption {

        org.apache.stanbol.rules.manager.atoms.UnionAtom tmp = (org.apache.stanbol.rules.manager.atoms.UnionAtom) ruleAtom;

        AtomList atomList1 = tmp.getAtomList1();
        AtomList atomList2 = tmp.getAtomList2();

        String scope1 = "";

        for (RuleAtom inGroupRuleAtom : atomList1) {
            if (!scope1.isEmpty()) {
View Full Code Here

                                                                         AtomList[] atoms = (AtomList[]) obj;
                                                                                         String ruleStorePrefix = kb.getPrefixURI("rmi2");
                                                                                         ruleStorePrefix = ruleStorePrefix.substring(0, ruleStorePrefix.length());

                                                                                         if(atoms.length == 1){
                                                            AtomList body = atoms[0];
                                                            if(body.size() == 1){
                                                                    // FIXME it previously managed SPARQL code injection.
                                                            }

                                                     }
                                                 else{
View Full Code Here

     {if (true) return ruleAtoms;}
    throw new Error("Missing return statement in function");
  }

  final public AtomList[] ruleDefinition() throws ParseException {
AtomList body; AtomList head; Token t;
    body = atomList();
    jj_consume_token(LARROW);
    head = atomList();
          {if (true) return new AtomList[]{body, head};}
    throw new Error("Missing return statement in function");
View Full Code Here

          {if (true) return new AtomList[]{body, head};}
    throw new Error("Missing return statement in function");
  }

  final public AtomList atomList() throws ParseException {
AtomList atomList = new AtomList(); RuleAtom kReSAtom;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case SAME:
    case DIFFERENT:
    case LESSTHAN:
    case GREATERTHAN:
    case IS:
    case NEW_IRI:
    case NEW_LITERAL:
    case STARTS_WITH:
    case ENDS_WITH:
    case LET:
    case HAS:
    case VALUES:
    case NOT:
    case UNION:
    case IS_BLANK:
      kReSAtom = atom();
      atomList = atomListRest();
          atomList.addToHead(kReSAtom); {if (true) return atomList;}
      break;
    default:
      jj_la1[2] = jj_gen;

         {if (true) return atomList;}
View Full Code Here

    }
    throw new Error("Missing return statement in function");
  }

  final public AtomList atomListRest() throws ParseException {
AtomList atomList = new AtomList(); RuleAtom kReSAtom;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case AND:
      jj_consume_token(AND);
      atomList = atomList();
          {if (true) return atomList;}
View Full Code Here

    }
    throw new Error("Missing return statement in function");
  }

  final public RuleAtom unionAtom() throws ParseException {
AtomList atomList1; AtomList atomList2;
    jj_consume_token(UNION);
    jj_consume_token(LPAR);
    atomList1 = atomList();
    jj_consume_token(COMMA);
    atomList2 = atomList();
View Full Code Here

        AtomList[] atoms = (AtomList[]) obj;
        String varPrefix = kb.getPrefixURI("var");
        varPrefix = varPrefix.substring(0, varPrefix.length());

        if (atoms.length == 1) {
          AtomList body = atoms[0];
          if (body.size() == 1) {
            Iterator<RuleAtom> it = body.iterator();
            RuleAtom atom = it.next();
            if (atom.isSPARQLConstruct()) {
              rule = new RuleImpl(varPrefix + nsPrefix, atoms[0],
                  null, RuleExpressiveness.SPARQLConstruct);
              kb.addRule(rule);
View Full Code Here

    }
    throw new Error("Missing return statement in function");
  }

  final public AtomList[] ruleDefinition() throws ParseException {
    AtomList body;
    AtomList head;
    Token t;
    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
    case LARROW:
    case SAME:
    case DIFFERENT:
    case LESSTHAN:
    case GREATERTHAN:
    case IS:
    case NEW_NODE:
    case STARTS_WITH:
    case ENDS_WITH:
    case LET:
    case HAS:
    case VALUES:
    case NOT:
    case UNION:
    case IS_BLANK:
      body = atomList();
      jj_consume_token(LARROW);
      head = atomList();
      {
        if (true)
          return new AtomList[] { body, head };
      }
      break;
    case SPARQL_C:
      jj_consume_token(SPARQL_C);
      jj_consume_token(LPAR);
      t = jj_consume_token(SPARQL_STRING);
      jj_consume_token(RPAR);
      RuleAtom sparqlAtom = new SPARQLcAtom(t.image);
      AtomList atomList = new AtomList();
      atomList.addToHead(sparqlAtom);
      {
        if (true)
          return new AtomList[] { atomList };
      }
      break;
    case SPARQL_D:
      jj_consume_token(SPARQL_D);
      jj_consume_token(LPAR);
      t = jj_consume_token(SPARQL_STRING);
      jj_consume_token(RPAR);
      RuleAtom sparqlDAtom = new SPARQLdAtom(t.image);
      AtomList atomDList = new AtomList();
      atomDList.addToHead(sparqlDAtom);
      {
        if (true)
          return new AtomList[] { atomDList };
      }
      break;
    case SPARQL_DD:
      jj_consume_token(SPARQL_DD);
      jj_consume_token(LPAR);
      t = jj_consume_token(SPARQL_STRING);
      jj_consume_token(RPAR);
      RuleAtom sparqlDDAtom = new SPARQLddAtom(t.image);
      AtomList atomDDList = new AtomList();
      atomDDList.addToHead(sparqlDDAtom);
      {
        if (true)
          return new AtomList[] { atomDDList };
      }
      break;
View Full Code Here

    }
    throw new Error("Missing return statement in function");
  }

  final public AtomList atomList() throws ParseException {
    AtomList atomList = new AtomList();
    RuleAtom kReSAtom;
    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
    case SAME:
    case DIFFERENT:
    case LESSTHAN:
    case GREATERTHAN:
    case IS:
    case NEW_NODE:
    case STARTS_WITH:
    case ENDS_WITH:
    case LET:
    case HAS:
    case VALUES:
    case NOT:
    case UNION:
    case IS_BLANK:
      kReSAtom = atom();
      atomList = atomListRest();
      atomList.addToHead(kReSAtom);
      {
        if (true)
          return atomList;
      }
      break;
View Full Code Here

TOP

Related Classes of org.apache.stanbol.rules.base.api.util.AtomList

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.