|
John; In terms of passing a string
argument, the best way to do this is to use one
of the wizards to set the type in the
spl:Argument's to be what you want it to be
in the end. If that's a string, then use
xsd:string. If it's a URI, then set to rdf:Property, owl:Ontology, owl:Class, myns:Thing_1, etc and it
will be cast the value, if it is a
properly formatted URI. In that respect, make sure you use the Scripts > Create SPARQLMotion function/web service... This wizard does three things: 1) creates a new script 2) names the script so it can be called as a Web service 3) creates the arguments using the spl:Argument template wizard In terms of the Web service call, everything starts out as a string. And you do have to be careful about getting the proper HTTP encoding. The exceptions you sent indicate that perhaps the URI that was passed was not well-formatted. One hint is that most entities (browsers, etc.) will take slashes but not hashes, so use %23 for '#'. Finally, I attached a script that has an example of passing a value that is cast to a property and used to query our favorite kennedys model. Test it with the URL: http://localhost:8083/tbl/sparqlmotion?id=http://support.tq.com/exampleServicePassArgument%23GetKennedyPropValues&property=http://topbraid.org/examples/kennedys%23name Hopefully that can give you solid ground to start from. -- Scott On 3/11/2013 7:31 PM, John Perdoni
wrote:
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/exampleServicePassArgument # imports: http://topbraid.org/sparqlmotionfunctions # imports: http://topbraid.org/sparqlmotionlib-tbc
@prefix ex: <http://support.tq.com/exampleServicePassArgument#> . @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://support.tq.com/exampleServicePassArgument> rdf:type owl:Ontology ; owl:imports <http://topbraid.org/sparqlmotionlib-tbc> , <http://topbraid.org/sparqlmotionfunctions> ; owl:versionInfo "Created with TopBraid Composer"^^xsd:string . ex:GetKennedyPropValues rdf:type sm:Function ; rdfs:comment "An example script that queries the kennedys model for all property values for a property passed in as an argument. To test, call with http://localhost:8083/tbl/sparqlmotion?id=http://support.tq.com/exampleServicePassArgument%23GetKennedyPropValues&property=http://topbraid.org/examples/kennedys%23name"^^xsd:string ; rdfs:subClassOf sm:Functions ; spin:constraint [ rdf:type spl:Argument ; rdfs:comment "The property that will be queried - i.e. {?s ?property ?o}. Must be a URI."^^xsd:string ; spl:predicate <http://spinrdf.org/arg#property> ; spl:valueType rdf:Property ; sm:next <http://support.tq.com/exampleServicePassArgument#Import-kennedys.ttl_1> ; sm:nodeX 45 ; sm:nodeY 23 ] ; sm:returnModule ex:GetKennedyPropValues_Return . ex:GetKennedyPropValues_Return rdf:type sml:ReturnSPARQLResults ; sm:nodeX 54 ; sm:nodeY 246 ; sml:selectQuery [ rdf:type sp:Select ; sp:where ([ sp:object [ sp:varName "o"^^xsd:string ] ; sp:predicate [ sp:varName "property"^^xsd:string ] ; sp:subject [ sp:varName "s"^^xsd:string ] ]) ] ; sml:serialization sm:JSON . <http://support.tq.com/exampleServicePassArgument#Import-kennedys.ttl_1> rdf:type sml:ImportRDFFromWorkspace ; rdfs:label "Import kennedys.ttl"^^xsd:string ; sm:next ex:GetKennedyPropValues_Return ; sm:nodeX 92 ; sm:nodeY 144 ; sml:baseURI "http://topbraid.org/examples/kennedys"^^xsd:string .
