Package com.hp.hpl.jena.reasoner.rulesys

Examples of com.hp.hpl.jena.reasoner.rulesys.BindingEnvironment.bind()


    try {
      Triple t = Triple.create(s,p,o);
      Reifier r = graph.getReifier();
      Node a = Node.createAnon();
      r.reifyAs(a,t);
      env.bind(args[3],a);
      return true;
    } catch (Exception e) {
      return false;
    }
  }
View Full Code Here


      Triple t = Triple.create(s,p,o);
      context.add(t);
      Node a = Node.createAnon();
      Reifier r = graph.getReifier();
      r.reifyAs(a,t);
      env.bind(args[3],a);
    } catch (Exception e) {
      e.printStackTrace(System.err);
    }   
  }
}
View Full Code Here

    int n = i.toSet().size();
   
    TypeMapper tm = TypeMapper.getInstance();
    RDFDatatype type = tm.getTypeByName(XSD.xint.getURI());
    Node count = Node.createLiteral(Integer.toString(n),null,type);
    env.bind(args[2],count);
    return true;
  }
}
View Full Code Here

    BindingEnvironment env = context.getEnv();
    Node value = env.getGroundVersion(args[0]);
    TypeMapper tm = TypeMapper.getInstance();
    RDFDatatype type = tm.getTypeByName(PrintUtil.expandQname(args[2].toString()));
    Node cast = Node.createLiteral(value.getLiteral().getValue().toString(),null,type);
    env.bind(args[1],cast);
    return type.isValid(value.getLiteral().getValue().toString());
  }
}
View Full Code Here

      }
      // if the value is at odds with the datatype
      catch (Exception e) { ln = localName.getLiteral().toString(); }
      ln = URLEncoder.encode(ln,"UTF-8");
      URI uri = new URI(ns+(!ns.endsWith("#")&&!ns.endsWith("/")?"#":"")+ln);
      env.bind(args[2],Node.createURI(uri.toString()));
      return true;
    } catch (Exception e) {
      return false;
    }
  }
View Full Code Here

            // bind any capture groups
            BindingEnvironment env = context.getEnv();
            for (int i = 0; i < Math.min(length-2, m.groupCount()); i++) {
                String gm = m.group(i+1);
                Node match =  (gm != null) ? NodeFactory.createLiteral( gm ) : NodeFactory.createLiteral("");
                if ( !env.bind(args[i+2], match) ) return false;
            }
        }
        return true;
    }
   
View Full Code Here

    @Override
    public boolean bodyCall(Node[] args, int length, RuleContext context) {
        checkArgs(length, context);
        BindingEnvironment env = context.getEnv();
        Node now = NodeFactory.createLiteral( LiteralLabelFactory.create(new XSDDateTime(Calendar.getInstance())) );
        return env.bind(args[0], now);
    }
}
View Full Code Here

                ||  v2 instanceof Float || v2 instanceof Double) {
                    sum = Util.makeDoubleNode(nv1.doubleValue() / nv2.doubleValue());
                } else {
                    sum = Util.makeLongNode(nv1.longValue() / nv2.longValue());
                }
                return env.bind(args[2], sum);
            }
        }
        // Doesn't (yet) handle partially bound cases
        return false;
    }
View Full Code Here

                ||  v2 instanceof Float || v2 instanceof Double) {
                    sum = Util.makeDoubleNode(nv1.doubleValue() / nv2.doubleValue());
                } else {
                    sum = Util.makeLongNode(nv1.longValue() / nv2.longValue());
                }
                return env.bind(args[2], sum);
            }
        }
        // Doesn't (yet) handle partially bound cases
        return false;
    }
View Full Code Here

            // bind any capture groups
            BindingEnvironment env = context.getEnv();
            for (int i = 0; i < Math.min(length-2, m.groupCount()); i++) {
                String gm = m.group(i+1);
                Node match =  (gm != null) ? Node.createLiteral( gm ) : Node.createLiteral("");
                if ( !env.bind(args[i+2], match) ) return false;
            }
        }
        return true;
    }
   
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.