public List getValues() {
   List result = new ArrayList();
   RDFList l = this;
   while (l != null && l.getFirst() != null) {
     result.add(l.getFirst());
     l = l.getRest();
   }
   return result;
 }
  public void append(Object value) {

    boolean done = false;
    RDFList current = this;

    while (!done) {
      if (current.getFirst() == null) {
        current.setFirst(value);
        current.setRest(getOWLModel().getRDFNil());
        done = true;
      } else if (current.getRest() == null || getOWLModel().getRDFNil().equals(current.getRest())) {
        RDFSNamedClass listClass = (RDFSNamedClass) getDirectType();
        RDFList newRest = (RDFList) listClass.createAnonymousInstance();
        newRest.setFirst(value);
        newRest.setRest(getOWLModel().getRDFNil());
        current.setRest(newRest);
        done = true;
      } else {
        current = current.getRest(); // Recursion into tail
      }
    }
  }
 public static void removeListValue(
     RDFResource resource, RDFProperty property, RDFList li, int index) {
   if (index == 0) {
     RDFList rest = li.getRest();
     if (li.getOWLModel().getRDFNil().equals(rest)) {
       rest = null;
     }
     li.setRest(null);
     resource.setPropertyValue(property, rest);
     li.delete();
   } else {
     RDFList pred = null;
     while (index > 0) {
       index--;
       pred = li;
       li = li.getRest();
     }
     RDFList rest = li.getRest();
     li.setRest(null);
     pred.setRest(rest);
     li.delete();
   }
 }