title: Java parse content from fuseki server error
body: <p>I found this code <a href="https://gist.github.com/thiloplanz/f2d279cfc0880327a197" rel="nofollow noreferrer">here</a> that should parse off content from the fuseki server where I uploaded an RDF file, but it returns <code>404 Not Found</code>...</p>
  
  <p>Why I'm getting this error since I can access my uploaded file from server using the path from the code?</p>
  
  <p>The path where my <code>RDF</code> is uploaded to the fuseki server is <a href="http://localhost:3030/Date/data/" rel="nofollow noreferrer">http://localhost:3030/Date/data/</a> and this is what it contains:</p>
  
  <pre><code>@prefix rdf:   &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
  @prefix admin: &lt;http://webns.net/mvcb/&gt; .
  @prefix rdfs:  &lt;http://www.w3.org/2000/01/rdf-schema#&gt; .
  @prefix foaf:  &lt;http://xmlns.com/foaf/0.1/&gt; .
  
  &lt;http://localhost:3030/Date/data&gt;
          a                     foaf:PersonalProfileDocument ;
          admin:errorReportsTo  &lt;mailto:leigh@ldodds.com&gt; ;
          admin:generatorAgent  &lt;http://www.ldodds.com/foaf/foaf-a-matic&gt; ;
          foaf:maker            &lt;http://localhost:3030/Date/data#me&gt; ;
          foaf:primaryTopic     &lt;http://localhost:3030/Date/data#me&gt; .
  
  &lt;http://localhost:3030/Date/data#me&gt;
          a                       foaf:Person ;
          foaf:family_name        "Smith" ;
          foaf:givenname          "John" ;
          foaf:homepage           &lt;http://localhost:3030/Date/site.net&gt; ;
          foaf:knows              [ a                  foaf:Person ;
                                    foaf:mbox_sha1sum  "13add4a38db79b6645aca8dafe59051d971c38e6" ;
                                    foaf:name          "Mary"
                                  ] ;
          foaf:knows              [ a                  foaf:Person ;
                                    foaf:mbox_sha1sum  "0072d6deb958659e205919ec647f3432cf75680d" ;
                                    foaf:name          "George"
                                  ] ;
          foaf:knows              [ a                  foaf:Person ;
                                    foaf:mbox_sha1sum  "d0aba3272918de44d34185558f06a507b8efe49c" ;
                                    foaf:name          "Lora"
                                  ] ;
          foaf:knows              [ a                  foaf:Person ;
                                    foaf:mbox_sha1sum  "13add4a38db79b6645aca8dafe59051d971c38e6" ;
                                    foaf:name          "Mary"
                                  ] ;
          foaf:knows              [ a                  foaf:Person ;
                                    foaf:mbox_sha1sum  "0072d6deb958659e205919ec647f3432cf75680d" ;
                                    foaf:name          "George"
                                  ] ;
          foaf:knows              [ a                  foaf:Person ;
                                    foaf:mbox_sha1sum  "d0aba3272918de44d34185558f06a507b8efe49c" ;
                                    foaf:name          "Lora"
                                  ] ;
          foaf:knows              [ a                  foaf:Person ;
                                    foaf:mbox_sha1sum  "13add4a38db79b6645aca8dafe59051d971c38e6" ;
                                    foaf:name          "Mary"
                                  ] ;
          foaf:knows              [ a                  foaf:Person ;
                                    foaf:mbox_sha1sum  "0072d6deb958659e205919ec647f3432cf75680d" ;
                                    foaf:name          "George"
                                  ] ;
          foaf:knows              [ a                  foaf:Person ;
                                    foaf:mbox_sha1sum  "d0aba3272918de44d34185558f06a507b8efe49c" ;
                                    foaf:name          "Lora"
                                  ] ;
          foaf:mbox_sha1sum       "77d0a8b957b9e316620d66631e1254e906148164" ;
          foaf:name               "John Smith" ;
          foaf:nick               "Johnny" ;
          foaf:phone              &lt;tel:0745158477&gt; ;
          foaf:schoolHomepage     &lt;http://localhost:3030/Date/Harvard&gt; ;
          foaf:title              "Dr" ;
          foaf:workInfoHomepage   &lt;http://localhost:3030/Date/development&gt; ;
          foaf:workplaceHomepage  &lt;http://localhost:3030/Date/work&gt; .
  
  &lt;http://localhost:3030/Date/data/example1&gt; {
      &lt;http://localhost:3030/Date/data?graph=example1&gt;
              a                     foaf:PersonalProfileDocument ;
              admin:errorReportsTo  &lt;mailto:leigh@ldodds.com&gt; ;
              admin:generatorAgent  &lt;http://www.ldodds.com/foaf/foaf-a-matic&gt; ;
              foaf:maker            &lt;http://localhost:3030/Date/data?graph=example1#me&gt; ;
              foaf:primaryTopic     &lt;http://localhost:3030/Date/data?graph=example1#me&gt; .
  
      &lt;http://localhost:3030/Date/data?graph=example1#me&gt;
              a                       foaf:Person ;
              foaf:family_name        "V" ;
              foaf:givenname          "George" ;
              foaf:homepage           &lt;http://localhost:3030/Date/betacoding.net&gt; ;
              foaf:knows              [ a                  foaf:Person ;
                                        rdfs:seeAlso       &lt;http://localhost:3030/Date/Charlie&gt; ;
                                        foaf:mbox_sha1sum  "c7856d7a98889cee78a21245301a560e8f74d191" ;
                                        foaf:name          "John"
                                      ] ;
              foaf:knows              [ a                  foaf:Person ;
                                        rdfs:seeAlso       &lt;http://localhost:3030/Date/Margaret&gt; ;
                                        foaf:mbox_sha1sum  "a61c03838106b21fc083e7bc65e76c511c549d22" ;
                                        foaf:name          "Mary"
                                      ] ;
              foaf:knows              [ a                  foaf:Person ;
                                        rdfs:seeAlso       &lt;http://localhost:3030/Date/John&gt; ;
                                        foaf:mbox_sha1sum  "27f94c268f1a1c6004be361f4045d43c3745c0de" ;
                                        foaf:name          "Charlie"
                                      ] ;
              foaf:mbox_sha1sum       "b01b5835fa8ae7b7582968a7ecacb9b85503a6c9" ;
              foaf:name               "George V" ;
              foaf:nick               "jorch" ;
              foaf:phone              &lt;tel:123456&gt; ;
              foaf:schoolHomepage     &lt;http://localhost:3030/Date/a school&gt; ;
              foaf:title              "Dr" ;
              foaf:workInfoHomepage   &lt;http://localhost:3030/Date/development&gt; ;
              foaf:workplaceHomepage  &lt;http://localhost:3030/Date/work&gt; .
  }
  
  &lt;http://localhost:3030/Date/data/test&gt; {
      &lt;http://localhost:3030/Date/data?graph=test&gt;
              a                     foaf:PersonalProfileDocument ;
              admin:errorReportsTo  &lt;mailto:leigh@ldodds.com&gt; ;
              admin:generatorAgent  &lt;http://www.ldodds.com/foaf/foaf-a-matic&gt; ;
              foaf:maker            &lt;http://localhost:3030/Date/data?graph=test#me&gt; ;
              foaf:primaryTopic     &lt;http://localhost:3030/Date/data?graph=test#me&gt; .
  
      &lt;http://localhost:3030/Date/data?graph=test#me&gt;
              a                       foaf:Person ;
              foaf:family_name        "V" ;
              foaf:givenname          "George" ;
              foaf:homepage           &lt;http://localhost:3030/Date/betacoding.net&gt; ;
              foaf:knows              [ a                  foaf:Person ;
                                        rdfs:seeAlso       &lt;http://localhost:3030/Date/Charlie&gt; ;
                                        foaf:mbox_sha1sum  "c7856d7a98889cee78a21245301a560e8f74d191" ;
                                        foaf:name          "John"
                                      ] ;
              foaf:knows              [ a                  foaf:Person ;
                                        rdfs:seeAlso       &lt;http://localhost:3030/Date/Margaret&gt; ;
                                        foaf:mbox_sha1sum  "a61c03838106b21fc083e7bc65e76c511c549d22" ;
                                        foaf:name          "Mary"
                                      ] ;
              foaf:knows              [ a                  foaf:Person ;
                                        rdfs:seeAlso       &lt;http://localhost:3030/Date/John&gt; ;
                                        foaf:mbox_sha1sum  "27f94c268f1a1c6004be361f4045d43c3745c0de" ;
                                        foaf:name          "Charlie"
                                      ] ;
              foaf:mbox_sha1sum       "b01b5835fa8ae7b7582968a7ecacb9b85503a6c9" ;
              foaf:name               "George V" ;
              foaf:nick               "jorch" ;
              foaf:phone              &lt;tel:123456&gt; ;
              foaf:schoolHomepage     &lt;http://localhost:3030/Date/a school&gt; ;
              foaf:title              "Dr" ;
              foaf:workInfoHomepage   &lt;http://localhost:3030/Date/development&gt; ;
              foaf:workplaceHomepage  &lt;http://localhost:3030/Date/work&gt; .
  }
  </code></pre>
  
  <p>This my code:</p>
  
  <pre><code>import java.io.File;
  import java.io.FileInputStream;
  import java.io.IOException;
  
  import com.hp.hpl.jena.query.DatasetAccessor;
  import com.hp.hpl.jena.query.DatasetAccessorFactory;
  import com.hp.hpl.jena.query.QueryExecution;
  import com.hp.hpl.jena.query.QueryExecutionFactory;
  import com.hp.hpl.jena.query.QuerySolution;
  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.RDFNode;
  
  public class FusekiExample {
  
      public static void execSelectAndPrint(String serviceURI, String query) {
          QueryExecution q = QueryExecutionFactory.sparqlService(serviceURI,
                  query);
          ResultSet results = q.execSelect();
  
          ResultSetFormatter.out(System.out, results);
  
          while (results.hasNext()) {
              QuerySolution soln = results.nextSolution();
              RDFNode x = soln.get("x");
              System.out.println(x);
          }
      }
  
      public static void execSelectAndProcess(String serviceURI, String query) {
          QueryExecution q = QueryExecutionFactory.sparqlService(serviceURI,
                  query);
          ResultSet results = q.execSelect();
  
          while (results.hasNext()) {
              QuerySolution soln = results.nextSolution();
              // assumes that you have an "?x" in your query
              RDFNode x = soln.get("x");
              System.out.println(x);
          }
  
      }
  
      public static void main(String[] argv) throws IOException {
          execSelectAndPrint(
                  "http://localhost:3030/Date/data/",
                  "SELECT * WHERE { ?x  &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;  \"George V\" }");
          execSelectAndProcess(
                  "http://localhost:3030/Date/data/" ,
                  "SELECT * WHERE { ?x  &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;  \"George V\" }");  
      }
  }
  </code></pre>