Sparqlmotion working with EDG context

16 views
Skip to first unread message

Colin Meerveld

unread,
Apr 23, 2020, 3:46:14 AM4/23/20
to TopBraid Suite Users
Hi,

I created a sparqlmotion service to convert RDF to XML. For asserted triples which are deployed to EDG this seems to work fine. However, newly created instances within EDG doesn't work. I currently use the import module (see screenshot) and believe this must be changed to an EDG context (e.g. an EDG exposed graph) but don't know how to practically do this. Some assistance would be appreciated.


sparqlmotion.jpg


Thanks,

Colin Meerveld

Richard Cyganiak

unread,
Apr 23, 2020, 4:22:50 AM4/23/20
to topbraid-users list
Hi Colin,

I think what you need to do is:

1) Get the graph URI of the asset collection containing the EDG instances. This can be found on the Settings tab of the asset collection and is a URI of the form urn:x-evn-master:...

2) In the SPARQLMotion script, use the Import RDF From Workspace module, with that graph URI as the sml:baseURI, and sml:ignoreImports set to true or false depending on whether you want to include triples from other included asset collections and system graphs

3) Any further SPARQLMotion modules in the chain now have access to the triples from the EDG asset collection.

Hope that helps,
Richard


On 23 Apr 2020, at 07:33, Colin Meerveld <colin.m...@gmail.com> wrote:

Hi,

I created a sparqlmotion service to convert RDF to XML. For asserted triples which are deployed to EDG this seems to work fine. However, newly created instances within EDG doesn't work. I currently use the import module (see screenshot) and believe this must be changed to an EDG context (e.g. an EDG exposed graph) but don't know how to practically do this. Some assistance would be appreciated.


<sparqlmotion.jpg>


Thanks,

Colin Meerveld

--
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-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/c3107eba-bb3d-4d05-b337-932fae67d92c%40googlegroups.com.
<sparqlmotion.jpg>

Colin Meerveld

unread,
Apr 24, 2020, 2:41:30 AM4/24/20
to TopBraid Suite Users
Hi Richard,

Great, this works, thank you so much! I never knew that a workspace was referring to an EDG asset collection as i always thought this was a composer/eclipse workspace. 

Colin 

On Thursday, April 23, 2020 at 10:22:50 AM UTC+2, Richard Cyganiak wrote:
Hi Colin,

I think what you need to do is:

1) Get the graph URI of the asset collection containing the EDG instances. This can be found on the Settings tab of the asset collection and is a URI of the form urn:x-evn-master:...

2) In the SPARQLMotion script, use the Import RDF From Workspace module, with that graph URI as the sml:baseURI, and sml:ignoreImports set to true or false depending on whether you want to include triples from other included asset collections and system graphs

3) Any further SPARQLMotion modules in the chain now have access to the triples from the EDG asset collection.

Hope that helps,
Richard

On 23 Apr 2020, at 07:33, Colin Meerveld <colin....@gmail.com> wrote:

Hi,

I created a sparqlmotion service to convert RDF to XML. For asserted triples which are deployed to EDG this seems to work fine. However, newly created instances within EDG doesn't work. I currently use the import module (see screenshot) and believe this must be changed to an EDG context (e.g. an EDG exposed graph) but don't know how to practically do this. Some assistance would be appreciated.


<sparqlmotion.jpg>


Thanks,

Colin Meerveld

--
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 topbrai...@googlegroups.com.

Richard Cyganiak

unread,
Apr 24, 2020, 8:14:39 AM4/24/20
to topbraid-users list
Yes, EDG has the same kind of workspace as TBC underneath, although in EDG it is usually somewhat hidden behind a higher-level abstraction (an RDF/SPARQL-style “set of named graphs”, which in turn is somewhat hidden behind the “asset collection” abstraction).

The name of the “Import RDF From Workspace” module might be a bit unhelpful when using it with the sml:baseURI argument. Think of it as “Load triples from a system-managed graph into a SPARQLMotion script”.

Richard


To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/5aec5131-0925-4045-bd90-d0755ac58bad%40googlegroups.com.

Colin Meerveld

unread,
Jun 4, 2020, 9:09:31 AM6/4/20
to TopBraid Suite Users
Hi Richard,

