Package org.dbpedia2sql.model

Examples of org.dbpedia2sql.model.Triple


  public void start() throws IOException {
    countPerIndex = new int[inputs.size()];

    /* Fill the heap with one element from each input */
    for (int i = 0; i < inputs.size(); i++) {
      Triple data = inputs.get(i).nextTriple();
      if (data == null) {
        System.out.println("EOF ON " + inputs.get(i));
        continue; // One of the input is empty
      }
      heap.add(new HeapEntry(inputs.get(i), data, i));
View Full Code Here


   
    HeapEntry root = heap.remove();
//    System.out.println("TOOK FROM " + root.input + " LINE=" + countPerIndex[root.index]++ + " -> " + root.data.getSubject());
   
    /* Replace the root with a new element from the same stream */
    Triple newTriple = root.input.nextTriple();
    if (newTriple != null) {
//      System.out.println("  GOT replacement: " + newTriple.getSubject());
      heap.add(new HeapEntry(root.input, newTriple, root.index));
    } else {
      System.out.println("EOF ON " + root.input);
View Full Code Here

  public static void main(String[] args) throws Exception {
    TriplesReader tr = new TriplesReader("/home/clement/osm/dbpedia/props_en.nt.gz");

    while (true) {
      Triple t = tr.nextTriple();
      if (t == null) return;
      System.out.println(t.toString());
    }
  }
View Full Code Here

    typeHandlers.put(type, handler);
  }

  public void run(TriplesInputStream stream) throws IOException {
    while (true) {
      Triple next = stream.nextTriple();
      if (next == null) {
        if (currentSubject != null) {
          handleSubject(currentSubject, currentProps, currentLinks);
        }
        return;
      }

      String s = next.getSubject();

      // Try to url-decode the subject, errors allowed
      try {
        s = URLDecoder.decode(s, "utf8");
      } catch (IllegalArgumentException e) {

      }
      // And simplify the namespaces
      s = URISimplifier.simplify(next.getSubject());


      if (!s.equals(currentSubject)) {
        /* New subject, handle the current one before accumulate */
        if (currentSubject != null) handleSubject(currentSubject, currentProps, currentLinks);
View Full Code Here

    TypeResolver types = new TypeResolver();
   
    TriplesReader typesReader = new TriplesReader("/home/clement/osm/dbpedia-to-sql/data/types/types_fr.nt.gz");
    int i = 0;
    while (true) {
      Triple t = typesReader.nextTriple();
      if (t == null) break;
      LinkTriple lt = (LinkTriple)t;
      lt.setSubject(URISimplifier.simplify(lt.getSubject()));
      types.addTypeDeclaration((LinkTriple)t);
      if (++i % 10000 == 0) {
View Full Code Here

TOP

Related Classes of org.dbpedia2sql.model.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.