I am attaching a script that looks as in the screenshot:
You need to make sure that the PerformUpdate specifies the target
graphs, using the GRAPH keyword. Otherwise it doesn't know where the
triples shall go.
The Merge step is just there as a dummy placeholder for some module that
handles the result graph.
Depending on your setup, SWP might be a better choice for such
SPARQL-based transformation scripts.
HTH
Holger
On 24/07/2019 05:40, Jack Hodges wrote:
I have a question. Does anyone have an example of an IterateOverSelect
that has a body that performs an insert on the results of the
IterateOverSelect variables?
My Intent: execute a IterateOnSelect SELECT that produces multiple
rows of several bindings, use body of IterateOnSelect to INSERT each row
sml:selectQuery:
SELECT ?a ?b ?c
WHERE {
something related to input argument .
}
sm:body:
INSERT {
qname, label, and properties of qname
}
WHERE {
something using ?a, ?b, and ?c
create unique qname and labels
}
sm:next:
Do something with the items that were inserted by the sm:body
But the IterateOverSelect never seems to get executed (at least, I
cannot see it binding ?a, ?b, or ?c and no insertions are performed.
The SPARQL MOTION library reference has no examples.
Thank you...
Jack
--
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]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/87db2c97-5c2a-4b2e-8723-8e543e0ad221%40googlegroups.com
<https://groups.google.com/d/msgid/topbraid-users/87db2c97-5c2a-4b2e-8723-8e543e0ad221%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/00944167-65ac-dab2-8c38-5b396d2d24cd%40topquadrant.com.
# baseURI: http://example.org/iterateOverInsert
# imports: http://topbraid.org/sparqlmotionfunctions
# imports: http://topbraid.org/sparqlmotionlib-tb
# prefix: iterateOverInsert
@prefix iterateOverInsert: <http://example.org/iterateOverInsert#> .
@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 xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://example.org/iterateOverInsert>
a owl:Ontology ;
owl:imports <http://topbraid.org/sparqlmotionfunctions> ;
owl:imports <http://topbraid.org/sparqlmotionlib-tb> ;
owl:versionInfo "Created with TopBraid Composer" ;
.
<http://example.org/iterateOverInsert#Import-kennedys.ttl_1>
a sml:ImportRDFFromWorkspace ;
sm:next iterateOverInsert:IterateOverSelect_1 ;
sml:baseURI "http://topbraid.org/examples/kennedys" ;
rdfs:label "Import kennedys.ttl" ;
.
iterateOverInsert:IterateOverSelect_1
a sml:IterateOverSelect ;
sm:body iterateOverInsert:PerformUpdate_1 ;
sm:next iterateOverInsert:Merge_1 ;
sm:nodeX 454 ;
sm:nodeY 182 ;
sml:selectQuery [
a sp:Select ;
sp:where (
[
sp:object owl:Class ;
sp:predicate rdf:type ;
sp:subject [
sp:varName "class" ;
] ;
]
) ;
] ;
rdfs:label "Iterate over select 1" ;
.
iterateOverInsert:Merge_1
a sml:Merge ;
sm:nodeX 881 ;
sm:nodeY 221 ;
rdfs:label "Merge 1" ;
.
iterateOverInsert:PerformUpdate_1
a sml:PerformUpdate ;
sm:nodeX 518 ;
sm:nodeY 319 ;
sml:updateQuery [
a sp:Modify ;
sp:insertPattern (
[
a sp:NamedGraph ;
sp:elements (
[
sp:object "Comment added" ;
sp:predicate rdfs:comment ;
sp:subject [
sp:varName "class" ;
] ;
]
) ;
sp:graphNameNode <http://topbraid.org/examples/kennedys> ;
]
) ;
sp:where () ;
] ;
rdfs:label "Perform update 1" ;
.