com.hp.hpl.jena.daml
Interface PropertyAccessor

All Known Subinterfaces:
IntLiteralAccessor, LiteralAccessor
All Known Implementing Classes:
PropertyAccessorImpl

public interface PropertyAccessor

Encapsulates the standard methods of modifying a property on a DAML value.

Version:
CVS info: $Id: PropertyAccessor.java,v 1.2 2002/02/27 13:39:07 ian_dickinson Exp $
Author:
Ian Dickinson, HP Labs (email)

Method Summary
 void add(Resource value)
          Add a value to the encapsulated property.
 int count()
          Answer the number of values that the encapsulated property has in the RDF model.
 RDFNode get()
          Answer a general value of the encapsulated property.
 java.util.Iterator getAll(boolean closed)
          Answer an iteration over the DAML values that this property has in the RDF model.
 DAMLCommon getDAMLValue()
          Answer a value of the encapsulated property, making the assumption that it is a DAML value.
 Property getProperty()
          Answer the property that this accessor works on
 boolean hasValue(DAMLCommon value)
          Answer true if the encapsulated property has the given value as one of its values.
 void remove(DAMLCommon value)
          Remove a value from the encapsulated property.
 

Method Detail

getProperty

public Property getProperty()
Answer the property that this accessor works on
Returns:
A property

count

public int count()
Answer the number of values that the encapsulated property has in the RDF model.
Returns:
The number statements for this property in the model.

getAll

public java.util.Iterator getAll(boolean closed)
Answer an iteration over the DAML values that this property has in the RDF model.
Parameters:
closed - If true, and the property is transitive, generate the closure of the property starting from the encapsulated resource.
Returns:
An iteration over the values of the encapsulated property.

get

public RDFNode get()
Answer a general value of the encapsulated property. If it has no values, answer null. If it has one value, answer that value. Otherwise, answer an undetermined member of the set of values. This version of the method makes no assumptions about the property value, other than it is an RDF node. This is the safest, most conservative, assumption. If it is known that a value is certain to be a DAML value, you can use getDAMLValue() instead.
Returns:
A value for the encapsulated property in the RDF model, or null if the property has no value.

getDAMLValue

public DAMLCommon getDAMLValue()
Answer a value of the encapsulated property, making the assumption that it is a DAML value. If the property has no DAML value, answer null. If it has one DAML value, answer that value. Otherwise, answer an undetermined member of the set of values. This method is optimised to select only DAML values for the property - that is, values that extend DAMLCommon. This method will therefore answer null if there is no DAML value for the property, even if there is one or more vanilla-RDF values. For a more general version of this method, which returns all RDF values, see get().
Returns:
A DAML value for the encapsulated property in the RDF model, or null if the property has no DAML value.

add

public void add(Resource value)
Add a value to the encapsulated property.
Parameters:
value - The value to be added.

remove

public void remove(DAMLCommon value)
Remove a value from the encapsulated property.
Parameters:
value - The value to be removed.

hasValue

public boolean hasValue(DAMLCommon value)
Answer true if the encapsulated property has the given value as one of its values.
Parameters:
value - A DAML value to test for
Returns:
True if the RDF model contains a statement giving a value for the encapsulated property matching the given value.


Copyright 2001 Hewlett-Packard. All Rights Reserved.