|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.hp.hpl.mesa.rdf.jena.common.ResourceImpl
|
+--com.hp.hpl.jena.daml.common.DAMLCommonImpl
|
+--com.hp.hpl.jena.daml.common.DAMLListImpl
Java representation of a DAML List. A list is the specified interpretation of rdf:parseType="daml:Collection" attributes, where a sequence of values is interpreted as a nested sequence of head/tail list cells. One consequence of this is that the list is quite specifically ordered, whereas the daml:collection is said to be an unordered collection. Consquently, we must caution that future versions of the DAML specificiation may create an unordered interpretation of daml:collection, and client code should not rely on the positionality of elements in the current list interpretation.
| Constructor Summary | |
DAMLListImpl(java.lang.String uri,
DAMLModel store,
DAMLVocabulary vocabulary)
Constructor, takes the URI for this list, and the underlying model it will be attached to. |
|
DAMLListImpl(java.lang.String namespace,
java.lang.String name,
DAMLModel store,
DAMLVocabulary vocabulary)
Constructor, takes the name and namespace for this list, and the underlying model it will be attached to. |
|
| Method Summary | |
void |
add(DAMLCommon value)
Add an element to the list. |
DAMLList |
cons(DAMLCommon value)
Answer a new list formed by creating a new DAMLList element whose first is the given value and whose rest is the current list. |
DAMLList |
findLast()
Find the last list element, i.e. |
java.util.Iterator |
getAll()
Answer an iteration over the values in the list. |
int |
getCount()
Answer a count of the items in the list. |
DAMLCommon |
getFirst()
Answer the first value from the list. |
DAMLCommon |
getItem(int i)
Answer the i'th element of the list, if it exists. |
DAMLList |
getNil()
Answer the well-known constant denototing the nil list. |
DAMLList |
getRest()
Answer a new list that consists of all values of the list save the first. |
boolean |
isEmpty()
Answer true if the list has no values. |
boolean |
isNil(Resource resource)
Answer true if the given resource is the nil list. |
void |
remove(DAMLCommon value)
Remove the given value from the list. |
void |
setFirst(DAMLCommon value)
Set the property daml:first for the given list element. |
void |
setRest(DAMLList tail)
Set the property daml:rest for the given list element. |
void |
setRestNil()
Set the property daml:rest for the given list element to be the
nil list. |
| Methods inherited from class com.hp.hpl.jena.daml.common.DAMLCommonImpl |
getAll, getDAMLModel, getEquivalenceSet, getEquivalentValues, getNumPropertyValues, getPropertyValue, getPropertyValues, getRDFTypes, getSelfIterator, getVocabulary, hasRDFType, hasRDFType, port, prop_comment, prop_equivalentTo, prop_label, prop_type, remove, removeAll, removeProperty, replaceProperty, setPropertyValue, setRDFType, setRDFType, toString |
| Methods inherited from class com.hp.hpl.mesa.rdf.jena.common.ResourceImpl |
abort, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, begin, commit, equals, getEmbeddedResource, getId, getLocalName, getModel, getNameSpace, getProperty, getURI, hashCode, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, isAnon, listProperties, listProperties, removeProperties |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.hp.hpl.jena.daml.DAMLCommon |
getAll, getDAMLModel, getEquivalenceSet, getEquivalentValues, getNumPropertyValues, getPropertyValue, getPropertyValues, getRDFTypes, getVocabulary, hasRDFType, hasRDFType, prop_comment, prop_equivalentTo, prop_label, prop_type, remove, removeAll, removeProperty, replaceProperty, setPropertyValue, setRDFType, setRDFType |
| 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 |
| Constructor Detail |
public DAMLListImpl(java.lang.String uri,
DAMLModel store,
DAMLVocabulary vocabulary)
uri - The URI of the liststore - The RDF store that contains the RDF statements defining the properties of the listvocabulary - Reference to the DAML vocabulary used by this list.
public DAMLListImpl(java.lang.String namespace,
java.lang.String name,
DAMLModel store,
DAMLVocabulary vocabulary)
namespace - The namespace the list inhabits, or nullname - The name of the liststore - The RDF store that contains the RDF statements defining the properties of the listvocabulary - Reference to the DAML vocabulary used by this list.| Method Detail |
public void add(DAMLCommon value)
cons(com.hp.hpl.jena.daml.DAMLCommon)
for an operation that always returns a new list (i.e. no side-effects on
this list).
add in interface DAMLListvalue - A DAML value to add to the listpublic void remove(DAMLCommon value)
remove in interface DAMLListvalue - A DAML value to be removed from the list.public java.util.Iterator getAll()
getAll in interface DAMLListpublic DAMLCommon getFirst()
Answer the first value from the list. Since, strictly speaking, DAML collections
are unordered, the position items in the list should not be relied on in client
code, as the definition of 'first' in the list may change in future releases.
However, the identity
is guaranteed, providing that the contents of L do not change.
List L = L.getFirst() + L.getRest()
Note that this method assumes that a DAMLList contains only DAML values, since lists
were only introduced in the DAML specification. However, it is possible and sometimes
useful to construct lists containing non-DAML values. In such cases, this method
will throw a class cast exception. However, getAll().next() has a weaker
expectation: that the list will contain RDF resources. This alternative means of
accessing the list may be useful in such cases.
getFirst in interface DAMLListgetAll()public DAMLList getRest()
List L = L.getFirst() + L.getRest()
is guaranteed, providing that the contents of L do not change.
getRest in interface DAMLListpublic int getCount()
getCount in interface DAMLListpublic boolean isEmpty()
isEmpty in interface DAMLListpublic void setFirst(DAMLCommon value)
daml:first for the given list element. This is a single
value that denotes the value at this position of the list.
setFirst in interface DAMLListvalue - The value to be assigned to the 'first' property of a list cellpublic void setRest(DAMLList tail)
daml:rest for the given list element. This is a single
value that denotes the tail of the list.
setRest in interface DAMLListtail - The value to be assigned to the tail of the list.public void setRestNil()
daml:rest for the given list element to be the
nil list. This correctly terminates the list at this point.
setRestNil in interface DAMLListpublic DAMLList cons(DAMLCommon value)
cons in interface DAMLListvalue - The new value to be added to the head of the list
daml:first is the value, and whose
daml:rest is this list.public DAMLList getNil()
getNil in interface DAMLListpublic boolean isNil(Resource resource)
isNil in interface DAMLListresource - A resource, that may be the nil list
public DAMLList findLast()
findLast in interface DAMLListpublic DAMLCommon getItem(int i)
getItem in interface DAMLListi - The position of the list to return
java.lang.IllegalArgumentException - if i is less than one, or
larger than the length of the list.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||