Package lupos.rif.datatypes

Examples of lupos.rif.datatypes.Predicate


          ((Constant) this.termParams.get(1)).getLiteral():
          (Literal)((External) this.termParams.get(1)).evaluate(new BindingsMap());

      return new Triple(subject, predicate, object);
    } else {
      final Predicate pred = new Predicate();
      pred.setName(((Constant) this.termName).getLiteral());
      for (final IExpression expr : this.termParams) {
        pred.getParameters().add(  (expr instanceof Constant)?
                      ((Constant) expr).getLiteral():
                      (Literal)((External) expr).evaluate(new BindingsMap()));
      }
      return pred;
    }
View Full Code Here


    PredicateIndexScan conclusionIndex = null;
    if (obj.getConclusion() instanceof RulePredicate) {
      final RulePredicate predicate = (RulePredicate) obj.getConclusion();
      conclusionIndex = new PredicateIndexScan();
      root.addSucceedingOperator(conclusionIndex);
      Predicate toAdd = null;
      if (predicate.isTriple()) {
        final Triple triple = (Triple) predicate.toDataStructure();
        toAdd = new Predicate();
        toAdd.setName(triple.getPredicate());
        toAdd.getParameters().addAll(
            Arrays.asList(triple.getSubject(), triple.getObject()));
      } else
        toAdd = (Predicate) predicate.toDataStructure();
      conclusionIndex.addPredicateFact(toAdd);
    }
View Full Code Here

    // Create predicate
    while (pib.hasNext()) {
      final Bindings bind = pib.next();
      result.add(bind);
      for (final Tuple<URILiteral, List<Item>> item : this.patternList) {
        final Predicate pred = new Predicate();
        pred.setName(item.getFirst());
        for (int idx = 0; idx < item.getSecond().size(); idx++)
          if (item.getSecond().get(idx).isVariable())
            pred.getParameters().add(
                bind.get((Variable) item.getSecond().get(idx)));
          else
            pred.getParameters().add(
                (Literal) item.getSecond().get(idx));
        result.getPredicateResults().add(pred);
      }
    }
    if (pib instanceof ParallelIterator)
View Full Code Here

        .getOriginalQueryResult() : queryResult);
    // Pattern auf alle Praedikate anwenden
    final Iterator<Predicate> predicateIterator = input
        .getPredicateIterator();
    while (predicateIterator.hasNext()) {
      final Predicate pred = predicateIterator.next();
      // Nur Praedikate, in dem die Anzahl der Parameter uebereinstimmt
      // ueberhaut betrachten
      if (pred.getParameters().size() == this.patternArgs.size()
          && pred.getName().equals(this.patternName)) {
        final Bindings bind = this.bindingsFactory.createInstance();
        boolean matched = true;
        for (int idx = 0; idx < pred.getParameters().size(); idx++) {
          if (this.patternArgs.get(idx).isVariable()) {
            bind.add((Variable) this.patternArgs.get(idx), pred
                .getParameters().get(idx));
          } else if (!this.patternArgs.get(idx).equals(
              pred.getParameters().get(idx))) {
            matched = false;
            break;
          }
        }
        if (matched) {
View Full Code Here

TOP

Related Classes of lupos.rif.datatypes.Predicate

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.