com.hp.hpl.jena.rdf.model
Interface RDFNode

All Known Subinterfaces:
AllDifferent, AllValuesFromRestriction, Alt, AnnotationProperty, Bag, BooleanClassDescription, CardinalityRestriction, ComplementClass, Container, DatatypeProperty, EnumeratedClass, FunctionalProperty, HasValueRestriction, Individual, IntersectionClass, InverseFunctionalProperty, Literal, MaxCardinalityRestriction, MinCardinalityRestriction, ObjectProperty, OntClass, Ontology, OntProperty, OntResource, Property, RDFList, ReifiedStatement, Resource, Restriction, Seq, SomeValuesFromRestriction, SymmetricProperty, TransitiveProperty, UnionClass

public interface RDFNode

An RDF Resource or an RDF Literal.

RDFNode represents the methods which RDF Resources and RDF Literals have in common.

Chris added the _as_ method to allow RDFNodes to participate in polymorphic conversions.

Version:
Release='$Name: $' Revision='$Revision: 1.5 $' Date='$Date: 2003/05/20 10:09:16 $'
Author:
bwm

Method Summary
 RDFNode as(java.lang.Class view)
          RDFNodes can be converted to different implementation types.
 Node asNode()
          a presentation-layer RDFNode is build on top of an SPI-layer Node; get it.
 boolean canAs(java.lang.Class view)
          return true iff this RDFNode can be viewed as a _view_.
 RDFNode inModel(Model m)
          returns a .equals() version of this node, except that its in the model m.
 java.lang.String toString()
          Return a String representation of the node.
 java.lang.Object visitWith(RDFVisitor rv)
          Apply the appropriate method of the visitor to this node's content and return the result.
 

Method Detail

toString

public java.lang.String toString()
Return a String representation of the node. The form of the string depends on the type of the node.

Returns:
a String representation of this object.

asNode

public Node asNode()
a presentation-layer RDFNode is build on top of an SPI-layer Node; get it.


as

public RDFNode as(java.lang.Class view)
RDFNodes can be converted to different implementation types. Convert this RDFNode to a type supporting the _view_ interface. The resulting RDFNode should be an instance of _view_ and should have any internal invariants specified.

It is not clear what should happen if this RDFNode cannot be viewed as a _view_. Should it deliver null or should it throw an exception? Or deliver a half-baked instance?


canAs

public boolean canAs(java.lang.Class view)
return true iff this RDFNode can be viewed as a _view_.


inModel

public RDFNode inModel(Model m)
returns a .equals() version of this node, except that its in the model m.

Parameters:
m - a model to move the node to
Returns:
this, if it's already in m (or no model), a copy in m otherwise

visitWith

public java.lang.Object visitWith(RDFVisitor rv)
Apply the appropriate method of the visitor to this node's content and return the result.

Parameters:
rv - an RDFVisitor with a method for URI/blank/literal nodes
Returns:
the result returned by the selected method


Copyright © 2001-2003 Hewlett-Packard. All Rights Reserved.