0

I have a question:

I have two RDF files that I load on Jena TDB using this Java Code:

public void store() {
        String directory = "C:\\tdb";
        Dataset dataset = openTDB(directory);

        String source = "C:\\file1.rdf";
        String source1 = "C:\\file2.rdf";
        Model tdb = loadModel(source, dataset);
        dataset.addNamedModel("C://File1", tdb);

        Model tdb1 = loadModel(source1, dataset);
        dataset.addNamedModel("C://File2", tdb1);
        tdb.close();
        tdb1.close();
        dataset.close();
    }

public Dataset openTDB(String directory) {
        // open TDB dataset
        Dataset dataset = TDBFactory.createDataset(directory);

        return dataset;
    }

public Model loadModel(String source, Dataset dataset) {

        Model model = ModelFactory.createDefaultModel();
        FileManager.get().readModel(model, source, "RDF/XML");

        return model;
    }

As was suggested in this post https://stackoverflow.com/questions/24798024/how-i-can-use-fuseki-with-jena-tdb, I launch this command on CMD:

fuseki-server --update --loc C:\tdb /ds

On the localhost:3030 I see different page. In particular, I see "Control Panel" page where I can choose the dataset and I can execute a query.

Now, I'm reading this documentation http://jena.apache.org/documentation/serving_data/ and I see that if I want to launch the SPARQL query endpoint I can write http://host/dataset/query path in the browser. But, If I launch this path (

http://localhost:3030/ds/query

), I get this error:

Error 404: Service Description: /ds/query


Fuseki - version 1.0.2 (Build date: 2014-06-02T10:57:10+0100)

Why? I'm doing this research to find a Java method to launch Fuseki server in Java Code. Is it possible?

Community
  • 1
  • 1
Musich87
  • 532
  • 1
  • 10
  • 30
  • 'I see "Control Panel" page where I can choose the dataset and I can execute a query.' If you choose a datatset to get to a query form, what's the URL of that page? – Joshua Taylor Aug 26 '14 at 13:31
  • If the core of the question is the last line, **"I'm doing this research to find a Java method to launch Fuseki server in Java Code. Is it possible?"**, then this is a duplicate of [How do I start a Fuseki server from Jena API Eclipse project?](http://stackoverflow.com/q/24971291/1281433). – Joshua Taylor Aug 26 '14 at 13:33
  • I'm confused how `Dataset dataset = ts.openTDB(directory); String directory = "C:\\tdb";` works when `directory` is used in the first statement, but isn't declared until the second. Is this the actual code you're running? Or is there a wider scope definition of `directory` that's begin referenced on the first line (does Java scope allow that?)? – Joshua Taylor Aug 26 '14 at 13:34
  • When I choose a dataset, I get http://localhost:3030/sparql.tpl URL. I'm sorry, openTDB is a method which call this operation: Dataset dataset = TDBFactory.createDataset(directory); – Musich87 Aug 26 '14 at 13:36
  • I had forgotten to write the method openTDB, sorry – Musich87 Aug 26 '14 at 13:37
  • I'm not all that worried that we don't have the definition of openTDB. My point is that you call `openTDB(directory)` before you've declared the variable `directory`. Like doing `String y = x; String x = "x";`. How does that work? – Joshua Taylor Aug 26 '14 at 13:41
  • Ok, I have edited the code. I have realized an error when I used copy/paste from Netbeans – Musich87 Aug 26 '14 at 13:49
  • I see you've updated your code, but it's not legal either. You're declaring `Dataset dataset = ...` twice, now. Please show working code. – Joshua Taylor Aug 26 '14 at 13:49
  • Now it's ok. Sorry, I have multiple version of this code :( – Musich87 Aug 26 '14 at 13:52

0 Answers0