Package lupos.datastructures.items.literal

Examples of lupos.datastructures.items.literal.Literal


  public Bindings process(final Triple triple, final boolean failOnBlank,
      final int id) {

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

    // process all items of this triple pattern
    for (int i = 0; i < 3; i++) {

      if (this.bloomFilters != null) {
        if (this.bloomFilters[i] != null) {
          if (!this.bloomFilters[i]
                            .get((Math.abs(triple.getPos(i).hashCode()) % SIPFilterOperator.NUMBEROFBITSFORBLOOMFILTER))) {
            return null;
          }
        }
      }

      // if the triple's node at the current position is a blank
      // one which is not allowed due to the current configuration
      // return null to indicate this problem
      if (failOnBlank && triple.getPos(i).isBlank()) {
        return null;
      }

      // if the item is a variable
      if (this.items[i].isVariable()) {

        // if the item is an unbound variable
        final Variable item = triple.getVariable((Variable) this.items[i]);
        if ((literal = bindings.get(item)) == null) {
          bindings.add(item, triple.getPos(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(triple.getPos(i))) {
          return null; // join within triple pattern!
        }
      }

      // if the item is no variable ...
View Full Code Here


  public MergeUnion(final Collection<Variable> sortCriterium) {
    super(new Comparator<Bindings>() {
      @Override
      public int compare(final Bindings o1, final Bindings o2) {
        for (final Variable var : sortCriterium) {
          final Literal l1 = o1.get(var);
          final Literal l2 = o2.get(var);
          if (l1 != null && l2 != null) {
            final int compare = l1
                .compareToNotNecessarilySPARQLSpecificationConform(l2);
            if (compare != 0) {
              return compare;
View Full Code Here

      final Collection<Iterator<Bindings>> operandResults,
      final Collection<Variable> toCompare) {
    this(operandResults, new Comparator<Bindings>() {
      public int compare(final Bindings o1, final Bindings o2) {
        for (final Variable var : toCompare) {
          final Literal l1 = o1.get(var);
          final Literal l2 = o2.get(var);
          if (l1 != null && l2 != null) {
            final int compare = l1
                .compareToNotNecessarilySPARQLSpecificationConform(l2);
            if (compare != 0)
              return compare;
View Full Code Here

  public MergeUnionIterator(final QueryResult[] operandResults,
      final boolean moreThanOnce, final Collection<Variable> toCompare) {
    this(operandResults, moreThanOnce, new Comparator<Bindings>() {
      public int compare(final Bindings o1, final Bindings o2) {
        for (final Variable var : toCompare) {
          final Literal l1 = o1.get(var);
          final Literal l2 = o2.get(var);
          if (l1 != null && l2 != null) {
            final int compare = l1
                .compareToNotNecessarilySPARQLSpecificationConform(l2);
            if (compare != 0)
              return compare;
View Full Code Here

  public MergeUnionIterator(final List<QueryResult> operandResults,
      final boolean moreThanOnce, final Collection<Variable> toCompare) {
    this(operandResults, moreThanOnce, new Comparator<Bindings>() {
      public int compare(final Bindings o1, final Bindings o2) {
        for (final Variable var : toCompare) {
          final Literal l1 = o1.get(var);
          final Literal l2 = o2.get(var);
          if (l1 != null && l2 != null) {
            final int compare = l1
                .compareToNotNecessarilySPARQLSpecificationConform(l2);
            if (compare != 0)
              return compare;
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

            if (potentialNewBindings != null){
              final SetImplementation<Literal> updatedMapEntry= new SetImplementation<Literal>(reachabilityMap.get(closureElement.get(this.subject)));
              final Iterator<Literal> itobject = potentialNewBindings.iterator();
              while(itobject.hasNext()){
                final Literal tempObject = itobject.next();
                final Bindings newBind = new BindingsCollection();
                newBind.add(this.subject, closureElement.get(this.subject));
                newBind.add(this.object, tempObject);
                if(closure.add(newBind)){
                  thisIteration.add(newBind);
View Full Code Here

            Set<Literal> potentialNewBindings = reachabilityMap.get(closureElement.get(this.subject));
            if (potentialNewBindings != null){
              final SetImplementation<Literal> updatedMapEntry= new SetImplementation<Literal>(reachabilityMap.get(closureElement.get(this.object)));
              final Iterator<Literal> itsubject = potentialNewBindings.iterator();
              while(itsubject.hasNext()){
                final Literal tempSubject = itsubject.next();
                final Bindings newBind = new BindingsCollection();
                newBind.add(this.subject, tempSubject);
                newBind.add(this.object, closureElement.get(this.object));
                if (closure.add(newBind)){
                  thisIteration.add(newBind);
View Full Code Here

        if(firstTime){
          firstTime = false;
        } else {
          query += " ";
        }
        final Literal literal = bindings.get(var);
        if(literal==null){
          query += "UNDEF";
        } else {
          query += literal.toString();
        }
      }
      query+=")";
    }
View Full Code Here

          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

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.