Package lupos.datastructures.items.literal

Examples of lupos.datastructures.items.literal.Literal


    for (final Bindings oldBinding : oldBindings) {
      // Triple triple = getTriple();

      final Bindings bindings = this.bindingsFactory.createInstance();
      Literal literal = null;

      for (int i = 0; i < this.filterLeft.size(); i++) {
        // its value has to be equal to the corresponding value of
        // the triple pattern
        if (!this.filterLeft.get(i).getLiteral(null).valueEquals(
            oldBinding.get(this.filterRight.get(i)))) {
          return null;
        }
      }

      // process all items
      // for(int i = 0; i < 3; i++){
      for (int i = 0; i < this.substitutionsLiteralLeft.size(); i++) {
        // if the item is an unbound variable
        final Variable item = this.substitutionsLiteralLeft.get(i);
        if ((literal = bindings.get(item)) == null) {
          bindings.add(item, this.substitutionsLiteralRight.get(i));
        }
        // if the item is a variable which is already bound
        // and the value differs from the value of the triple
        // which would be used as binding, a conflict was
        // detected
        else if (!literal.valueEquals(this.substitutionsLiteralRight.get(i))) {
          return null; // join within triple pattern!
        }
      }

      for (int i = 0; i < this.substitutionsVariableLeft.size(); i++) {
        // if the item is an unbound variable
        final Variable item = this.substitutionsVariableLeft.get(i);
        if ((literal = bindings.get(item)) == null) {
          bindings.add(item, oldBinding
              .get(this.substitutionsVariableRight.get(i)));
        }
        // if the item is a variable which is already bound
        // and the value differs from the value of the triple
        // which would be used as binding, a conflict was
        // detected
        else if (!literal.valueEquals(oldBinding
            .get(this.substitutionsVariableRight.get(i)))) {
          return null; // join within triple pattern!
        }
      }
View Full Code Here


  }

  @Override
  public int compare(Bindings o1, Bindings o2) {
    for(Variable v: vars){
      final Literal l0 = o1.get(v);
      final Literal l1 = o2.get(v);
      final int ret = ComparatorAST.intComp(l0, l1);
      if (ret != 0)
        return ret;
    }
    return 0;
View Full Code Here

      } catch (final NotBoundException e) {
        o1 = null;
      } catch (final TypeErrorException e) {
        o1 = null;
      }
      final Literal l0 = getLiteral(o0);
      final Literal l1 = getLiteral(o1);
      final int ret = intComp(l0, l1);
      if (ret != 0)
        return ret * mod;
    }
    return 0;
