Package lupos.datastructures.items

Examples of lupos.datastructures.items.Item


    @Override
    protected void addPrecedingSuggestion(
        final SuggestionPanel subjectPanel,
        final SuggestionPanel predicatePanel) {
      // get items...
      final Item subjectItem = subjectPanel.getSelectedElement();
      final Item predicateItem = predicatePanel.getSelectedElement();

      final String oldquery = getCurrentBrowserQuery();
      statusBar.setText("set refined query...");
      updateAll(oldquery.substring(0, oldquery.length() - 1)
          + subjectItem + " " + predicateItem + " " + this.op + ".}");
View Full Code Here


    @Override
    protected void addSucceedingSuggestion(
        final SuggestionPanel predicatePanel,
        final SuggestionPanel objectPanel) {
      // get items...
      final Item predicateItem = predicatePanel.getSelectedElement();
      final Item objectItem = objectPanel.getSelectedElement();

      final String oldquery = getCurrentBrowserQuery();
      statusBar.setText("set refined query...");
      updateAll(oldquery.substring(0, oldquery.length() - 1) + this.op
          + " " + predicateItem + " " + objectItem + ".}");
View Full Code Here

      binding.add(var.getVariable(), assignValue);
      return BooleanLiteral.TRUE;
    } else {
      // fester wert auf jeder seite, also erst aussage mit gebundenen
      // variable auswerten und anderem als result mitgeben.
      Item left = null;
      Item right = null;
      if (rightHasUnbound) {
        left = (Item) leftExpr.evaluate(binding);
        right = (Item) rightExpr.evaluate(binding, left);
      } else if (leftHasUnbound) {
        right = (Item) rightExpr.evaluate(binding);
View Full Code Here

        && arg.arguments.get(1) instanceof TypedLiteral
        && arg.arguments.get(2) instanceof Item) {
      final RuleList list = (RuleList) arg.arguments.get(0);
      int index = BuiltinHelper.getInteger((TypedLiteral) arg.arguments
          .get(1));
      final Item item = arg.arguments.get(2);
      if (index < 0)
        index += list.getItems().size();
      if (index < 0 || index >= list.getItems().size())
        return null;
      List<IExpression> original = new ArrayList<IExpression>(
          list.getItems());
      list.getItems().clear();
      for (int i = 0; i < original.size(); i++) {
        final IExpression expr = original.get(i);
        if (i == index) {
          if (item instanceof Variable)
            list.addItem(new RuleVariable(item.getName()));
          else if (item instanceof Literal)
            list.addItem(new Constant((Literal) item, list));
          else if (item instanceof IExpression)
            list.addItem((IExpression) item);
        }
View Full Code Here

  public static RuleList index_of(final Argument arg) {
    if (arg.arguments.size() == 2
        && arg.arguments.get(0) instanceof RuleList
        && arg.arguments.get(1) instanceof Item) {
      final RuleList list = (RuleList) arg.arguments.get(0);
      final Item item = arg.arguments.get(1);
      IExpression lookingFor = null;
      if (item instanceof Variable)
        lookingFor = new RuleVariable(item.getName());
      else if (item instanceof Literal)
        lookingFor = new Constant((Literal) item, list);
      else if (item instanceof IExpression)
        lookingFor = (IExpression) item;
      final RuleList results = new RuleList();
View Full Code Here

        final Collection<Variable> varsOfTP = tp.getUnionVariables();
        this.intersectionVariables.addAll(varsOfTP);
        this.unionVariables.addAll(varsOfTP);
      }
    }
    final Item rdfGraphLocal = this.getGraphConstraint();
    if (rdfGraphLocal != null && rdfGraphLocal.isVariable()) {
      this.intersectionVariables.add((Variable) rdfGraphLocal);
      this.unionVariables.add((Variable) rdfGraphLocal);
    }
  }
View Full Code Here

      QueryResult queryResult = null;

      // get the graph constraint from the super class.
      // If it is null, a default graph is used, if not null a named one
      // is used
      final Item graphConstraintItem = this.getGraphConstraint();

      // get a collection of indices using the determined graph constraint
      final Collection<Indices> indicesC = dataset.indexingRDFGraphs(
          graphConstraintItem, false, false, this.root);
      if ((indicesC != null) && !(indicesC.size() == 0)) {
View Full Code Here

    for (final BasicOperator bo : path) {
      if (bo instanceof Generate) {
        triple = new Item[3];
        final Generate generate = (Generate) bo;
        for (int i = 0; i < 3; i++) {
          Item item = generate.getValueOrVariable()[i];
          if (item.isVariable()) {
            if (bindings.get(item) != null) {
              item = bindings.get(item);
            }
          }
          triple[i] = item;
        }
        // is a constant triple generated?
        if (!triple[0].isVariable() && !triple[1].isVariable()
            && !triple[2].isVariable()) {
          disconnect.add(path.get(1));
          final Generate generateInstead = new Generate(triple);
          final LinkedList<OperatorIDTuple> llo = new LinkedList<OperatorIDTuple>();
          llo.addAll(bo.getSucceedingOperators());
          // delete path from the successors:
          final int index = path.indexOf(new OperatorIDTuple(bo, -1));
          final BasicOperator afterInPath = (index == path.size() - 1) ? path
              .get(0)
              : path.get(index + 1);
          llo.remove(new OperatorIDTuple(afterInPath, -1));
          generateInstead.setSucceedingOperators(llo);
          instead.add(generateInstead);
          return true;
        }
      }
      if (bo instanceof TriplePattern) {
        bindings = new HashMap<Variable, Item>();
        final Item[] items = ((TriplePattern) bo).getItems();
        int i = 0;
        for (final Item item : items) {
          if (item.isVariable()) {
            bindings.put((Variable) item, triple[i]);
          } else {
            if (!((Literal) item).equals(triple[i])) {
              if (!triple[i].isVariable()) {
                System.out
                    .println("RuleEliminateInfinityLoop: The generated triple will not be consumed by the succeeding triple pattern!");
                return false;
              }
            }
          }
          i++;
        }
      }
    }
    // is again the same triple generated as by the first call of the first
    // generate?
    if (path.get(0) instanceof Generate) {
      triple = new Item[3];
      final Generate generate = (Generate) path.get(0);
      for (int i = 0; i < 3; i++) {
        Item item = generate.getValueOrVariable()[i];
        if (item.isVariable()) {
          if (bindings.get(item) != null) {
            item = bindings.get(item);
          }
        }
        triple[i] = item;
View Full Code Here

        Collection<TriplePattern> tps = BasicIndexScanOptional.this.indexScanOperator.getTriplePattern();
        LinkedList<TriplePattern> tps_new = new LinkedList<TriplePattern>();
        for(TriplePattern tp: tps){
          Item[] items = new Item[3];
          for(int i=0; i<3; i++){
            Item currentItem = tp.getPos(i);
            if(currentItem.isVariable()){
              Literal result = currentBindings.get((Variable)currentItem);
              if(result!=null){
                items[i] = result;
              } else {
                items[i] = currentItem;
View Full Code Here

    try {

      // get the graph constraint from the super class.
      // If it is null, a default graph is used, if not null a named one
      // is used
      final Item graphConstraintItem = this.getGraphConstraint();

      // get a collection of indices using the determined graph constraint
      final Collection<Indices> indicesC = dataset.indexingRDFGraphs(
          graphConstraintItem, false, false, this.root);
      if ((indicesC != null) && !(indicesC.size() == 0)) {
View Full Code Here

TOP

Related Classes of lupos.datastructures.items.Item

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.