Package lupos.datastructures.items

Examples of lupos.datastructures.items.Triple


  public final static TripleKey readLuposTripleKey(final Triple previousTriple, final InputStream in) throws IOException, ClassNotFoundException {
    final int order = in.read();
    if (order < 0) {
      return null;
    }
    final Triple t = InputHelper.readLuposTriple(previousTriple, in);
    return new TripleKey(t, new TripleComparator((byte) order));
  }
View Full Code Here


      while (this.loop) {
        final int current = (i >= 100) ? 100 - (i % 100) : i;
        final Literal o = LiteralFactory.createTypedLiteral("\""
            + current + "\"",
            "<http://www.w3.org/2001/XMLSchema#integer>");
        final Triple triple = new Triple(s, p, o);
        stream.consume(triple);

        i = (i + 1) % 200;
      }
    } catch (final URISyntaxException e) {
View Full Code Here

  public void parse(final InputStream in, final TripleConsumer tc,
      final String encoding) throws UnsupportedEncodingException {
    try {
      this.reader = new BufferedReader(new InputStreamReader(in, encoding));
      Triple t = this.nextTriple();
      // System.out.println(t);
      // Triple last=t;
      // String lastLine=line;
      // int lastPos=pos;
      while (t != null) {
        // last=t;
        // lastLine=line;
        // lastPos=pos;
        // System.out.println(t);
        tc.consume(t);
        t = this.nextTriple();
        // if (YagoParser.maxTriples > 0
        // && counter > YagoParser.maxTriples - 1)
        // System.out.println("Last triple:" + t);
        if (t != null
            && (t.getSubject() == null || t.getPredicate() == null || t
                .getSubject() == null)) {
          log.debug("Triple:" + t);
          log.debug("Line:" + this.line + "###############pos:"
              + this.pos);
        }
View Full Code Here

    nextLiteral = this.nextLiteral();
    if (nextLiteral == null) {
      return null;
    }
    if(this.predicate != null) {
      return new Triple(this.subject, this.predicate, nextLiteral);
    }
    Literal nextLiteral2;
    nextLiteral2 = this.nextLiteral();
    if (this.subject != null) {
      this.predicate = nextLiteral;
      return new Triple(this.subject, nextLiteral, nextLiteral2);
    }
    this.subject = nextLiteral;
    this.predicate = nextLiteral2;
    Literal object;
    object = this.nextLiteral();
    return new Triple(nextLiteral, nextLiteral2, object);
  }
View Full Code Here

      } else if(qName.equalsIgnoreCase("predicate")){
        this.currentTargetType = TARGET_TYPE.predicate;
      } else if(qName.equalsIgnoreCase("object")){
        this.currentTargetType = TARGET_TYPE.object;
      } else if(qName.equalsIgnoreCase("querytriple")){
        this.currentTriple = new Triple();
      }
      // do nothing for boolean-tag, which will be handled, when the tag is closed!
    }
View Full Code Here

      for (Data d : request.getDataMap().values()) {
        logger.debug(String.format(
            "Got triple \"%s\" in key \"%s\" (%s) at peer \"%s\"",
            d.getObject(), locationKey, hash, d.getPeerId()));
        try {
          Triple t;
          if (d.getObject() instanceof TomP2P_Item)
            t = ((TomP2P_Item<Triple>) d.getObject()).getValue();
          else if (d.getObject() instanceof Triple)
            t = (Triple) d.getObject();
          else
View Full Code Here

    public HyperTriple(final Iterator<Triple> iterator) {
      for (int i = 0; i < 3; i++) {
        this.hypernodes[i] = new HyperNode();
      }
      while (iterator.hasNext()) {
        final Triple t = iterator.next();
        for (int i = 0; i < 3; i++) {
          if (!this.hypernodes[i].contains(t.getPos(i))) {
            this.hypernodes[i].add(t.getPos(i));
          }
        }
      }
      if (this.hypernodes[0].size() > 1) {
        final Variable varS = CondensedViewToolBar.this.getVariable(this.hypernodes[0]);
View Full Code Here

        // This JSONObject contains the query-triples!
        // This is no standard and a proprietary feature of LUPOSDATE!
        final JSONArray triples = oneResult.getJSONArray(var);
        for(int i=0; i<triples.length(); i++){
          final JSONObject jsonTriple = triples.getJSONObject(i);
          luposResult.addTriple(new Triple(getLiteral(jsonTriple.getJSONObject("subject")), getLiteral(jsonTriple.getJSONObject("predicate")), getLiteral(jsonTriple.getJSONObject("object"))));
        }
      }
    }
    return luposResult;
  }
View Full Code Here

    final Literal predicate = ((diff / 2) % 2 == 1) ? InputHelper.readLuposLiteral(is) : previousTriple.getPredicate();
    final Literal object = ((diff / 4) % 2 == 1) ? InputHelper.readLuposLiteral(is) : previousTriple.getObject();
    if (subject == null || predicate == null || object == null) {
      return null;
    }
    return new Triple(subject, predicate, object);
  }
View Full Code Here

    }
    return new Triple(subject, predicate, object);
  }

  public final static Triple readLuposTriple(final InputStream is) throws ClassNotFoundException, IOException {
    return new Triple(InputHelper.readLuposLiteral(is), InputHelper.readLuposLiteral(is), InputHelper.readLuposLiteral(is));
  }
View Full Code Here

TOP

Related Classes of lupos.datastructures.items.Triple

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.