com.hp.hpl.jena.n3

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.n3 
com.hp.hpl.jena.n3

Jena N3 Parser, RDF Reader and Writer

This package contains

  • an N3 parser
  • a Jena reader, for reading the RDF subset of N3 into a Model
  • a Jena writer for outputting RDF in an N3 syntax.

The N3 writer is aimed at producing readable N3 and analysies the model before writing.  It may unsuitable for some forms of very large model.

This package does not contains a rules engine to interprete or execute N3 formulae.  It is not a replacement for cwm; this system aims to provide daat input fo RDF in N3 format.

The Parser

The N3 parser provided parses the whole of the N3 language.  It is a streaming parser that emits parser events (see the class N3ParserEventHandler) when a new triple is encountered.

It is a permissive parser, it does not aim to validate an N3 and mioght even parse some constructs which are not valid (examples include named formulae and named DAML lists;  the generated parser events do not expressive the named objects).  It does not check the characters comprising URIs and is more permissive on qnames that strict defintion would require.

The parser is built using antlr. The grammar file is "n3.g".  An application will need access to the antlr runtime classes which are provided in antlr.jar in the Jena lib/ directory.

There is a simple application in jena.n3 that accesses the N3 parser directly or via the RDF generator for file conversion or for simple file checking.

The RDF generator

The RDF generator takes a stream of parser events and turns them into additions to a Jena model.  The Jena reader is then a class that wraps up this functionality to conform to the Jena reader interface.  The RDF generator does not allow formulae and will cause an error if one is encountered.

Performance

The parser alone runs at about 18K triples/second on Pentium4 750Mhz PC (it is I/O bound in the lexer).  When generating RDF, the rate is about 9K statements/second.

Notes

N3 files are UTF-8: not raw bytes or ISO-8859-1.  Applications should pass UTF-8 character set readers and writers to the appropriate Jena operations model.read and model.write.  Often, this does not make a difference but can cause silent loss or change of character information.

Other Information on N3

Acknowledgements

The grammar was not written from scratch.  The grammar is based on cwm, Dan Connerly's python grammar and Graham Klyne's N3Parser as well as "Notation3 : A Rough Guide" which lists other parsers.

Java Source File NameTypeComment
AntlrUtils.javaClass
ChainedN3EventHandler.javaClass Support for chaining handlers.
IndentedWriter.javaClass Simple class that provides output with moving left margin.
IRIResolver.javaClass
JenaReaderBase.javaClass
JenaURIException.javaClass
N3AntlrLexer.javaClass
N3AntlrParser.javaClass
N3AntlrParserTokenTypes.javaInterface
N3ErrorPrinter.javaClass
N3EventPrinter.javaClass
N3Exception.javaClass
N3JenaReader.javaClass
N3JenaWriter.javaClass Entry point for N3 writers.
N3JenaWriterCommon.javaClass Common framework for implementing N3 writers.
N3JenaWriterPlain.javaClass An simple N3 writer - writes N3 out as records, one per subject in the graph.
N3JenaWriterPP.javaClass An N3 pretty printer.
N3JenaWriterTriples.javaClass A simple N3 writer - writes N3 out as triples with prefixes done. "N3 triples" - triples with N3 abbreviations and prefixes. Very simple.
N3Parser.javaClass The formal interface to the N3 parser.
N3ParserEventHandler.javaInterface
N3toRDF.javaClass
N3TurtleJenaWriter.javaClass Turtle writer.
NullN3EventHandler.javaClass A basic (do nothing) implementation of N3ParserEventHandler.
RelativeURIException.javaClass
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.