Hi,

I cannot write to an existing graph in the workspace from an SWP.  This is
a problem that has plagued me since TBC 5.1.4 so perhaps I'm doing
something wrong.  I've attached a minimal example as a project.

The file, swp_write_to_graph.ui.ttlx contains a subclass of ui:Services
called w2g:w2graph.  In the ui:prototype, I populate a temp graph
(ui:tempGraphFinalOutput) with a single triple.  ui:prototype shown below.

Next, I dump the temp graph to a temporary file using ui:dumpGraph to
ensure ui:tempGraphFinalOutput contains the triple.  This works as
expected.  Then I try to insert the contents into an RDF file that exists
in the workspace.  This file contains nothing but the triples TBC creates
when a new RDF file is created.

The SWP call completes successfully but the single triple is not inserted
into the existing graph.

The SWP is called using:

http://localhost:8083/tbl/swp?_viewClass=w2g:w2graph&outputGraph=http://example.com/swp_write_to_graph_output&_contextdebug=true

What am I missing such that I cannot insert triples into existing graphs
from an SWP?

Note that my ultimate goal is to pass the name of the output graph into the
SWP so you will see a constraint setup for that purpose but it is not used
in this example.

Any help would be appreciated.  I need to create a number of SWPs and being
able to manipulate graphs at will is a skill I need.

Tim



<ui:group let:outputFileGraph="{= IRI(?outputGraph) }">
    <h3>The output graph is {= ?outputGraph }  Graph: {= ?outputFileGraph
}</h3>{= smf:trace("Populating the temp graph... ") }<ui:update
ui:updateQuery="{!
            INSERT {
                GRAPH ui:tempGraphFinalOutput {
                    ?uri rdfs:label &quot;I am a Thing&quot; .
                } .
            }
            WHERE {
                BIND (spif:buildURI(&quot;&lt;
http://example.com/{?1}&gt;&quot;, &quot;i_am_a_thing&quot;) AS ?uri) .
            } }"/>{= smf:trace("Finished!") }

{= smf:trace("Dumping to the debug graph...") }<ui:dumpGraph
ui:filePath="/SWP_Example/swp_write_to_graph_debug_output.ttl"
ui:graph="ui:tempGraphFinalOutput"/>
    <!-- Try to insert into the output graph -->{= smf:trace("Writing
output graph... ") }<ui:setContext ui:queryGraph="ui:tempGraphFinalOutput">
        <ui:update ui:updateQuery="{!
                INSERT {
                    GRAPH &lt;
http://example.com/swp_write_to_graph_output&gt; {
                        ?s ?p ?o .
                    } .
                }
                WHERE {
                    ?s ?p ?o .
                } }"/>
    </ui:setContext>
</ui:group>

-- 
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 topbraid-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/CAF0Wbn%2BG7FQ8vk8nsLP8FPt%3DoLy86mOs9PuBudBcQP4FTTyO3g%40mail.gmail.com.

<<attachment: SWP_Example.zip>>

Reply via email to