Uploaded image for project: 'Blazegraph (by SYSTAP)'
  1. Blazegraph (by SYSTAP)
  2. BLZG-1485

Add a Custom Function to the blazegraph-samples

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Project Management
    • Labels:
      None

      Description

      Add a new project to blazegraph-samples that shows using a custom function.

      https://wiki.blazegraph.com/wiki/index.php/CustomFunction

        Activity

        Hide
        bryanthompson bryanthompson added a comment -

        Do this for the embedded use case. Note that for the server you would have to hook the BigdataRDFServletContextListener.contextInitialized() method by overriding web.xml. Please link the new example and information about how to hook the BigdataRDFServletContextListener to the CustomFunctions wiki page.

        Show
        bryanthompson bryanthompson added a comment - Do this for the embedded use case. Note that for the server you would have to hook the BigdataRDFServletContextListener.contextInitialized() method by overriding web.xml. Please link the new example and information about how to hook the BigdataRDFServletContextListener to the CustomFunctions wiki page.
        Hide
        beebs Brad Bebee added a comment -

        There are two modes for this embedded and with the NanoSparqlServer (NSS). The current Wiki instructions capture the Embedded. For the NSS, you must override the BigdataRDFContextListener contextInitialized method to add the function registry. Then the web.xml must be updated to use the overridden context listener in the web.xml listener.

        MyBigdataRDFContextListener extends BigdataRDFContextListener {
        
              contextInitialized(final ServletContextEvent e) {
        
                      super.contextInitialized(e);
        
                     URI myFunctionURI = new URIImpl("http://www.example.com/validate");
        
                     FunctionRegistry.add(myFunctionURI, myFactory);
        
              }
        
        }
        

        web.xml update

          <listener>
           <listener-class>MyBigdataRDFServletContextListener</listener-class>
          </listener>
        

        It should be possible to do this in the executable jar using the jetty overrideWeb descriptor. This needs to be tested and validated.

         
        java -cp /path/to/my/classes -server -Xmx4g -Djetty.overrideDescriptor=/path/to/my/updated/web.xml -jar bigdata-bundled.jar 
        
        Show
        beebs Brad Bebee added a comment - There are two modes for this embedded and with the NanoSparqlServer (NSS). The current Wiki instructions capture the Embedded. For the NSS, you must override the BigdataRDFContextListener contextInitialized method to add the function registry. Then the web.xml must be updated to use the overridden context listener in the web.xml listener. MyBigdataRDFContextListener extends BigdataRDFContextListener { contextInitialized( final ServletContextEvent e) { super .contextInitialized(e); URI myFunctionURI = new URIImpl( "http: //www.example.com/validate" ); FunctionRegistry.add(myFunctionURI, myFactory); } } web.xml update <listener> <listener-class>MyBigdataRDFServletContextListener</listener-class> </listener> It should be possible to do this in the executable jar using the jetty overrideWeb descriptor. This needs to be tested and validated. java -cp /path/to/my/classes -server -Xmx4g -Djetty.overrideDescriptor=/path/to/my/updated/web.xml -jar bigdata-bundled.jar
        Hide
        andrzejpa Andrzej added a comment -

        The proposed workaround works perfectly. Thanks!

        Show
        andrzejpa Andrzej added a comment - The proposed workaround works perfectly. Thanks!
        Hide
        beebs Brad Bebee added a comment -

        Thanks. I've updated the Wiki with a link to this ticket for the NanoSparqlServer instance: https://wiki.blazegraph.com/wiki/index.php/CustomFunction.

        Show
        beebs Brad Bebee added a comment - Thanks. I've updated the Wiki with a link to this ticket for the NanoSparqlServer instance: https://wiki.blazegraph.com/wiki/index.php/CustomFunction .
        Hide
        beebs Brad Bebee added a comment -

        Initial embedded tests look OK. Please add a unit test and non-embedded example.

        https://github.com/SYSTAP/blazegraph-samples/pull/9#issuecomment-142298248

        Show
        beebs Brad Bebee added a comment - Initial embedded tests look OK. Please add a unit test and non-embedded example. https://github.com/SYSTAP/blazegraph-samples/pull/9#issuecomment-142298248
        Hide
        maria.krokhaleva maria.krokhaleva added a comment -

        Added a non-embedded example.
        PR: https://github.com/SYSTAP/blazegraph-samples/pull/10

        Show
        maria.krokhaleva maria.krokhaleva added a comment - Added a non-embedded example. PR: https://github.com/SYSTAP/blazegraph-samples/pull/10

          People

          • Assignee:
            maria.krokhaleva maria.krokhaleva
            Reporter:
            beebs Brad Bebee
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: