You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by afs <gi...@git.apache.org> on 2016/08/06 14:01:31 UTC

[GitHub] jena pull request #162: JENA-1221: Embedded Fuseki server

GitHub user afs opened a pull request:

    https://github.com/apache/jena/pull/162

    JENA-1221: Embedded Fuseki server

    This add a new module under jena-fuseki2 for running Fuseki embedded.
    
    It is a new module so it can have it's own POM. The POM excludes all unecessary dependencies from jena-fuseki-core including logging provider, and modules jena-text and jena-spatial.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/afs/jena fuseki-embedded

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jena/pull/162.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #162
    
----
commit c809629d096ec5279913638952c03716ea1117d1
Author: Andy Seaborne <an...@apache.org>
Date:   2016-08-06T13:49:36Z

    JENA-1221: Embedded Fuseki server

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #162: JENA-1221: Embedded Fuseki server

Posted by afs <gi...@git.apache.org>.
Github user afs commented on the issue:

    https://github.com/apache/jena/pull/162
  
    Draft documentation:
    https://gist.github.com/afs/c5e025e55a1d9773f323bb050e4d9d39


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #162: JENA-1221: Embedded Fuseki server

Posted by afs <gi...@git.apache.org>.
Github user afs commented on the issue:

    https://github.com/apache/jena/pull/162
  
    Examples:
    ```
        /** Create a SPARQL endpoint for an application dataset and start the server */ 
        private static void example0() {
            DatasetGraph dsg = dataset() ;
            // Run a Fuseki server with "/ds" as the dataset.
            // Default set up : query, update, graph store and quads operations. 
            FusekiEmbeddedServer.make(3330, "/ds", dsg).start() ;
        }
    ```
    ```
        /** Create a SPARQL endpoint for an application dataset */ 
        private static void example1() {
            DatasetGraph dsg = dataset() ;
            // Run a Fuseki server with "/ds" as the dataset.
            // Default set up : query, update, graph store and quads operations. 
            FusekiEmbeddedServer server = FusekiEmbeddedServer.create()
                .setPort(3333)
                .add("/ds", dsg) 
                .build() ;
            server.start() ;
        }
    ```
    ```
        /** Create a Fuseki server with a just a SPAQRL query endpoint.
         * The SPARQL endpoint URLs look like {@code /rdf/sparql?query=}
         */
        private static void example2() {
            DatasetGraph dsg = dataset() ;
    
            DataService queryService = new DataService(dsg) ;
            queryService.addEndpoint(OperationName.Query, "sparql");
            
            FusekiEmbeddedServer server = FusekiEmbeddedServer.create()
                .setPort(3334)
                .add("/rdf", queryService)
                .build() ;
            server.start() ;
            // Sync with the server - this is blocking.
            server.join() ;
        }
    ```
    ```    
        /** Create a Fuseki server with two sets of services. One is the usual set of read-only endpoints,
         *  the other is just being able to do quads operations
         * GET, POST, PUT on  "/ds2" in N-quads and TriG.
         */
        private static void example3() {
            DatasetGraph dsg = DatasetGraphFactory.createTxnMem() ;
    
            // A service with just being able to do quads operations
            // That is, GET, POST, PUT on  "/ds2" in N-quads and TriG. 
            DataService dataService = new DataService(dsg) ;
            dataService.addEndpoint(OperationName.Quads_RW, "");
    
            FusekiEmbeddedServer server = FusekiEmbeddedServer.create()
                .setPort(3335)
                .add("/ds2", dataService)
                .build() ;
            server.start() ;
        }
    ```
    ```    
        /** Create a Fuseki server with some services on the dataset URL. */
        private static void example4() {
            DatasetGraph dsg = DatasetGraphFactory.createTxnMem() ;
    
            // A service able to do quads operations and SPARQL query
            DataService dataService = new DataService(dsg) ;
            dataService.addEndpoint(OperationName.Quads_RW, "");
            dataService.addEndpoint(OperationName.Query, "");
    
            FusekiEmbeddedServer server = FusekiEmbeddedServer.create()
                .setPort(3336)
                .add("/data", dataService)
                .build() ;
            server.start() ;
        }
    ```
    ```    
        /** Create a Fuseki server by reading a configuration file. */
        private static void example5() {
            FusekiEmbeddedServer server = FusekiEmbeddedServer.create()
                .setPort(3337)
                // Defines /ds
                .parseConfigFile("config.ttl")
                .build() ;
            server.start() ;
        }
    ```
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #162: JENA-1221: Embedded Fuseki server

Posted by afs <gi...@git.apache.org>.
Github user afs commented on the issue:

    https://github.com/apache/jena/pull/162
  
    Example of the application sharing the dataset with Fuseki. This also shows using java.util.logging for application and embedded Fuseki.
    
    ```
    public static void example6() {
            LogCtl.setJavaLogging();
            Logger LOG = LoggerFactory.getLogger("example6") ;
            DatasetGraph dsg = DatasetGraphFactory.createTxnMem() ;
            FusekiEmbeddedServer server = FusekiEmbeddedServer.make(3330, "/ds", dsg) ;
            server.start() ;
            
            LOG.info("Remote 1") ;
            try (QueryExecution qExec = 
                QueryExecutionFactory.sparqlService("http://localhost:3330/ds/query", "SELECT * { ?s ?p ?o}") ) {
                // Empty table
                QueryExecUtils.executeQuery(qExec); 
            }
    
            // Transaction-protected update.
            Txn.execWrite(dsg,  ()->{
                Quad q = SSE.parseQuad("(_ :s :p _:b)") ;
                dsg.add(q); 
            }) ;
            
            LOG.info("Remote 2") ;
            try (QueryExecution qExec = 
                QueryExecutionFactory.sparqlService("http://localhost:3330/ds/query", "SELECT * { ?s ?p ?o}") ) {
                // One row.
                QueryExecUtils.executeQuery(qExec); 
            }
            server.stop() ;
        }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #162: JENA-1221: Embedded Fuseki server

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/jena/pull/162


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #162: JENA-1221: Embedded Fuseki server

Posted by afs <gi...@git.apache.org>.
Github user afs commented on the issue:

    https://github.com/apache/jena/pull/162
  
    Yes, that's the idea!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #162: JENA-1221: Embedded Fuseki server

Posted by kinow <gi...@git.apache.org>.
Github user kinow commented on the issue:

    https://github.com/apache/jena/pull/162
  
    Lurking around this issue.
    
    I'm setting up a SPARQL database with Jena in Jenkins
    
    https://github.com/biouno/database-sparql-plugin/blob/master/src/main/java/org/biouno/databasesparql/JenaTDBDatabase.java
    
    Used TDB and Jena JDBC. 
    
    If I understand correctly, this new module will allow me to expose the database via SPARQL. Looking forward to it!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---