View Full Code Here

      public Bindings next() {
        if (!this.itb.hasNext()) {
          return null;
        }
        final Bindings oldBinding = this.itb.next();
        final Literal literal = oldBinding.get(AddBindingFromOtherVar.this.var);
        if (literal == null) {
          oldBinding.add(AddBindingFromOtherVar.this.var, oldBinding.get(AddBindingFromOtherVar.this.valueFromVar));
        }
        // if the item is a variable which is already bound
        // and the value differs from the value of the triple
        // which would be used as binding, a conflict was
        // detected
        else if (!literal.valueEquals(oldBinding.get(AddBindingFromOtherVar.this.valueFromVar))) {
          System.out
              .println("AddBindingFromOtherVar: Error: Variable "
                  + AddBindingFromOtherVar.this.var + " was already bound!");
          return null;
        }
View Full Code Here

    for (final Bindings oldBinding : oldBindings) {
      // Triple triple = getTriple();

      // final Bindings bindings = Bindings.createNewInstance();
      Literal literal = null;

      for (int i = 0; i < filterLeft.size(); i++) {
        // its value has to be equal to the corresponding value of
        // the triple pattern
        if (!filterLeft.get(i).getLiteral(null).valueEquals(
            oldBinding.get(filterRight.get(i)))) {
          return null;
        }
      }

      for (int i = 0; i < substitutionsVariableLeft.size(); i++) {
        // if the item is an unbound variable
        final Variable itemName = substitutionsVariableLeft.get(i);
        if ((literal = oldBinding.get(itemName)) == null) {
          oldBinding.add(itemName, oldBinding
              .get(substitutionsVariableRight.get(i)));
        }
        // if the item is a variable which is already bound
        // and the value differs from the value of the triple
        // which would be used as binding, a conflict was
        // detected
        else if (!literal.valueEquals(oldBinding
            .get(substitutionsVariableRight.get(i)))) {
          return null; // join within triple pattern!
        }
      }
View Full Code Here

    final HashMap<Resource, Integer> blanknodeNames = new HashMap<Resource, Integer>();
    int number=0;
    while (sit.hasNext()) {
      final Statement s = sit.next();

      Literal subject, predicate, object;

      subject = printResource2Literal(s.getSubject(), blanknodeNames, id);

      predicate = printResource2Literal(s.getPredicate(), blanknodeNames, id);
View Full Code Here

        public static Literal getLiteral(Node n) {
          return getLiteral(n, false);
        }

        public static Literal getLiteral(Node n, final boolean allowLazyLiteral) {
                Literal literal = null;

                if (n instanceof ASTNIL) {
                        try {
                                literal = (allowLazyLiteral) ? LiteralFactory
                                                .createURILiteral("<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>")
View Full Code Here

      final Bindings binding = itbindings.next();
      String keyJoin = "";
      final Iterator<Variable> it = this.intersectionVariables.iterator();
      while (it.hasNext()) {
        final Literal literal = binding.get(it.next());
        if (literal == null) {
          boolean added = this.cartesianProduct[operandID].add(binding);
          if(added || !isDuplicateEliminationEnabled()){
            // build the cartesian product
            for (final Bindings b2 : this.cartesianProduct[otherOperand]) {
              joinBindings(result, binding.clone(), b2);
            }
 
            for (final QueryResult qr : this.lba[otherOperand].values()) {
              for (final Bindings b2 : qr) {
                joinBindings(result, binding.clone(), b2);
              }
            }
          }

          keyJoin = null;
          break;
        }
        keyJoin += "|" + literal.getKey();
      }

      if (keyJoin == null)
        continue;
View Full Code Here

    while (itbindings.hasNext()) {
      final Bindings binding = itbindings.next();
      String keyJoin = "";
      final Iterator<Variable> it = this.intersectionVariables.iterator();
      while (it.hasNext()) {
        final Literal literal = binding.get(it.next());
        if (literal == null) {
          boolean added = this.cartesianProduct[operandID].add(binding);
          if(added || !isDuplicateEliminationEnabled()){
            // build the cartesian product
            for (final Bindings b2 : this.cartesianProduct[otherOperand]) {
              if(joinBindings(result, binding.clone(), b2)){
                if (operandID == 1) {
                  joinPartnerFromLeftOperand.add(b2);
                } else {
                  joinPartnerFromLeftOperand.add(binding);
                }             
              }
            }
 
            for (final QueryResult qr : this.lba[otherOperand].values()) {
              for (final Bindings b2 : qr) {
                if(joinBindings(result, binding.clone(), b2)){
                  if (operandID == 1) {
                    joinPartnerFromLeftOperand.add(b2);
                  } else {
                    joinPartnerFromLeftOperand.add(binding);
                  }               
                }
              }
            }
          }

          keyJoin = null;
          break;
        }
        keyJoin += "|" + literal.getKey();
      }

      if (keyJoin == null)
        continue;
     
View Full Code Here

      final Bindings binding = itbindings.next();
      String keyJoin = "";
      final Iterator<Variable> it = this.intersectionVariables.iterator();
      while (it.hasNext()) {
        final Literal literal = binding.get(it.next());
        if (literal == null) {
          boolean removed = this.cartesianProduct[operandID].remove(binding);
          if(removed || !isDuplicateEliminationEnabled()){
            // build the cartesian product
            for (final Bindings b2 : this.cartesianProduct[otherOperand]) {
              joinBindings(result, binding.clone(), b2);
            }
 
            for (final QueryResult qr : this.lba[otherOperand].values()) {
              for (final Bindings b2 : qr) {
                joinBindings(result, binding.clone(), b2);
              }
            }
          }

          keyJoin = null;
          break;
        }
        keyJoin += "|" + literal.getKey();
      }

      if (keyJoin == null)
        continue;
View Full Code Here

TOP

Related Classes of lupos.datastructures.items.literal.Literal

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.