Hi Luca,

the spin:constraints (arguments) are not just strings even though the UI of TBC makes them appear like strings. They are in fact blank nodes that carry additional triples such as spl:valueType. I suggest to take an existing function as a blueprint and recreate the bnode object that is used there.

HTH
Holger



On 25/03/2016 3:21, Luca Greco wrote:
Hi all,

I have some troubles in specifying arguments for a SPIN function I'm defining through the API.

Let's say this is the definition (code fragment):

spinQuery = (Ask)( arq2SPIN.createQuery(arqQuery1, queryUri));
Function fun = union.createResource(uri, SPIN.Function).as(Function.class);

fun.addProperty(SPIN.body, spinQuery);

SPINModuleRegistry.get().register(fun, null, true);


in my case, spinQuery contains " ASK WHERE {... }"

I have to specify 2 arguments for the function.

I've tried the following solution:

fun.addProperty(SPIN.constraint, "arg:spThing : rdfs:Resource");
fun.addProperty(SPIN.constraint, "arg:area : rdfs:Resource");

It doesn't work.

Am I doing something wrong?

Many thanks in advance
Luca



Il giorno domenica 20 luglio 2014 03:14:59 UTC+2, Holger Knublauch ha scritto:

    Hi Monika,

    the SPIN API is designed to be driven in the same way that SPIN
    files are driven - by declarations in RDF. In other words, the
    proper way of defining SPIN functions is to edit them with an RDF
    editor (such as TopBraid or a text editor) and then simply load
    the function definitions into the module registry. This is shown
    in the KennedysInferencingAndConstraintsExample via

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

    then just use them in your SPARQL/SPIN queries. In the SPIN RDF
    syntax - if you ever want to generate that programmatically, use
    the Jena API to create the corresponding triples - a SPIN function
    call is simply an instance of the function class.

    You may want to clarify which parts of your application are
    statically edited and which ones are dynamically produced for
    further advise.

    Holger


    On 7/20/2014 5:16, Monika Solanki wrote:
    I am fairly new to SPIN and the SPIN API. I am looking for
    examples that show how to create a user defined function using
    the SPIN API and use it within a query that runs over a model. I
    am mostly aware of how I could develop the second part, but I
    would like help on programmatically creating the user defined
    function.

    Many Thanks,

    Monika
-- -- 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 Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
    To post to this group, send email to
    [email protected] <javascript:>
    To unsubscribe from this group, send email to
    [email protected] <javascript:>
    For more options, visit this group at
    http://groups.google.com/group/topbraid-users?hl=en
    <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] <javascript:>.
    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.

--
You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
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/d/optout.

--
You received this message because you are subscribed to the Google Group "TopBraid 
Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), 
Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, TopBraid Insight, 
SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
--- 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/d/optout.

Reply via email to