com.hp.hpl.jena.daml
Interface DAMLCommon

All Superinterfaces:
RDFNode, Resource
All Known Subinterfaces:
DAMLClass, DAMLDataInstance, DAMLDatatype, DAMLDatatypeProperty, DAMLDisjoint, DAMLInstance, DAMLList, DAMLObjectProperty, DAMLOntology, DAMLProperty, DAMLRestriction, Datatype
All Known Implementing Classes:
DAMLCommonImpl

public interface DAMLCommon
extends Resource

Abstract super-class for all DAML resources (including properties). Defines shared implementations and common services, such as property manipulation, vocabulary management and rdf:type management. Also defines accessors for common properties, such as comment, label, and equivalentTo.

Version:
CVS info: $Id: DAMLCommon.java,v 1.3 2002/01/06 13:28:16 ijd Exp $
Author:
Ian Dickinson, HP Labs (email)

Method Summary
 java.util.Iterator getAll(Property property, boolean closed)
          Answer an iterator over a set of resources that are the objects of statements with subject this DAML object and predicate the given property.
 DAMLModel getDAMLModel()
          Answer the DAML model wherein this value is stored.
 java.util.Iterator getEquivalenceSet()
          Answer the set of equivalent values to this value, but not including the value itself.
 java.util.Iterator getEquivalentValues()
          Answer an iterator over all of the DAML objects that are equivalent to this value under the daml:equivalentTo relation.
 int getNumPropertyValues(Property property)
          Answer the number of values a given property has with this value as subject.
 RDFNode getPropertyValue(Property property)
          Answer the value of a given RDF property for this DAML value, or null if it doesn't have one.
 NodeIterator getPropertyValues(Property property)
          Answer an iterator over the set of all values for a given RDF property.
 java.util.Iterator getRDFTypes(boolean closed)
          Answer an iterator over all of the types to which this class belongs.
 DAMLVocabulary getVocabulary()
          Answer the DAML+OIL vocabulary that corresponds to the namespace that this value was declared in.
 boolean hasRDFType(Resource damlClass)
          Answer true if this DAML value is a member of the class denoted by the given DAML class object.
 boolean hasRDFType(java.lang.String classURI)
          Answer true if this DAML value is a member of the class denoted by the given URI.
 LiteralAccessor prop_comment()
          Accessor for the property of the comment on the value, whose value is a literal (string).
 PropertyAccessor prop_equivalentTo()
          Property accessor for the 'equivalentTo' property of a class.
 LiteralAccessor prop_label()
          Accessor for the property of the label on the value, whose value is a literal (string).
 PropertyAccessor prop_type()
          Property accessor for the 'rdf:type' property of a DAML value.
 void remove()
          Remove the DAML object from the model.
 void removeAll(Property prop)
          Remove all the values for a given property on the principal resource.
 void removeProperty(Property property, RDFNode value)
          Remove the specific property-value pair from this DAML resource.
 void replaceProperty(Property prop, RDFNode value)
          Replace the value of the named property with the given value.
 void setPropertyValue(Property property, RDFNode value)
          Set the value of the given property of this DAML value to the given value, encoded as an RDFNode.
 void setRDFType(Resource rdfClass)
          Set the RDF type property for this node in the underlying model, replacing any existing type property.
 void setRDFType(Resource rdfClass, boolean replace)
          Add an RDF type property for this node in the underlying model.
 
Methods inherited from interface com.hp.hpl.mesa.rdf.jena.model.Resource
abort, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, begin, commit, equals, getId, getLocalName, getModel, getNameSpace, getProperty, getURI, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, isAnon, listProperties, listProperties, removeProperties, toString
 

Method Detail

getDAMLModel

public DAMLModel getDAMLModel()
Answer the DAML model wherein this value is stored.
Returns:
a DAMLModel reference.

setRDFType

public void setRDFType(Resource rdfClass)
Set the RDF type property for this node in the underlying model, replacing any existing type property. To add a second or subsequent type statement to a resource, use setRDFType( Resource, false ) .
Parameters:
rdfClass - The RDF resource denoting the new value for the rdf:type property, which will replace any existing type property.

setRDFType

public void setRDFType(Resource rdfClass,
                       boolean replace)
Add an RDF type property for this node in the underlying model. If the replace flag is true, this type will replace any current type property for the node. Otherwise, the type will be in addition to any existing type property. Note that for most normal uses, a DAML resource should have at most one rdf:type property. One exception to this, in the March 2001 release, is when DatatypeProperties are marked as unique, unambiguous or transitive. This is achieved by the use of two rdf type properties.
Parameters:
rdfClass - The RDF resource denoting the class that will be new value for the rdf:type property.
replace - If true, the given class will replace any existing type property for this value, otherwise it will be added as an extra type statement.

hasRDFType

public boolean hasRDFType(java.lang.String classURI)
Answer true if this DAML value is a member of the class denoted by the given URI.
Parameters:
classURI - String denoting the URI of the class to test against
Returns:
true if it can be shown that this DAML value is a member of the class, via rdf:type.

hasRDFType

public boolean hasRDFType(Resource damlClass)
Answer true if this DAML value is a member of the class denoted by the given DAML class object. This will traverse the class hierarchy, until every class and super-class for this DAML value has been examined. Depending on the depth of the hierarchy, this may be an expensive operation. Cycles are detected, however, so it is guaranteed to terminate.
Parameters:
damlClass - Denotes a class to which this value may belong
Returns:
true if the value is a member of the class (or one of its sub-classes) via rdf:type.

