KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > joseki > server > processors > RemoveProcessor


1 /*
2  * (c) Copyright 2003, 2004 Hewlett-Packard Development Company, LP
3  * [See end of file]
4  */

5  
6 package org.joseki.server.processors;
7
8 //import org.apache.commons.logging.* ;
9
import org.joseki.server.*;
10 import org.joseki.vocabulary.*;
11
12 import com.hp.hpl.jena.rdf.model.*;
13
14 /** Processor to remove the statements in the argument model from the target model.
15  * @author Andy Seaborne
16  * @version $Id: RemoveProcessor.java,v 1.5 2004/04/30 14:13:11 andy_seaborne Exp $
17  */

18 public class RemoveProcessor extends OneArgProcessor
19 {
20
21     public RemoveProcessor()
22     {
23         super("remove", ProcessorCom.WriteOperation, ProcessorCom.MutatesModel) ;
24     }
25
26     public String JavaDoc getInterfaceURI() { return JosekiVocab.opRemove ; }
27
28     public Model execOneArg(ModelSource src, Model graph, Request req)
29         throws RDFException, ExecutionException
30     {
31         if (!(src instanceof ModelSourceJena))
32             throw new ExecutionException(
33                 ExecutionError.rcOperationNotSupported,
34                 "Wrong implementation - this Fetch processor works with Jena models");
35         Model target = ((ModelSourceJena)src).getModel() ;
36         target.remove(graph) ;
37         return super.emptyModel ;
38     }
39         
40 }
41
42 /*
43  * (c) Copyright 2003, 2004 Hewlett-Packard Development Company, LP
44  * All rights reserved.
45  *
46  * Redistribution and use in source and binary forms, with or without
47  * modification, are permitted provided that the following conditions
48  * are met:
49  * 1. Redistributions of source code must retain the above copyright
50  * notice, this list of conditions and the following disclaimer.
51  * 2. Redistributions in binary form must reproduce the above copyright
52  * notice, this list of conditions and the following disclaimer in the
53  * documentation and/or other materials provided with the distribution.
54  * 3. The name of the author may not be used to endorse or promote products
55  * derived from this software without specific prior written permission.
56  *
57  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
58  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
59  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
60  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
61  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
62  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
63  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
64  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
65  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
66  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67  */

68
Popular Tags