Dynamically generated graph inserts

6 views
Skip to first unread message

Joseph Shea

unread,
Jun 21, 2010, 4:45:27 PM6/21/10
to TopBraid Suite Users
I would like to use Sparql update commands like insert and delete in
SparqlMotion using the PerformUpdate Module, but have a variable name
for the graph. An example would be

INSERT INTO <http://www.testontology.com{?DBName}> {

?s ?p ?o .

}

WHERE {

?s a Owl:Thing.

?s ?p ?o .

}

Holger Knublauch

unread,
Jun 21, 2010, 6:39:00 PM6/21/10
to topbrai...@googlegroups.com
Hi Joe,

having variables there is not supported (yet?) by the SPARQL syntax, so we had to add a "hack" to allow this common requirement. The trick is that you need to pre-bind a variable (such as ?myGraph) to the URI resource of the named graph in a previous SM step. Then, you can "call" this named graph using the naming convention <urn:var:myGraph>.

I believe this mechanism should be working in 3.3.1 - if not then you will need to wait for 3.3.2 (soon).

Regards,
Holger

> --
> 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
> topbrai...@googlegroups.com
> To unsubscribe from this group, send email to
> topbraid-user...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/topbraid-users?hl=en

Joseph Shea

unread,
Jun 22, 2010, 9:37:10 AM6/22/10
to TopBraid Suite Users
Can you give me an example of this?
> >http://groups.google.com/group/topbraid-users?hl=en- Hide quoted text -
>
> - Show quoted text -

Holger Knublauch

unread,
Jun 22, 2010, 8:39:36 PM6/22/10
to topbrai...@googlegroups.com
Hi Joe,

here is an example script (attached).

In the (upcoming) SPARQLMotion XML syntax, this will look like

<sparqlmotion>

    <sml:BindBySelect sml:selectQuery="{#
        SELECT ?myGraph
        WHERE {
            LET (?myGraph := &lt;http://topbraid.org/examples/kennedys&gt;) .
        } }"/>

    <sml:PerformUpdate sml:updateQuery='{#
        INSERT INTO &lt;urn:var:myGraph&gt; {
            owl:Thing rdfs:comment "Test" .
        }
        WHERE {
        } }'/>

</sparqlmotion>

HTH
Holger
smlPerformUpdateWithVarGraph.ttl
Reply all
Reply to author
Forward
0 new messages