Still a bit confused. Currently i want to do the opposite. i.e.  add data to EDG similar to the following SPARQL query:

INSERT {
GRAPH ?graph {
    ?s rdfs:comment ?annotation .
}
}
WHERE {
BIND("archimate_example_model" AS ?workspace).
BIND("aangifte" AS ?station).
  BIND("test3" AS ?annotation).
    BIND (URI(CONCAT("urn:x-evn-master:", ?workspace)) AS ?graph) .
    GRAPH ?graph {
        ?s rdfs:label ?station .
    } .
}

This query works in Composer. I translated this into a sparqlmotion script where the first three binds are arguments and uses an apply construct node to construct the new nodes.   Lastly i use the Export-to-RDF-file node to save the constructed triples back in the asset collection. However the last step doesn't work. Any thoughts?

Thanks,

Colin




On Friday, April 24, 2020 at 2:14:39 PM UTC+2, Richard Cyganiak wrote:
Yes, EDG has the same kind of workspace as TBC underneath, although in EDG it is usually somewhat hidden behind a higher-level abstraction (an RDF/SPARQL-style “set of named graphs”, which in turn is somewhat hidden behind the “asset collection” abstraction).

The name of the “Import RDF From Workspace” module might be a bit unhelpful when using it with the sml:baseURI argument. Think of it as “Load triples from a system-managed graph into a SPARQLMotion script”.

Richard

Richard Cyganiak

unread,
Jun 4, 2020, 2:16:06 PM6/4/20
to topbraid-users list
Hi Colin,

Export to RDF file actually does what it says on the tin—it exports the results to an RDF file in the workspace. It doesn't work for updating a graph in the system database.

The closest equivalent to Import RDF from Workspace in the other direction is Perform Update, but that is not entirely safe to use for EDG graphs such as the urn:x-evn-master:xxx ones.

Personally I would use SWP over SPARQLMotion for this kind of task. It's much closer to a traditional programming/scripting language (but with a very strange syntax, and an RDF/SPARQL-based type system).

Richard


To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/ce17f04c-27d4-4b73-be0a-9ced164c3b9d%40googlegroups.com.

Colin Meerveld

unread,
Jun 5, 2020, 4:56:38 AM6/5/20
to TopBraid Suite Users
Thanks again Richard! 

I played around with the Perform update node for a while but somehow it doesn't update the EDG graph. This is, i suppose, why you need SWP. I use SWP only for UI to keep it separated from the (web)services which makes it more readable. 

Another option, i guess, is to use a graphgl endpoint but the project already uses a couple of sparqlmotions scripts and i don't like to mix those different abstraction into one project. Currently i use a sparqlmotion service and return a swp document so-that i could set the context. This feels like a hack but does the job. 

Here is the final solution:

<ui:group let:graphURI="{= IRI(CONCAT(&quot;urn:x-evn-master:&quot;, LCASE(?workspace))) }">
    <ui:setContext ui:queryGraph="{= ui:graphWithImports(?graphURI) }">
        <ui:update ui:updateQuery="{!
                INSERT {
                    GRAPH ?graphURI {
                        ?s rdfs:comment ?annotation .
                    } .
                }
                WHERE {
                    GRAPH ?graphURI {
                        ?s rdfs:label ?station .
                    } .
                } }"/>
    </ui:setContext>
done!
</ui:group>



Cheers,

Colin


      

On Thursday, June 4, 2020 at 8:16:06 PM UTC+2, Richard Cyganiak wrote:
Hi Colin,

Export to RDF file actually does what it says on the tin—it exports the results to an RDF file in the workspace. It doesn't work for updating a graph in the system database.

The closest equivalent to Import RDF from Workspace in the other direction is Perform Update, but that is not entirely safe to use for EDG graphs such as the urn:x-evn-master:xxx ones.

Personally I would use SWP over SPARQLMotion for this kind of task. It's much closer to a traditional programming/scripting language (but with a very strange syntax, and an RDF/SPARQL-based type system).

Richard
To unsubscribe from this group and stop receiving emails from it, send an email to topbrai...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/ce17f04c-27d4-4b73-be0a-9ced164c3b9d%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages