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

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


        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);
            } else if (atom.isSPARQLDelete()) {
              rule = new RuleImpl(varPrefix + nsPrefix, atoms[0],
                  null, RuleExpressiveness.SPARQLDelete);
              kb.addRule(rule);
            } else if (atom.isSPARQLDeleteData()) {
              rule = new RuleImpl(varPrefix + nsPrefix, atoms[0],
                  null, RuleExpressiveness.SPARQLDeleteData);
              kb.addRule(rule);
            }
          }
View Full Code Here


    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 };
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:
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();
      {
View Full Code Here

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

  final public RuleAtom atom() throws ParseException {
    RuleAtom ruleAtom;
    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
    case IS:
      ruleAtom = classAtom();
      {
        if (true)
View Full Code Here

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

  final public ComparisonAtom endsWithAtom() throws ParseException {
    RuleAtom ruleAtom;
    StringFunctionAtom arg;
    StringFunctionAtom stringFunctionAtom;
    jj_consume_token(ENDS_WITH);
    jj_consume_token(LPAR);
    arg = stringFunctionAtom();
View Full Code Here

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

  final public ComparisonAtom startsWithAtom() throws ParseException {
    RuleAtom ruleAtom;
    StringFunctionAtom arg;
    StringFunctionAtom stringFunctionAtom;
    jj_consume_token(STARTS_WITH);
    jj_consume_token(LPAR);
    arg = stringFunctionAtom();
View Full Code Here

   
   
    JenaVariableMap jenaVariableMap = new JenaVariableMapImpl();
    Iterator<RuleAtom> it = this.head.iterator();
    for(int i=0; it.hasNext(); i++){
      RuleAtom atom = it.next();
      JenaClauseEntry jenaClauseEntry = atom.toJenaClauseEntry(jenaVariableMap);
      head[i] = jenaClauseEntry.getClauseEntry();
    }
   
   
    it = this.body.iterator();
    for(int i=0; it.hasNext(); i++){
      RuleAtom atom = it.next();
      JenaClauseEntry jenaClauseEntry = atom.toJenaClauseEntry(jenaVariableMap);
      body[i] = jenaClauseEntry.getClauseEntry();
    }
   
   
    jenaRule = new com.hp.hpl.jena.reasoner.rulesys.Rule(ruleName, head, body);
View Full Code Here

   
    if(isSPARQLConstruct() || isSPARQLDelete()){
      boolean found = false;
      Iterator<RuleAtom> it = body.iterator();
      while(it.hasNext() && !found){
        RuleAtom kReSRuleAtom = it.next();
        sparql = kReSRuleAtom.toSPARQL().getObject();
        found = true;
      }
     
    }
   
    else{
   
      sparql = "CONSTRUCT {";
           
      boolean firstIte = true;
     
      for(RuleAtom kReSRuleAtom : head){
        if(!firstIte){
          sparql += " . ";
        }
        firstIte = false;
        sparql += kReSRuleAtom.toSPARQL().getObject();
      }
     
      sparql += "} ";
      sparql += "WHERE {";
     
      firstIte = true;
      ArrayList<SPARQLObject> sparqlObjects = new ArrayList<SPARQLObject>();
      for(RuleAtom kReSRuleAtom : body){
        SPARQLObject sparqlObject = kReSRuleAtom.toSPARQL();
        if(sparqlObject instanceof SPARQLNot){
          sparqlObjects.add((SPARQLNot) sparqlObject);
        }
        else if(sparqlObject instanceof SPARQLComparison){
          sparqlObjects.add((SPARQLComparison) sparqlObject);
        }
        else{
          if(!firstIte){
            sparql += " . ";
          }
          else{
            firstIte = false;
          }
          sparql += kReSRuleAtom.toSPARQL().getObject();
        }
      }
     
      firstIte = true;
     
View Full Code Here

   
    if(isSPARQLConstruct() || isSPARQLDelete()){
      boolean found = false;
      Iterator<RuleAtom> it = body.iterator();
      while(it.hasNext() && !found){
        RuleAtom kReSRuleAtom = it.next();
        ruleInKReSSyntax = kReSRuleAtom.toSPARQL().getObject();
        found = true;
      }
     
    }
    else{
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.