@Override public void remove() { super.remove(); current.remove(); }
/** * <p>Remove all of the components of this list from the model. Once this operation * has completed, the {@link RDFList} resource on which it was called will no * longer be a resource in the model, so further methods calls on the list object * (for example, {@link #size} will fail. Due to restrictions on the encoding * of lists in RDF, it is not possible to perform an operation which empties a list * and then adds further values to that list. Client code wishing to perform * such an operation should do so in two steps: first remove the old list, then * create a new list with the new contents. It is important that RDF statements * that reference the old list (in the object position) be updated to point * to the newly created list. * Note that this * is operation is only removing the list cells themselves, not the resources * referenced by the list - unless being the object of an <code>rdf:first</code> * statement is the only mention of that resource in the model.</p> */ @Override public void removeList() { for (Iterator<Statement> i = collectStatements().iterator(); i.hasNext(); ) { i.next().remove(); } }
@Override public Seq remove(int index) { getRequiredProperty(RDF.li(index)).remove(); shiftDown(index+1, size()+1); return this; }
/** * <p> * Helper method for setting the list tail, that assumes we have * a resource that is a list. * </p> * * @param root The resource representing the list cell we're setting the * tail of * @param tail The new tail for this list, as a resource. * @return The old tail, as a resource. */ protected static Resource setTailAux( Resource root, Resource tail, Property pTail ) { Statement current = root.getRequiredProperty( pTail ); Resource oldTail = current.getResource(); // out with the old, in with the new current.remove(); root.addProperty( pTail, tail ); return oldTail; }
@Override public Container remove(int index, RDFNode o) { // System.err.println( "]] SeqImpl::remove( " + index + ", " + o + ")" ); return remove(getModel().createStatement(this, RDF.li(index), o).remove()); }
private void restitchItemLists(Model given, Model recon) { Statement G = given.listStatements(ANY, API.items, ANY).toList().get(0); Resource page = G.getSubject(); // Statement S = recon.listStatements(ANY, API.items, ANY).toList().get(0); Resource items = S.getObject().asResource(); S.remove(); recon.add(page, API.items, items); recon.removeAll(ANY, others, ANY); }
protected void shiftDown(int start, int finish) { for (int i=start; i<=finish; i++) { Statement stmt = getRequiredProperty( RDF.li(i) ); // System.err.println( "]]* remove " + stmt ); stmt.remove(); // System.err.println( "]]* addProperty( " + RDF.li(i-1) + " " + stmt.getObject() ); addProperty(RDF.li(i-1), stmt.getObject()); } }
/** * <p> * Update the head of the list to have the given value, and return the * previous value. * </p> * * @param value The value that will become the value of the list head * @exception EmptyListException if this list is the empty list */ @Override public RDFNode setHead( RDFNode value ) { if (s_checkValid) { checkValid(); } checkNotNil( "Tried to set the head of an empty list" ); // first remove the existing head Statement current = getRequiredProperty( listFirst() ); RDFNode n = current.getObject(); current.remove(); // now add the new head value to the graph addProperty( listFirst(), value ); return n; }