I don't think calling a function's exec function directly is a good practice in Jena - it would require preparing the environment etc. If you just want to call the body query manually, get a pointer to it via the SPIN.body triple and convert the object of that triple to Select via the SPINFactory. Once you have a Select, you can turn it into a Jena Query object etc. Sorry we cannot walk down all these details, maybe other community members can.

But the cleanest approach would be to call the function embedded in a SPARQL query, so I would investigate this further. The query SELECT ( <http://spinrdf.org/spin#accountage>(30) AS ?user) {} should work. What is the output - any errors?

Holger


On 5/3/2013 18:53, Anand Raj wrote:

Hi,

I have registered the function, as suggested

registry.registerAll(model, null);

Function function = registry.getFunction("http://spinrdf.org/spin#accountage";, model);

SPINARQFunction spinarqFunction = new SPINARQFunction(function);

I get the function too. Now I need an example how to execute this function using *exec* or *executeBody methods. *I am struck with supplying arguments to methods. How do I create variables and assign value to it.

It would be of great help, if you could share me the sample code.

Thanks
Raj


On Fri, May 3, 2013 at 2:14 PM, Holger Knublauch <[email protected] <mailto:[email protected]>> wrote:

    Hi Anand,

    any SPIN function needs to be registered with the Jena
    FunctionRegistry. The
    KennedysInferencingAndConstraintsExample.java shows how to do this:

            // Register locally defined functions
            SPINModuleRegistry.get().registerAll(ontModel, null);

    *However* this only registers your SPIN functions to Jena, and
    with OWLIM you may be in a situation in which the whole query is
    executed server-side using the native SPARQL engine of OWLIM,
    bypassing any locally registered Jena functions. In a sense Jena
    is just the client then. I have not used the OWLIM Jena bridge,
    but you can verify if an error is reported such as unknown
    function coming from OWLIM directly.

    So please make sure the function is registered at all, and send us
    any error message if it still happens.

    HTH
    Holger




    On 5/3/2013 17:01, Anand Raj wrote:
    I have done the bridging between OWLIM-SE and TopBraid Composer.
    I have even created simple Functions and executed against OWLIM
    data from TopBraid Composer.

    Now I would like to call this spin function using SPIN API on
    OWLIM model,

    *Loading model from OWLIM,*
    manager = RemoteRepositoryManager.getInstance(Preferences
                        .getRepositoryURL());
    manager.initialize();
    owlimRepository =
    manager.getRepository(Preferences.Common.REPOSITORY_NAME);
    owlimRepository.initialize();
    dataset = new SesameDataset(con);
    *model* =
    ModelFactory.createModelForGraph(dataset.getDefaultGraph());

    *Executing SPARQL*
    queryFromSparqlTxt = "SELECT  (
    <http://spinrdf.org/spin#accountage>(30) AS ?user) {}"
    QueryExecution qExec =
    QueryExecutionFactory.create(queryFromSparqlTxt,
    *model*);
            return qExec.execSelect();

    Note:-

    http://spinrdf.org/spin#accountage is the function defined in
    TopBraid Composer and stored back to OWLIM.

    Now, When I execute the SPARQL, I don't get the expected output.

    Please help me on this. Am I missing any spin registry?

    Thanks
    Raj


    On Thu, May 2, 2013 at 11:34 PM, Scott Henninger
    <[email protected] <mailto:[email protected]>>
    wrote:

        Raj; The best way to do this is to download the OWLIM plug-in
        for TopBraid.  Then you have both an ontology editor and your
        back-end.

        The plugin is maintained by Ontotext, so go to
        http://owlim.ontotext.com/display/OWLIMv50/OWLIM-SE+Installation
        to download.  There is a section named "Using OWLIM-SE with
        TopBraid Composer" that explains how to update the OWLIM plug-in.

        If you want to execute the SPIN API as a stand-alone package,
        the API documentation is complete in terms of support for the
        API.

        -- Scott


        On 5/2/2013 5:48 AM, Raj wrote:
        Hi Thanks. I have gone through
        http://www.topquadrant.com/spin/tutorial/. I even tried all
        the samples and works fine for me. Now I would like to
        register the spin template using SPIN API and execute at the
        sesame repository (OWLIM-SE). Could you please provide me
        the sample code.

        Thanks
        Raj

        On Thursday, April 25, 2013 2:36:34 AM UTC+5:30, Scott
        Henninger wrote:

            Raj; I'd suggest taking a look at
            http://topquadrant.com/products/SPIN.html. There are
            some tutorials and references on the right-hand side of
            the page.

            -- Scott

            On 4/24/2013 3:16 PM, Raj wrote:
            Hi,
            I am pretty much familiar with OWLIM, but not with SPIN.

            Could anyone guide me in executing a simple select user
            defined template with a filter option upon OWLIM?

            Thanks in advance.



-- -- You received this message because you are subscribed
            to the Google
            Group "TopBraid Suite Users", the topics of which
            include Enterprise Vocabulary Network (EVN), TopBraid
            Composer, TopBraid Live,
            TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
            To post to this group, send email to
            [email protected]
            To unsubscribe from this group, send email to
            [email protected]
            For more options, visit this group at
            http://groups.google.com/group/topbraid-users?hl=en
            ---
            You received this message because you are subscribed to
            the Google Groups "TopBraid Suite Users" group.
            To unsubscribe from this group and stop receiving
            emails from it, send an email to
            [email protected].
            For more options, visit
            https://groups.google.com/groups/opt_out.



-- -- You received this message because you are subscribed to
        the Google
        Group "TopBraid Suite Users", the topics of which include
        Enterprise Vocabulary Network (EVN), TopBraid Composer,
        TopBraid Live,
        TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
        To post to this group, send email to
        [email protected]
        <mailto:[email protected]>
        To unsubscribe from this group, send email to
        [email protected]
        <mailto:[email protected]>
        For more options, visit this group at
        http://groups.google.com/group/topbraid-users?hl=en
        ---
        You received this message because you are subscribed to the
        Google Groups "TopBraid Suite Users" group.
        To unsubscribe from this group and stop receiving emails
        from it, send an email to
        [email protected]
        <mailto:[email protected]>.

        For more options, visit
        https://groups.google.com/groups/opt_out.



-- -- You received this message because you are subscribed to
        the Google
        Group "TopBraid Suite Users", the topics of which include
        Enterprise Vocabulary Network (EVN), TopBraid Composer,
        TopBraid Live,
        TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
        To post to this group, send email to
        [email protected]
        <mailto:[email protected]>
        To unsubscribe from this group, send email to
        [email protected]
        <mailto:topbraid-users%[email protected]>
        For more options, visit this group at
        http://groups.google.com/group/topbraid-users?hl=en
        ---
        You received this message because you are subscribed to a
        topic in the Google Groups "TopBraid Suite Users" group.
        To unsubscribe from this topic, visit
        
https://groups.google.com/d/topic/topbraid-users/kFCKSd04fEw/unsubscribe?hl=en-US.
        To unsubscribe from this group and all its topics, send an
        email to [email protected]
        <mailto:topbraid-users%[email protected]>.
        For more options, visit https://groups.google.com/groups/opt_out.



-- -- You received this message because you are subscribed to the Google
    Group "TopBraid Suite Users", the topics of which include
    Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid
    Live,
    TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
    To post to this group, send email to
    [email protected]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:[email protected]>
    For more options, visit this group at
    http://groups.google.com/group/topbraid-users?hl=en
    ---
    You received this message because you are subscribed to the
    Google Groups "TopBraid Suite Users" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:[email protected]>.
    For more options, visit https://groups.google.com/groups/opt_out.



-- -- You received this message because you are subscribed to the Google
    Group "TopBraid Suite Users", the topics of which include
    Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live,
    TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
    To post to this group, send email to
    [email protected]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:topbraid-users%[email protected]>
    For more options, visit this group at
    http://groups.google.com/group/topbraid-users?hl=en
    ---
    You received this message because you are subscribed to a topic in
    the Google Groups "TopBraid Suite Users" group.
    To unsubscribe from this topic, visit
    
https://groups.google.com/d/topic/topbraid-users/kFCKSd04fEw/unsubscribe?hl=en-US.
    To unsubscribe from this group and all its topics, send an email
    to [email protected]
    <mailto:topbraid-users%[email protected]>.
    For more options, visit https://groups.google.com/groups/opt_out.



--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.



--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
--- You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to