Previous Topic

Next Topic

Built-in Visitor Pattern

JRDF nodes are implemented with a visitor pattern to provide an object oriented approach to node-type specific behaviour. Nodes implement the TypedNodeVisitable interface and classes that use the pattern implement the TypedNodeVisitor interface.

In This Section

TypedNodeVisitable

TypedNodeVisitor

See Also

Java RDF (JRDF)

JRDF APIs

JRDF Graphs

Querying a JRDF Graph

TKS Client Support

JRDF Memory Implementation

Containers and Collections

Examples

TypedNodeVisitable

Nodes implement the accept(TypedNodeVisitor visitor) method to call visitor.visitXXX(this), where XXX represents the node type. For example, visitBlankNode(this) is called by a BlankNode.

TypedNodeVisitor

TypedNodeVisitors implement three methods:

  1. visitBlankNode(BlankNode blankNode)
  2. visitLiteral(Literal literal)
  3. visitURIReference(URIReference uriReference)

When a TypedNodeVisitor calls accept(this) on a TypedNodeVisitable(Node), the TypedNodeVisitable calls the appropriate visitXXX() method, where XXX represents the Node type. The method names contain the node type to provide clarity for classes implementing the TypeNodeVisitor interface.

Open Source logo

© 2001-2004 Tucana Technologies, Inc. Some rights reserved.

© 2006 The Mulgara Project. Some rights reserved.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".