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 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


$Id: index.html 12586 2008-02-12 19:22:27Z aharth $