getRDFTypes

public java.util.Iterator getRDFTypes(boolean closed)
Answer an iterator over all of the types to which this class belongs. Optionally, generate a closure by considering the closure of the set of classes over the class hierarchy (e.g. if 'fido' is the resource, the non-closed set of fido's classes might be {Dog, Vaccinated}, i.e. the set of classes for which rdf:type statements exist for fido, while the closed set might be {Dog, Vaccinated, Mammal, Pet, Vertebrate, Thing, MedicallyCertified}
Parameters:
closed - If true, generate the closed set by considering the super-classes of the known classes of this value.
Returns:
an iterator over the set of this value's classes

getPropertyValue

public RDFNode getPropertyValue(Property property)
Answer the value of a given RDF property for this DAML value, or null if it doesn't have one. The value is returned as an RDFNode, from which the value can be extracted for literals. If there is more than one RDF statement with the given property for the current value, it is not defined which of the values will be returned.
Parameters:
property - An RDF property
Returns:
An RDFNode whose value is the value, or one of the values, of the given property. If the property is not defined, or an error occurs, returns null.

getPropertyValues

public NodeIterator getPropertyValues(Property property)
Answer an iterator over the set of all values for a given RDF property. Each value in the iterator will be an RDFNode, representing the value (object) of each statement in the underlying model.
Parameters:
property - The property whose values are sought
Returns:
An Iterator over the values of the property

setPropertyValue

public void setPropertyValue(Property property,
                             RDFNode value)
Set the value of the given property of this DAML value to the given value, encoded as an RDFNode. Maintains the invariant that there is at most one value of the property for a given DAML object, so existing property values are first removed. To add multiple properties to a given DAML object, use addProperty.
Parameters:
property - The property to update
value - The new value of the property as an RDFNode, or null to effectively remove this property.

removeProperty

public void removeProperty(Property property,
                           RDFNode value)
Remove the specific property-value pair from this DAML resource.
Parameters:
property - The property to be removed
value - The specific value of the property to be removed

removeAll

public void removeAll(Property prop)
Remove all the values for a given property on the principal resource.
Parameters:
prop - The RDF resource that defines the property to be removed

replaceProperty

public void replaceProperty(Property prop,
                            RDFNode value)
Replace the value of the named property with the given value. All existing values, if any, for the property are first removed.
Parameters:
prop - The RDF property to be updated
value - The new value.

getNumPropertyValues

public int getNumPropertyValues(Property property)
Answer the number of values a given property has with this value as subject.
Parameters:
property - The property to be tested
Returns:
The number of statements with this value as subject and the given property as relation.

getAll

public java.util.Iterator getAll(Property property,
                                 boolean closed)
Answer an iterator over a set of resources that are the objects of statements with subject this DAML object and predicate the given property. Respects DAML semantics of equivalence, transitivity and the property hierarchy.
Parameters:
property - The property whose values are sought
closed - If true, and the given property is transitive, generate the closure over the given property from this value.
Returns:
An iterator of resources that are the objects of statements whose subject is this value (or one of its equivalents) and whose predicate is property or one of its equivalents

getVocabulary

public DAMLVocabulary getVocabulary()
Answer the DAML+OIL vocabulary that corresponds to the namespace that this value was declared in.
Returns:
a vocabulary object

getEquivalentValues

public java.util.Iterator getEquivalentValues()
Answer an iterator over all of the DAML objects that are equivalent to this value under the daml:equivalentTo relation. Note that the first member of the iteration is always the DAML value on which the method is invoked: trivially, a value is a member of the set of values equivalent to itself. If the caller wants the set of values equivalent to this one, not including itself, simply ignore the first element of the iteration.
Returns:
an iterator ranging over every equivalent DAML value - each value of the iteration will be a damlCommon object.

getEquivalenceSet

public java.util.Iterator getEquivalenceSet()
Answer the set of equivalent values to this value, but not including the value itself. The iterator will range over a set: each element occurs only once.
Returns:
An iteration ranging over the set of values that are equivalent to this value, but not itself.

remove

public void remove()
Remove the DAML object from the model. All of the RDF statements with this DAML value as its subject will be removed from the model, and this object will be removed from the indexes. It will be the responsibility of client code to ensure that references to this object are removed so that the object itself can be garbage collected.

prop_label

public LiteralAccessor prop_label()
Accessor for the property of the label on the value, whose value is a literal (string).
Returns:
Literal accessor for the label property

prop_comment

public LiteralAccessor prop_comment()
Accessor for the property of the comment on the value, whose value is a literal (string).
Returns:
Literal accessor for the comment property

prop_equivalentTo

public PropertyAccessor prop_equivalentTo()
Property accessor for the 'equivalentTo' property of a class. This denotes that two terms have the same meaning. The spec helpfully says: for equivalentTo(X, Y), read X is an equivalent term to Y.
Returns:
Property accessor for 'equivalentTo'.

prop_type

public PropertyAccessor prop_type()
Property accessor for the 'rdf:type' property of a DAML value.
Returns:
Property accessor for 'rdf:type'.


Copyright 2001 Hewlett-Packard. All Rights Reserved.