NxParser - Parser for NTriples, NQuads, and more

Main Author: Aidan Hogan Contributions: Andreas Harth

Here you can find the Java source for a parser of file in Nx format, where x = Triples, Quads, or any other number.

Download

The NxParser subversion repository is available. Current version (V1.1) of the JAR (Version 1.0 of the JAR.

Usage

The NxParser object implements the Iterator interface and returns an array of Node (which can be either Resource, BNode, or Literal).

  NxParser nxp = new NxParser(new FileInputStream("filetoparse.nq"),false);
		
  while (nxp.hasNext()) {
    Node[] ns = nxp.next();
			
    for (Node n: ns) {
      System.out.print(n.toN3());
      System.out.print(" ");
    }
    System.out.println(".");
  }

References

NQuads post from Sean Palmer, 2001.

Draft specification of the NQuads/Nx format

This project is released under the BSD license (file: license.txt).


$Id: index.html 19771 2010-04-16 09:45:39Z juergen $