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(); } }
public static void removeListValue(RDFResource resource, RDFProperty property, Object value) { RDFList list = (RDFList) resource.getPropertyValue(property); List values = list.getValues(); int index = values.indexOf(value); removeListValue(resource, property, list, index); }