title: Using model.remove (statement) in Jena
body: <p>I am new with Jena and do not have much experience with Java. I am trying to make a program that deletes statements from a model. (I know about the alternative method of doing it using a graph and running SPARUL queries but I want to use a model instead). I have tried using the model.remove(statement) but it seems I am not doing it properly. I have searched for an example of the above method but I could not find one. Can someone please help me where I am doing wrong?  I want to start with deleting one statement. After that I want to delete multiple statements. I am including the code below. Thanks in advance for the help</p>
  
  <pre><code>     import java.io.File;
  import java.io.FileInputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.util.Calendar;
  import java.util.Date;
  
  import com.hp.hpl.jena.query.Query;
  import com.hp.hpl.jena.query.QueryExecution;
  import com.hp.hpl.jena.query.QueryExecutionFactory;
  import com.hp.hpl.jena.query.QueryFactory;
  import com.hp.hpl.jena.query.ResultSet;
  import com.hp.hpl.jena.query.ResultSetFormatter;
  import com.hp.hpl.jena.rdf.model.Model;
  import com.hp.hpl.jena.rdf.model.ModelFactory;
  import com.hp.hpl.jena.rdf.model.Resource;
  import com.hp.hpl.jena.rdf.model.ResourceFactory;
  import com.hp.hpl.jena.util.FileManager;
  import com.hp.hpl.jena.vocabulary.VCARD;
  
   public class Test3 extends Object  {
  
   public static void main(String[] args) throws IOException {
  
       final String  inputFileName = "vc-db-1.rdf";
       Model model = ModelFactory.createDefaultModel();
  
       InputStream in = FileManager.get().open(inputFileName);
       if (in == null) {
           throw new IllegalArgumentException ( "File: " + inputFileName + " not found");
       }
  
        model.read(new InputStreamReader(in), "");
       in.close();
  
       System.out.println( "== Before removal ==" );
       model.write( System.out);
  
       System.out.println( "\n\n== After removal ==" );
  
  
  
       model.remove( model.createResource( "http://somewhere/JohnSmith" ),
               VCARD.FN, // or ResourceFactory.createProperty( "http://www.w3.org/2001/vcard-rdf/3.0#FN" );
               ResourceFactory.createTypedLiteral( "John Smith" ));
       model.write( System.out);
   }
  
   }
  </code></pre>
  
  <p>The output is as follows</p>
  
  <pre><code>   == Before removal ==
      &lt;rdf:RDF
          xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
          xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" &gt; 
  
  .....Other statements
        &lt;rdf:Description rdf:about="http://somewhere/JohnSmith/"&gt;
          &lt;vCard:N rdf:nodeID="A3"/&gt;
          &lt;vCard:FN&gt;John Smith&lt;/vCard:FN&gt;
        &lt;/rdf:Description&gt;
        &lt;rdf:Description rdf:nodeID="A3"&gt;
          &lt;vCard:Given&gt;John&lt;/vCard:Given&gt;
          &lt;vCard:Family&gt;Smith&lt;/vCard:Family&gt;
        &lt;/rdf:Description&gt;
      &lt;/rdf:RDF&gt;
  
  
      == After removal ==
      &lt;rdf:RDF
          xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
          xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" &gt; 
  ...Other Statements
        &lt;rdf:Description rdf:about="http://somewhere/JohnSmith/"&gt;
          &lt;vCard:N rdf:nodeID="A3"/&gt;
          &lt;vCard:FN&gt;John Smith&lt;/vCard:FN&gt;
        &lt;/rdf:Description&gt;
        &lt;rdf:Description rdf:nodeID="A3"&gt;
          &lt;vCard:Given&gt;John&lt;/vCard:Given&gt;
          &lt;vCard:Family&gt;Smith&lt;/vCard:Family&gt;
        &lt;/rdf:Description&gt;
      &lt;/rdf:RDF&gt;
  </code></pre>
  
  <p>Do I need to somehow 'confirm/commit' changes to the model after deleting statements?</p>