Package lupos.datastructures.items

Examples of lupos.datastructures.items.Variable


  public FederatedQuery(final Node federatedQuery) {
    this.federatedQuery = federatedQuery;
    final Node child0 = this.federatedQuery.jjtGetChild(0);
    if (child0 instanceof ASTVar) {
      this.endpoint = new Variable(((ASTVar) child0).getName());
    } else {
      this.endpoint = LiteralFactory.createURILiteralWithoutLazyLiteralWithoutException("<" + child0.toString() + ">");
    }
    this.variablesInServiceCall = new HashSet<Variable>();
    FederatedQuery.checkVariables(this.federatedQuery.jjtGetChild(1), this.variablesInServiceCall);
View Full Code Here


    return this.getApproachName()+"\n"+this.federatedQuery.accept(dumper);
  }

  public static void checkVariables(final Node node, final Collection<Variable> vars) {
    if (node instanceof ASTVar) {
      final Variable v = new Variable(((ASTVar) node).getName());
      vars.add(v);
    } else {
      if (node.getChildren() != null) {
        for (final Node child : node.getChildren()) {
          FederatedQuery.checkVariables(child, vars);
View Full Code Here

      final ASTSelectQuery select = (ASTSelectQuery) node;
      final Set<Variable> innerQueryVariables = new HashSet<Variable>();
      final Set<Variable> innerQueryProjectedVariables = new HashSet<Variable>();
      for(final Node innerQueryChild: select.getChildren()){
        if(innerQueryChild instanceof ASTVar){
          final Variable v = new Variable(((ASTVar) innerQueryChild).getName());
          innerQueryProjectedVariables.add(v);
        } else if(innerQueryChild instanceof ASTGroupConstraint){
          innerQueryVariables.addAll(FederatedQuery.getSurelyBoundVariables(innerQueryChild));
        }
      }
View Full Code Here

      if (i > 0) {
        msg += '\n';
      }

      for (int j = 0; j < vArray.length; j++) {
        Variable v = (Variable) vArray[j];

        // separate variables in a binding by semicolon
        if (j > 0) {
          msg += "; ";
        }
View Full Code Here

        Iterator<Variable> it = FederatedQuery.getVariablesInIntersectionOfSetOfVariablesAndBindings(variablesInServiceCall, b).iterator();
        if(it.hasNext()){
          result += "(";
          while (it.hasNext()) {
            oneOrMoreResults=true;
            Variable variable = it.next();
            result+="( ";
            if(!surelyBoundVariablesInServiceCall.contains(variable)){
              result += "(bound("+variable+") && ";             
            }
            result +=variable+"="+variable.getLiteral(b);
            if(!surelyBoundVariablesInServiceCall.contains(variable)){
              result += " ) || !bound("+variable+") ";
            }
            if(it.hasNext()){
              result+=" ) && ";
View Full Code Here

      Iterator <Variable> it = allVars.iterator();
      boolean oneOrMoreResults=false;
      if(it.hasNext()){
        result += "(";
        while (it.hasNext()) {
          Variable variable = it.next();
          if(!this.surelyBoundVariablesInServiceCall.contains(variable)){
            result += "((bound("+variable+") && ";
          }
          result +="("+this.toStringHelper.functionCallBeginning()+variable+this.toStringHelper.functionCallEnd();
          result +=" IN (";
          HashSet<String> results = new HashSet<String>();
          while (bindingsIterator.hasNext()) {
            Bindings b = bindingsIterator.next();
            Literal literal = variable.getLiteral(b);
            if(literal!=null){
              oneOrMoreResults=true;
              String hashResult = this.toStringHelper.valueConverter(literal);
              results.add(hashResult);
            }
View Full Code Here

        } else {
          while (i < node.jjtGetNumChildren()
              && node.jjtGetChild(i) instanceof ASTVar) {
            // the only difference to its method in the super class:
            // just ignore the variable if it is in the current bindings...
            final Variable var = new Variable(((ASTVar)node.jjtGetChild(i)).getName());
            if ((bindings.get(var) == null)){
              ret += this.visitChild(node, i) + " ";
            }
            i++;
          }
        }
        ret += "\n";
        while (i < node.jjtGetNumChildren()) {
          ret += this.visitChild(node, i++);
        }
        return ret;
      }
      @Override
      public String visit(final ASTVar node) {
        final Variable var = new Variable(node.getName());
        if ((bindings.get(var) != null)) {
          return bindings.get(var).toString();
        } else {
          return "?" + node.getName();
        }
View Full Code Here

      Iterator <Variable> it = allVars.iterator();
      boolean oneOrMoreResults=false;
      if(it.hasNext()){
        while (it.hasNext()) {
          result += "(";
          Variable variable = it.next();
          if(!this.surelyBoundVariablesInServiceCall.contains(variable)){
            result += "((bound("+variable+") && ";
          }
          result +="<http://www.ifis.uni-luebeck.de/functions/BitVectorFilter>("+variable;
          result +=",";
          BitVector bv = new BitVector(FederatedQueryBitVectorJoinNonStandardSPARQL.bitvectorSize);
          while (bindingsIterator.hasNext()) {
            Bindings b = bindingsIterator.next();
            Literal literal = variable.getLiteral(b);
            if(literal!=null){
              oneOrMoreResults=true;
              bv.set(Math.abs(literal.toString().hashCode() % FederatedQueryBitVectorJoinNonStandardSPARQL.bitvectorSize));
            }
          }
View Full Code Here

      if (number < 0) {
        return null;
      }
      for (int i = 0; i < number; i++) {
        final String varName = InputHelper.readLuposString(in);
        final Variable v = new Variable(varName);
        final Literal l = InputHelper.readLuposLiteral(in);
        b.add(v, l);
      }
      return (BindingsMap) b;
    }
View Full Code Here

  private final static Variable readLuposVariable(final InputStream in) throws IOException {
    final String name = readLuposString(in);
    if(name==null){
      return null;
    } else {
      return new Variable(name);
    }
  }
View Full Code Here

TOP

Related Classes of lupos.datastructures.items.Variable

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.