The Jena RDF API and experimental implementation.
Introduction
These packages define an API for manipulating the W3C's
Resource Description Framework.
(RDF) models and provide implementations of that API. It is assumed that
readers are already familiar with RDF. If not, then
the RDF tutorial
provides a good introduction. Also available are the two W3C
specifications,
the RDF Model and Syntax specification and also
the RDF Schema specification.
Recent Changes
- Fixed bug 22, slow N-triples reader.
- Switched type of ID's of anon resources. This is an incompatible
change, but is unavoidable with the introduction of persistent
storeage.
- Allowed insert in Seq's to append to the end of the sequence
- Added Jena interface with global constants including jena package
name, release string and CVS date string.
- Updated to faster Model compare algorithm
- Added Jeremy's PrettyWriter for RDF/XML
- Added utility applications directory with jena.rdfcopy and
jena.rdfcompare
- Added Model compare method
- Added N-TRIPLE reader and writer support
- Added reader and writer interfaces and reader/writer plug in
mechanism
- Fixed error in RDFException causing incorrect error messages
to be generated
- Fixed bug in parsing parseType="daml:collection". Now puts
daml:List as a type property on the anon nodes generated
- Added support to track when a literal is well formed XML. This
enables correct round tripping of embedded XML using parseType
Literal.
- Fixed bug in RDFLoader when URL has a fragment identifier
- Fixed bug in creating SelectorImpl with nulls of type String
and Object as the object argument.
- Added support for parsing "daml:collection" to RDFFilter.
- Integrated RDFFilter into the source tree
- Fixed bug in generating URI's from ID atttributes
- Modified Regression and build script to use path names that work
on both Microsoft and Unix platforms. The build directories
have also moved from /temp.
- Added definition of
equals
method to Literal
- Minor javadoc corrections in SelectorImpl
- Null string converted to empty string when literal created.
- Fixed handling of empty URI's in RDFLoader
- Fixed bug in ModelMem.isReified()
- Added test.bat and regression.bat to the modules/rdf directory
- Fixed ant build script and added more build automation
- Updated RenderToHTML sample application to RSS 1.0 RC1 spec.
- Fixed bug in Statement.getSeq, getAlt, getBag.
- Fixed a bug in RDF Filter
- Added RSS-P to HTML translation example.
- Added RSS to HTML translation example.
- Added Jos De Roo's reification example.
- Fixed bugs in RDFWriter when handling reified statements.
- Added
listObjectsOfProperty(Resource subject, Property predicate)
to model.
- Added
listObjects()
to model.
- Made some minor fixes to RDFFilter.
- Replaced the plethora of list and query calls with an enhanced
selector class.
- Added support for 'lang' attributes.
- Added support for XML embedded in Literal's.
- Added parser and writer methods. Integrated David Megginson's
RDF Filter for RDF parsing.
Features
The principal aim has been to provide an API which is easier to use.
The main features are:
- Resource centric methods e.g.
page.addProperty(Dc.creator, "Ora Lassila");
- Cascading method calls e.g.
model.createResource()
.addProperty(Rdf.type, Hpps.Person)
.addProperty(Hpps.name, "Ora Lassila")
.addProperty(Hpps.email, "lassila@w3.org");
- Typed Literals e.g.
page.addProperty(Hpps.rating, 0.75);
- Support for RDF containers Bag, Seq and Alt
- Support for enhanced resources. RDF containers are examples of
resources with extra behaviour. The current implementation
provides resources with extended behaviour for these containers.
The application also can define new resource classes with enhanced
behaviour. See Sample2 for an example.
for an example.
- More query options
- Multiple interoperating implementations - so a resource retrieved from a database backed
implementation can be stored in a memory based model, and vice versa.
Implementation
An experimental implementation is available under the terms of a BSD like
license. This licensing option was chosen as it was the most open
and least encumbering easily available.
The package common provides a set of common implementation classes.
These are not a complete implementation in themselves - they lack an
implementation of model. These classes are expected to be common to
several implementations of model. A specific model implementation may
use these classes as is. Alternatively, possibly to improve performance,
a model implementation may subclass the common implementation classes or
provide its own alternative implementation of them.
A prototype memory based model implementation is available in package
mem. Usage is straight forward:
Model model = new ModelMem(); // construct an empty model
model.createResource()
.addProperty(Rdf.type, Rdf.Class)
.addProperty(Rdfs.subClassOf, Rdf.Resource)
.write(new PrintWriter(System.out));
See also the example programs in the sample package.
Vocabulary classes which define standard RDF classes and properties are
defined in classes Rdf
and Rdfs
in
package vocabulary
.
Dependencies
The implementation uses David Megginson's RDF Filter on top of sax2
parser for parsing XML serializations of RDF. By default it uses
Apache Xerces XML parser, but this can be overridden by setting the
org.xml.sax.driver system property.
Known Problems
- aboutEach is not supported.
- aboutEachPrefix is not supported.
- Statements which have themselves as their own subject or object
will cause an infinite recursion. Similarly, reified statements
which form less direct loops will also suffer the same problem.
- The code for enhanced resources is immature.
- Memory management is crude and unoptimised.
Licence Terms
(c) Copyright Hewlett-Packard Company 2000, 2001
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Acknowledgements
This API is derived from
the SiRPAC API, most recently maintained by
Sergey Melnik. It borrows from the subject centric approach of
David Megginson's
DATAX API and the cascading calls style of JDom.