|
Stanley; The
way to get to most of the features of TopBraid Live (i.e. the internals
of Composer) is to develop SPARQLMotion scripts that place triples in
Ensemble's session graph, http://tb-session. The general principles
are explained in see the Ensemble Application Development Guide
(http://www.topquadrant.com/products/TBE-Application-Development-Guide.pdf).
BTW, this guide will be updated soon for 3.3. For this question see the chapter on "Integrating SPARQLMotion Scripts with the TBE Applications". Here are the general steps you would need to take to be able to run SPARQL queries on inferred triples from Ensemble. I have also included an example that follows this script. 1. Create a file to store the script (more than one script can be defined per file). Make sure the file has a .sms extension, as seen on the New… SPARQLMotion File dialog. This will register the script with the TBL workspace. 2. Create a named SPIN function as a subclass of spin:Functions (a subclass of spin:Modules). This creates a named entity for a Web service that will be used to call your script from Ensemble. 3. Above the spin:Constraints property of your SPIN function, choose the triangular menu item and choose "Create from SPIN template". In that wizard, choose SelectedResourceArgument and fill the valueType with rdfs:Resource (this defined the type of the selected resource in Ensemble - the menu item will appear if the selected resource's type matches the subsumption hierarchy of the type). 4. Link the SPIN function to the SPARQLMotion script you define using the returnModule property. 5. The SPARQL motion script is rather simple. There are three main modules, but of course you can refine this as needed to do any specialized processing desired: 5a. ImportCurrentRDF (imports whatever is being viewed in Ensemble) 5b. ApplyOWLIM (or ApplyTopSPIN or ApplyPellet or the combination of data processing you need) 5c. use replace=true in the triple stream to avoid re-asserting triples already in ImportCurrentRDF 5d. Assert inferred triples into Ensemble's graph - i.e. http://tb-session. An easy way to do this is with a PerformUpdate module with the following query: INSERT INTO <http://tb-session> { ?s ?p ?o . } WHERE { ?s ?p ?o . } 6. Refresh SPARQLMotion scripts in Composer (Scripts > Refresh/Display…) 7. Open Ensemble, choose a resource and choose the named SPIN function. This will be the rdfs:label of your SPIN function and is called "Perform OWL Inferences" in the example provided. After doing this, you will be able to apply SPARQL queries that will be executed against the union of asserted and inferred graphs. -- Scott On 4/5/10 4:53 AM, Stanley wrote: --Good day everyone I have a question in TBE I can execute a SPARQL in TBC-ME because I press the button "Use Currently Configured Inferences"but when I use the TBE http://;ocalhost:8083/tbl the SPARQL didn't return any results because there is no button "Use Currently Configured Inferences" how can I solve this problem. You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include TopBraid Composer, TopBraid Live, TopBraid Ensemble, SPARQLMotion 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-composer-users?hl=en To unsubscribe, reply using "remove me" as the subject. |
# Saved by TopBraid on Mon Apr 05 13:11:34 CDT 2010 # baseURI: http://support.tq.com/OWLInferences # imports: http://topbraid.org/sparqlmotionfunctions # imports: http://topbraid.org/sparqlmotionlib @prefix : <http://support.tq.com/OWLInferences#> . @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/OWLInferences> rdf:type owl:Ontology ; owl:imports <http://topbraid.org/sparqlmotionlib> , <http://topbraid.org/sparqlmotionfunctions> ; owl:versionInfo "Created with TopBraid Composer"^^xsd:string . :ApplyTopSPIN_1 rdf:type sml:ApplyTopSPIN ; rdfs:label "Apply top SPIN_1"^^xsd:string ; sm:next :PerformUpdate_1 ; sml:predicate spin:rule ; sml:replace "true"^^xsd:boolean . <http://support.tq.com/OWLInferences#Import-owlrl-all.rdf_1> rdf:type sml:ImportRDFFromWorkspace ; rdfs:label "Import owlrl-all.rdf"^^xsd:string ; sm:next :ApplyTopSPIN_1 ; sml:baseURI "http://topbraid.org/spin/owlrl-all"^^xsd:string . :ImportCurrentRDF_1 rdf:type sml:ImportCurrentRDF ; rdfs:label "Import current RDF_1"^^xsd:string ; sm:next :ApplyTopSPIN_1 . :PerformOWL2Inferences rdf:type spin:Function ; rdfs:label "Perform OWL 2 Inferences"^^xsd:string ; rdfs:subClassOf spin:Functions ; spin:constraint [ rdf:type sml:SelectedResourceArgument ; spl:predicate sml:selectedResource ; spl:valueType rdfs:Resource ] ; sm:returnModule :PerformUpdate_1 . :PerformUpdate_1 rdf:type sml:PerformUpdate ; rdfs:label "Perform update_1"^^xsd:string ; sml:updateQuery [ rdf:type sp:Insert ; sp:graphIRI <http://tb-session> ; sp:insertPattern ([ sp:object _:b1 ; sp:predicate _:b2 ; sp:subject _:b3 ]) ; sp:where ([ sp:object _:b1 ; sp:predicate _:b2 ; sp:subject _:b3 ]) ] . _:b1 sp:varName "o"^^xsd:string . _:b2 sp:varName "p"^^xsd:string . _:b3 sp:varName "s"^^xsd:string .
