|
Jamal; I'm not able to verify this behavior. I've
attached a script that binds a variable name to
?surname then uses it in an ApplyByConstruct,
and does so correctly. It returns a SPARQL Endpoint result in
JSON. You can run this by 1) copying
the file to your workspace (Navigator View), 2) choose Script >
Refresh/Display SPARQLMotion functions
to register the script, then 3) open a browser to: http://localhost:8083/tbl/sparqlmotion?id=smvt:testSMvarWithKNames The best way to tell if a variable is bound at any point in the script is to set a breakpoint on a module. Click the blue dot icon while editing a SPARQLMotion script and click on the module you want to set it on. Then execute the script, either in Composer or via a Web browser on the associated function name (see example attached and one at http://www.topquadrant.com/products/SPARQLMotion_docs/SPARQLMotion_ex_dbpediaCapitals.html). In Composer, a debug window will appear. On the first page (Variables) is a list of all variables the script knows about at that point in the script. You can also go to the Query page an execute a query that will be valid against the triple stream at that specific module - i.e. those are the triples the module has at its disposal. Given that, you should be able to tell when your variable is defined and when it is not. If you have a scenario in which TopBraid is not setting the variable correctly, an example such as the on attached would be a good idea so we can look into it more closely. -- Scott On 2/17/2013 11:27 AM, J.REZZOUK wrote:
Hello Scott, -- -- 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. |
# baseURI: http://support.tq.com/tesSMvars # imports: http://topbraid.org/sparqlmotionfunctions # imports: http://topbraid.org/sparqlmotionlib-tbc
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . @prefix kennedys: <http://topbraid.org/examples/kennedys#> . @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 smvt: <http://support.tq.com/tesSMvars#> . @prefix sp: <http://spinrdf.org/sp#> . @prefix spin: <http://spinrdf.org/spin#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <http://support.tq.com/tesSMvars> rdf:type owl:Ontology ; owl:imports <http://topbraid.org/sparqlmotionfunctions> , <http://topbraid.org/sparqlmotionlib-tbc> ; owl:versionInfo "Created with TopBraid Composer"^^xsd:string . smvt:ApplyConstruct_1 rdf:type sml:ApplyConstruct ; rdfs:label "Apply construct 1"^^xsd:string ; sm:next smvt:testSMvarWithKNames_Return ; sml:constructQuery [ rdf:type sp:Construct ; sp:templates ([ sp:object [ sp:varName "newName"^^xsd:string ] ; sp:predicate rdfs:label ; sp:subject [ sp:varName "s"^^xsd:string ] ]) ; sp:where ([ sp:object "Kennedy" ; sp:predicate kennedys:lastName ; sp:subject [ sp:varName "s"^^xsd:string ] ] [ sp:object [ sp:varName "fname"^^xsd:string ] ; sp:predicate kennedys:firstName ; sp:subject [ sp:varName "s"^^xsd:string ] ] [ rdf:type sp:Bind ; sp:expression [ rdf:type sp:concat ; sp:arg1 [ sp:varName "surname"^^xsd:string ] ; sp:arg2 ", " ; sp:arg3 [ sp:varName "fname"^^xsd:string ] ] ; sp:variable [ sp:varName "newName"^^xsd:string ] ]) ] . smvt:BindBySelect_1 rdf:type sml:BindBySelect ; rdfs:label "Bind by select 1"^^xsd:string ; sm:next smvt:ApplyConstruct_1 ; sml:selectQuery [ rdf:type sp:Select ; sp:resultVariables ([ sp:varName "surname"^^xsd:string ]) ; sp:where ([ rdf:type sp:Bind ; sp:expression "Kennedy" ; sp:variable [ sp:varName "surname"^^xsd:string ] ]) ] . <http://support.tq.com/tesSMvars#Import-kennedys.ttl_1> rdf:type sml:ImportRDFFromWorkspace ; rdfs:label "Import kennedys.ttl"^^xsd:string ; sm:next smvt:BindBySelect_1 ; sml:baseURI "http://topbraid.org/examples/kennedys"^^xsd:string . smvt:testSMvarWithKNames rdf:type sm:Function ; rdfs:comment "http://localhost:8083/tbl/sparqlmotion?id=smvt:testSMvarWithKNames"^^xsd:string ; rdfs:subClassOf sm:Functions ; sm:returnModule smvt:testSMvarWithKNames_Return . smvt:testSMvarWithKNames_Return rdf:type sml:ReturnSPARQLResults ; sml:selectQuery [ rdf:type sp:Select ; sp:resultVariables ([ sp:varName "name"^^xsd:string ]) ; sp:where ([ sp:object kennedys:Person ; sp:predicate rdf:type ; sp:subject [ sp:varName "person"^^xsd:string ] ] [ sp:object [ sp:varName "name"^^xsd:string ] ; sp:predicate rdfs:label ; sp:subject [ sp:varName "person"^^xsd:string ] ]) ] ; sml:serialization sm:JSON .
