Jamal; It could be a bit simpler than you think.  Attached is an example that will take a query as an argument and return the results in JSON format.  The key to the example is to name the argument to match the local name of the query property - in this case selectQuery.

This is also set up as a Web service, so you can find all of the first names in our kennedys model with the following URL:


localhost:8083/tbl/sparqlmotion?id=testSPINxlation&selectQuery=SELECT DISTINCT * WHERE {?s kennedys:firstName ?o}

This assumes the TBC-ME personal server.  For a TBL server, replace the server name accordingly.

Let us know if that helps you any.


-- Scott

On 11/9/2012 7:09 AM, J.REZZOUK wrote:
Hello,

In a SPARQL motion script (TBCME Version: 3.6.2.v20120921-1501R , Windows 7), based on input parameters, I have built a SPARQL query string and I want to run this query.
I wanted to use sml:ConvertStringToSPINRDF to generate a sp:Select instance and use the uri of this resource as input argument of sml:CreateSPINResultSet. But I have an error message saying "Error: java.lang.IllegalArgumentException: Node must be either literal or a SPIN query or a SPIN template call". I don't understand the reason. Could you help me ?

Thanks in advance
Jamal

--
-- 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
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
 
 
# baseURI: http://support.tq.com/TestSPARQL_SPINxlation
# imports: http://topbraid.org/sparqlmotionfunctions
# imports: http://topbraid.org/sparqlmotionlib-tbc

@prefix :        <http://support.tq.com/TestSPARQL_SPINxlation#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sm:      <http://topbraid.org/sparqlmotion#> .
@prefix sml:     <http://topbraid.org/sparqlmotionlib#> .
@prefix sp:      <http://spinrdf.org/sp#> .
@prefix spin:    <http://spinrdf.org/spin#> .
@prefix spl:     <http://spinrdf.org/spl#> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .

<http://spinrdf.org/arg#selectQuery>
      rdf:type rdf:Property ;
      rdfs:label "select query"^^xsd:string ;
      rdfs:subPropertyOf sp:arg .

<http://support.tq.com/TestSPARQL_SPINxlation>
      rdf:type owl:Ontology ;
      owl:imports <http://topbraid.org/sparqlmotionlib-tbc> , 
<http://topbraid.org/sparqlmotionfunctions> ;
      owl:versionInfo "Created with TopBraid Composer"^^xsd:string .

<http://support.tq.com/TestSPARQL_SPINxlation#Import-kennedys.ttl_1>
      rdf:type sml:ImportRDFFromWorkspace ;
      rdfs:label "Import kennedys.ttl"^^xsd:string ;
      sm:next :testSPINxlation_Return ;
      sm:nodeX 39 ;
      sm:nodeY 211 ;
      sml:baseURI "http://topbraid.org/examples/kennedys"^^xsd:string .

:testSPINxlation
      rdf:type sm:Function ;
      rdfs:subClassOf sm:Functions ;
      spin:constraint
              [ rdf:type spl:Argument ;
                spl:predicate <http://spinrdf.org/arg#selectQuery> ;
                spl:valueType xsd:string ;
                sm:next :testSPINxlation_Return ;
                sm:nodeX 330 ;
                sm:nodeY 89
              ] ;
      sm:returnModule :testSPINxlation_Return .

:testSPINxlation_Return
      rdf:type sml:ReturnSPARQLResults ;
      sm:nodeX 353 ;
      sm:nodeY 367 ;
      sml:serialization sm:JSON .

Reply via email to