Package lupos.datastructures.items

Examples of lupos.datastructures.items.Variable


        int i = 0;

        // result order is defined...
        if (resultOrder != null && resultOrder.size() > 0) {
          for (final String s : resultOrder) {
            if (variables.contains(new Variable(s))) {
              tableHead[i++] = "?" + s;
            }
          }
        } else {
          // result order is not defined...
          for (final Variable v : variables) {
            tableHead[i++] = v.toString();
          }
        }
        // --- generate table head - end ---

        // --- generate table rows - begin ---
        final Object[][] rows = new Object[qr.size()][];

        i = 0;

        for (final Bindings ba : qr) {
          final Object[] row = new Object[variables.size()];

          int j = 0;

          // result order is defined...
          if (resultOrder != null && resultOrder.size() > 0) {
            for (final String s : resultOrder) {
              if (variables.contains(new Variable(s))) {
                final Literal literal = ba.get(new Variable(s));
                String value = "";

                if (literal != null) {
                  value = literal.toString(prefixInstance);
                }
View Full Code Here


*/
public class RuleVariable extends AbstractRuleNode implements IExpression {
  private Variable internalVariable;

  public RuleVariable(String name) {
    internalVariable = new Variable(name);
  }
View Full Code Here

  public Variable getVariable() {
    return internalVariable;
  }

  public void setVariable(String name) {
    internalVariable = new Variable(name);
  }
View Full Code Here

      // checked in
      // checkPrecondition
      // Already checked in checkPrecondition: All variables in tp can be
      // replaced!
      for (final Variable v : tp.getVariables()) {
        final Variable rv = repVar.getReplacement(v);
        tp.replace(v, rv);
      }
      final List<OperatorIDTuple> list = new LinkedList<OperatorIDTuple>();
      list.addAll(repVar.getSucceedingOperators());
      tp.setSucceedingOperators(list);
View Full Code Here

          right = tmp;
        }
        if (left instanceof lupos.sparql1_1.ASTVar) {
          final String varname = ((lupos.sparql1_1.ASTVar) left)
              .getName();
          var = new Variable(varname);
          varInference = new VariableInInferenceRule(varname);

          if (right instanceof lupos.sparql1_1.ASTQName
              || right instanceof lupos.sparql1_1.ASTQuotedURIRef
              || right instanceof lupos.sparql1_1.ASTFloatingPoint
View Full Code Here

        final JSONArray array = new JSONObject(jsonResult).getJSONArray("result");
        for(int i=0; i<array.length(); i++){
          final JSONObject entry = array.getJSONObject(i);

          final Variable var = Helper.createVariableFromJSON(entry.getJSONObject("variable"));
          Literal min = Helper.createLiteralFromJSON(entry.getJSONObject("minimum"));
          Literal max = Helper.createLiteralFromJSON(entry.getJSONObject("maximum"));

          // compare new min/max with possibly existing ones...
View Full Code Here

          // the first histogram is just taken over
          result = map;
        } else {
          // look, which histogram is based on more elements and just choose this one
          for(final Entry<Variable, VarBucket> entry: map.entrySet()){
            final Variable var = entry.getKey();
            final VarBucket histogram = result.get(var);
            final VarBucket otherHistogram = entry.getValue();
            if(histogram == null || otherHistogram.getSum()>histogram.getSum()) {
              result.put(var, otherHistogram);
            }
View Full Code Here

    for (final Bindings oldBinding : oldBindings) {
      Literal literal = null;

      // process all items
      for (int i = 0; i < substitutionsLiteralLeft.size(); i++) {
        final Variable itemName = substitutionsLiteralLeft.get(i);
        // oldBinding.add(itemName, substitutionsLiteralRight.get(i));

        // if the item is an unbound variable
        if ((literal = oldBinding.get(itemName)) == null) {
          oldBinding.add(itemName, substitutionsLiteralRight.get(i));
View Full Code Here

        .toArray();
    final LinkedList<Variable> replaceLitLeft = replaceLit
        .getSubstitutionsLiteralLeft();
    final LinkedList<Literal> replaceLitRight = replaceLit
        .getSubstitutionsLiteralRight();
    Variable var;
    Literal lit;
    // Delete all not projected Tupels from ReplaceLit
    for (int i = 0; i < replaceLitLeft.size(); i++) {
      var = replaceLitLeft.get(i);
      if (!arrayContains(projectionVars, var)) {
View Full Code Here

          right = tmp;
        }
        if (left instanceof lupos.sparql1_1.ASTVar) {
          final String varname = ((lupos.sparql1_1.ASTVar) left)
          .getName();
          var = new Variable(varname);
          varInference = new VariableInInferenceRule(varname);

          if (!triplePattern.getVariables().contains(var)
              && !triplePattern.getVariables().contains(
                  varInference)) {
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.